This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new ec239d785a1 XML and YAML DSL do not output default attributes anymore ec239d785a1 is described below commit ec239d785a1b8d0d035b3c2b03ae99be140f8024 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Sat Nov 16 20:16:40 2024 +0100 XML and YAML DSL do not output default attributes anymore --- .../src/test/resources/AccountService-v6Yaml.txt | 20 ------ .../src/test/resources/GreetingsYaml.txt | 15 +--- .../src/test/resources/OpenApiV302PetstoreYaml.txt | 46 ++----------- ...piV3PetstoreSimpleWithRoutesDescriptionYaml.txt | 1 - .../OpenApiV3PetstoreSimpleWithRoutesYaml.txt | 1 - .../test/resources/OpenApiV3PetstoreSimpleXml.txt | 15 ++-- .../test/resources/OpenApiV3PetstoreSimpleYaml.txt | 1 - .../resources/OpenApiV3PetstoreWithModelYaml.txt | 65 +++--------------- .../OpenApiV3PetstoreWithRestComponentXml.txt | 80 +++++++++++----------- .../OpenApiV3PetstoreWithRestComponentYaml.txt | 65 +++--------------- .../src/test/resources/OpenApiV3PetstoreXml.txt | 78 ++++++++++----------- .../src/test/resources/OpenApiV3PetstoreYaml.txt | 65 +++--------------- 12 files changed, 126 insertions(+), 326 deletions(-) diff --git a/tooling/openapi-rest-dsl-generator/src/test/resources/AccountService-v6Yaml.txt b/tooling/openapi-rest-dsl-generator/src/test/resources/AccountService-v6Yaml.txt index 8dad41425a5..96544572a59 100644 --- a/tooling/openapi-rest-dsl-generator/src/test/resources/AccountService-v6Yaml.txt +++ b/tooling/openapi-rest-dsl-generator/src/test/resources/AccountService-v6Yaml.txt @@ -9,7 +9,6 @@ produces: "application/json" param: - name: "body" - required: true type: "body" to: "direct:post-checkAccountHolder" - id: "post-closeAccount" @@ -21,7 +20,6 @@ produces: "application/json" param: - name: "body" - required: true type: "body" to: "direct:post-closeAccount" - id: "post-closeAccountHolder" @@ -35,7 +33,6 @@ produces: "application/json" param: - name: "body" - required: true type: "body" to: "direct:post-closeAccountHolder" - id: "post-closeStores" @@ -45,7 +42,6 @@ produces: "application/json" param: - name: "body" - required: true type: "body" to: "direct:post-closeStores" - id: "post-createAccount" @@ -56,7 +52,6 @@ produces: "application/json" param: - name: "body" - required: true type: "body" to: "direct:post-createAccount" - id: "post-createAccountHolder" @@ -70,7 +65,6 @@ produces: "application/json" param: - name: "body" - required: true type: "body" to: "direct:post-createAccountHolder" - id: "post-deleteBankAccounts" @@ -80,7 +74,6 @@ produces: "application/json" param: - name: "body" - required: true type: "body" to: "direct:post-deleteBankAccounts" - id: "post-deleteLegalArrangements" @@ -91,7 +84,6 @@ produces: "application/json" param: - name: "body" - required: true type: "body" to: "direct:post-deleteLegalArrangements" - id: "post-deletePayoutMethods" @@ -101,7 +93,6 @@ produces: "application/json" param: - name: "body" - required: true type: "body" to: "direct:post-deletePayoutMethods" - id: "post-deleteShareholders" @@ -111,7 +102,6 @@ produces: "application/json" param: - name: "body" - required: true type: "body" to: "direct:post-deleteShareholders" - id: "post-deleteSignatories" @@ -121,7 +111,6 @@ produces: "application/json" param: - name: "body" - required: true type: "body" to: "direct:post-deleteSignatories" - id: "post-getAccountHolder" @@ -131,7 +120,6 @@ produces: "application/json" param: - name: "body" - required: true type: "body" to: "direct:post-getAccountHolder" - id: "post-getTaxForm" @@ -142,7 +130,6 @@ produces: "application/json" param: - name: "body" - required: true type: "body" to: "direct:post-getTaxForm" - id: "post-getUploadedDocuments" @@ -153,7 +140,6 @@ produces: "application/json" param: - name: "body" - required: true type: "body" to: "direct:post-getUploadedDocuments" - id: "post-suspendAccountHolder" @@ -164,7 +150,6 @@ produces: "application/json" param: - name: "body" - required: true type: "body" to: "direct:post-suspendAccountHolder" - id: "post-unSuspendAccountHolder" @@ -180,7 +165,6 @@ produces: "application/json" param: - name: "body" - required: true type: "body" to: "direct:post-unSuspendAccountHolder" - id: "post-updateAccount" @@ -190,7 +174,6 @@ produces: "application/json" param: - name: "body" - required: true type: "body" to: "direct:post-updateAccount" - id: "post-updateAccountHolder" @@ -213,7 +196,6 @@ produces: "application/json" param: - name: "body" - required: true type: "body" to: "direct:post-updateAccountHolder" - id: "post-updateAccountHolderState" @@ -224,7 +206,6 @@ produces: "application/json" param: - name: "body" - required: true type: "body" to: "direct:post-updateAccountHolderState" - id: "post-uploadDocument" @@ -235,6 +216,5 @@ produces: "application/json" param: - name: "body" - required: true type: "body" to: "direct:post-uploadDocument" diff --git a/tooling/openapi-rest-dsl-generator/src/test/resources/GreetingsYaml.txt b/tooling/openapi-rest-dsl-generator/src/test/resources/GreetingsYaml.txt index 39c112de70f..99350e4c278 100644 --- a/tooling/openapi-rest-dsl-generator/src/test/resources/GreetingsYaml.txt +++ b/tooling/openapi-rest-dsl-generator/src/test/resources/GreetingsYaml.txt @@ -5,27 +5,18 @@ path: "/greetings/{name}" produces: "*/*" param: - - dataType: "string" - name: "name" - required: true - type: "path" + - name: "name" to: "direct:greeting-api" post: - id: "post-greeting-api" path: "/greetings/{name}" produces: "*/*" param: - - dataType: "string" - name: "name" - required: true - type: "path" + - name: "name" to: "direct:post-greeting-api" - id: "bye-api" path: "/bye/{name}" produces: "*/*" param: - - dataType: "string" - name: "name" - required: true - type: "path" + - name: "name" to: "direct:bye-api" diff --git a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV302PetstoreYaml.txt b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV302PetstoreYaml.txt index 7a44e63e206..c1d70abd4ca 100644 --- a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV302PetstoreYaml.txt +++ b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV302PetstoreYaml.txt @@ -9,7 +9,6 @@ param: - description: "Update an existent pet in the store" name: "body" - required: true type: "body" to: "direct:updatePet" - id: "updateUser" @@ -17,14 +16,10 @@ description: "This can only be done by the logged in user." consumes: "application/json,application/xml,application/x-www-form-urlencoded" param: - - dataType: "string" - description: "name that need to be deleted" + - description: "name that need to be deleted" name: "username" - required: true - type: "path" - description: "Update an existent user in the store" name: "body" - required: true type: "body" to: "direct:updateUser" post: @@ -36,7 +31,6 @@ param: - description: "Create a new pet in the store" name: "body" - required: true type: "body" to: "direct:addPet" - id: "updatePetWithForm" @@ -45,16 +39,12 @@ - dataType: "integer" description: "ID of pet that needs to be updated" name: "petId" - required: true - type: "path" - collectionFormat: "multi" - dataType: "string" description: "Name of pet that needs to be updated" name: "name" required: false type: "query" - collectionFormat: "multi" - dataType: "string" description: "Status of pet that needs to be updated" name: "status" required: false @@ -68,16 +58,12 @@ - dataType: "integer" description: "ID of pet to update" name: "petId" - required: true - type: "path" - collectionFormat: "multi" - dataType: "string" description: "Additional Metadata" name: "additionalMetadata" required: false type: "query" - name: "body" - required: true type: "body" to: "direct:uploadFile" - id: "placeOrder" @@ -87,7 +73,6 @@ produces: "application/json" param: - name: "body" - required: true type: "body" to: "direct:placeOrder" - id: "createUser" @@ -98,7 +83,6 @@ param: - description: "Created user object" name: "body" - required: true type: "body" to: "direct:createUser" - id: "createUsersWithListInput" @@ -108,7 +92,6 @@ produces: "application/xml,application/json" param: - name: "body" - required: true type: "body" to: "direct:createUsersWithListInput" get: @@ -118,7 +101,6 @@ produces: "application/xml,application/json" param: - collectionFormat: "multi" - dataType: "string" defaultValue: "available" description: "Status values that need to be considered for filter" name: "status" @@ -135,8 +117,7 @@ \ tag1, tag2, tag3 for testing." produces: "application/xml,application/json" param: - - arrayType: "string" - collectionFormat: "multi" + - collectionFormat: "multi" dataType: "array" description: "Tags to filter by" name: "tags" @@ -151,8 +132,6 @@ - dataType: "integer" description: "ID of pet to return" name: "petId" - required: true - type: "path" to: "direct:getPetById" - id: "getInventory" path: "/store/inventory" @@ -168,21 +147,17 @@ - dataType: "integer" description: "ID of order that needs to be fetched" name: "orderId" - required: true - type: "path" to: "direct:getOrderById" - id: "loginUser" path: "/user/login" produces: "application/xml,application/json" param: - collectionFormat: "multi" - dataType: "string" description: "The user name for login" name: "username" required: false type: "query" - collectionFormat: "multi" - dataType: "string" description: "The password for login in clear text" name: "password" required: false @@ -195,25 +170,19 @@ path: "/user/{username}" produces: "application/xml,application/json" param: - - dataType: "string" - description: "The name that needs to be fetched. Use user1 for testing. " + - description: "The name that needs to be fetched. Use user1 for testing. " name: "username" - required: true - type: "path" to: "direct:getUserByName" delete: - id: "deletePet" path: "/pet/{petId}" param: - - dataType: "string" - name: "api_key" + - name: "api_key" required: false type: "header" - dataType: "integer" description: "Pet id to delete" name: "petId" - required: true - type: "path" to: "direct:deletePet" - id: "deleteOrder" path: "/store/order/{orderId}" @@ -223,16 +192,11 @@ - dataType: "integer" description: "ID of the order that needs to be deleted" name: "orderId" - required: true - type: "path" to: "direct:deleteOrder" - id: "deleteUser" path: "/user/{username}" description: "This can only be done by the logged in user." param: - - dataType: "string" - description: "The name that needs to be deleted" + - description: "The name that needs to be deleted" name: "username" - required: true - type: "path" to: "direct:deleteUser" diff --git a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreSimpleWithRoutesDescriptionYaml.txt b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreSimpleWithRoutesDescriptionYaml.txt index 2f5e1e3387e..7519acc7e00 100644 --- a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreSimpleWithRoutesDescriptionYaml.txt +++ b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreSimpleWithRoutesDescriptionYaml.txt @@ -6,7 +6,6 @@ produces: "application/json,text/xml" param: - name: "body" - required: true type: "body" to: "direct:rest1" - route: diff --git a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreSimpleWithRoutesYaml.txt b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreSimpleWithRoutesYaml.txt index 9b47def1f45..79616b22ce7 100644 --- a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreSimpleWithRoutesYaml.txt +++ b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreSimpleWithRoutesYaml.txt @@ -5,7 +5,6 @@ produces: "application/json,text/xml" param: - name: "body" - required: true type: "body" to: "direct:rest1" - route: diff --git a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreSimpleXml.txt b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreSimpleXml.txt index 2d8d39ad10f..16c59763059 100644 --- a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreSimpleXml.txt +++ b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreSimpleXml.txt @@ -1,8 +1,9 @@ -<?xml version="1.0" encoding="UTF-8"?><rests xmlns="http://camel.apache.org/schema/spring"> +<?xml version="1.0" encoding="UTF-8"?> +<rests> <rest> - <put consumes="application/json,text/xml" produces="application/json,text/xml" path="/pet"> - <param name="body" required="true" type="body"/> - <to uri="direct:rest1"/> - </put> - </rest> -</rests> \ No newline at end of file + <put consumes="application/json,text/xml" path="/pet" produces="application/json,text/xml"> + <param name="body" type="body"/> + <to uri="direct:rest1"/> + </put> + </rest> +</rests> diff --git a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreSimpleYaml.txt b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreSimpleYaml.txt index 7d9e6d2ff21..320ad81ee56 100644 --- a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreSimpleYaml.txt +++ b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreSimpleYaml.txt @@ -5,6 +5,5 @@ produces: "application/json,text/xml" param: - name: "body" - required: true type: "body" to: "direct:rest1" diff --git a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreWithModelYaml.txt b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreWithModelYaml.txt index 11cd406ea43..fa913fc122d 100644 --- a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreWithModelYaml.txt +++ b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreWithModelYaml.txt @@ -8,7 +8,6 @@ param: - description: "Pet object that needs to be added to the store" name: "body" - required: true type: "body" to: "direct:updatePet" - id: "updateUser" @@ -17,14 +16,10 @@ consumes: "*/*" type: "model.User" param: - - dataType: "string" - description: "name that need to be updated" + - description: "name that need to be updated" name: "username" - required: true - type: "path" - description: "Updated user object" name: "body" - required: true type: "body" to: "direct:updateUser" post: @@ -42,7 +37,6 @@ type: "query" - description: "Pet object that needs to be added to the store" name: "body" - required: true type: "body" to: "direct:addPet" - id: "updatePetWithForm" @@ -52,17 +46,11 @@ - dataType: "integer" description: "ID of pet that needs to be updated" name: "petId" - required: true - type: "path" - - dataType: "string" - description: "Updated name of the pet" + - description: "Updated name of the pet" name: "name" - required: true type: "formData" - - dataType: "string" - description: "Updated status of the pet" + - description: "Updated status of the pet" name: "status" - required: true type: "formData" to: "direct:updatePetWithForm" - id: "uploadFile" @@ -74,17 +62,11 @@ - dataType: "integer" description: "ID of pet to update" name: "petId" - required: true - type: "path" - - dataType: "string" - description: "Additional data to pass to server" + - description: "Additional data to pass to server" name: "additionalMetadata" - required: true type: "formData" - - dataType: "string" - description: "file to upload" + - description: "file to upload" name: "file" - required: true type: "formData" to: "direct:uploadFile" - id: "placeOrder" @@ -96,7 +78,6 @@ param: - description: "order placed for purchasing the pet" name: "body" - required: true type: "body" to: "direct:placeOrder" - id: "createUser" @@ -107,7 +88,6 @@ param: - description: "Created user object" name: "body" - required: true type: "body" to: "direct:createUser" - id: "createUsersWithArrayInput" @@ -117,7 +97,6 @@ param: - description: "List of user object" name: "body" - required: true type: "body" to: "direct:createUsersWithArrayInput" - id: "createUsersWithListInput" @@ -127,7 +106,6 @@ param: - description: "List of user object" name: "body" - required: true type: "body" to: "direct:createUsersWithListInput" get: @@ -137,12 +115,10 @@ produces: "application/xml,application/json" outType: "model.Pet[]" param: - - arrayType: "string" - collectionFormat: "multi" + - collectionFormat: "multi" dataType: "array" description: "Status values that need to be considered for filter" name: "status" - required: true type: "query" to: "direct:findPetsByStatus" - id: "findPetsByTags" @@ -152,12 +128,10 @@ produces: "application/xml,application/json" outType: "model.Pet[]" param: - - arrayType: "string" - collectionFormat: "multi" + - collectionFormat: "multi" dataType: "array" description: "Tags to filter by" name: "tags" - required: true type: "query" to: "direct:findPetsByTags" - id: "getPetById" @@ -169,8 +143,6 @@ - dataType: "integer" description: "ID of pet to return" name: "petId" - required: true - type: "path" to: "direct:getPetById" - id: "getInventory" path: "/store/inventory" @@ -187,24 +159,18 @@ - dataType: "integer" description: "ID of pet that needs to be fetched" name: "orderId" - required: true - type: "path" to: "direct:getOrderById" - id: "loginUser" path: "/user/login" produces: "application/xml,application/json" param: - collectionFormat: "multi" - dataType: "string" description: "The user name for login" name: "username" - required: true type: "query" - collectionFormat: "multi" - dataType: "string" description: "The password for login in clear text" name: "password" - required: true type: "query" to: "direct:loginUser" - id: "logoutUser" @@ -215,25 +181,19 @@ produces: "application/xml,application/json" outType: "model.User" param: - - dataType: "string" - description: "The name that needs to be fetched. Use user1 for testing. " + - description: "The name that needs to be fetched. Use user1 for testing. " name: "username" - required: true - type: "path" to: "direct:getUserByName" delete: - id: "deletePet" path: "/pet/{petId}" param: - - dataType: "string" - name: "api_key" + - name: "api_key" required: false type: "header" - dataType: "integer" description: "Pet id to delete" name: "petId" - required: true - type: "path" to: "direct:deletePet" - id: "deleteOrder" path: "/store/order/{orderId}" @@ -243,16 +203,11 @@ - dataType: "integer" description: "ID of the order that needs to be deleted" name: "orderId" - required: true - type: "path" to: "direct:deleteOrder" - id: "deleteUser" path: "/user/{username}" description: "This can only be done by the logged in user." param: - - dataType: "string" - description: "The name that needs to be deleted" + - description: "The name that needs to be deleted" name: "username" - required: true - type: "path" to: "direct:deleteUser" diff --git a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreWithRestComponentXml.txt b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreWithRestComponentXml.txt index 06a0f0225bb..2dc862b6730 100644 --- a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreWithRestComponentXml.txt +++ b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreWithRestComponentXml.txt @@ -1,89 +1,91 @@ -<?xml version="1.0" encoding="UTF-8"?><rests xmlns="http://camel.apache.org/schema/spring"><restConfiguration component="servlet" contextPath="/foo"/> +<?xml version="1.0" encoding="UTF-8"?> +<rests> + <restConfiguration component="servlet" contextPath="/foo"/> <rest path="/api/v3"> <put consumes="application/json,application/xml" id="updatePet" path="/pet"> - <param description="Pet object that needs to be added to the store" name="body" required="true" type="body"/> + <param description="Pet object that needs to be added to the store" name="body" type="body"/> <to uri="direct:updatePet"/> </put> <post consumes="application/json,application/xml" id="addPet" path="/pet"> <param collectionFormat="multi" dataType="boolean" defaultValue="false" description="Verbose data" name="verbose" required="false" type="query"/> - <param description="Pet object that needs to be added to the store" name="body" required="true" type="body"/> + <param description="Pet object that needs to be added to the store" name="body" type="body"/> <to uri="direct:addPet"/> </post> - <get id="findPetsByStatus" description="Multiple status values can be provided with comma separated strings" produces="application/xml,application/json" path="/pet/findByStatus"> - <param arrayType="string" collectionFormat="multi" dataType="array" description="Status values that need to be considered for filter" name="status" required="true" type="query"/> + <get description="Multiple status values can be provided with comma separated strings" id="findPetsByStatus" path="/pet/findByStatus" produces="application/xml,application/json"> + <param collectionFormat="multi" dataType="array" description="Status values that need to be considered for filter" name="status" type="query"/> <to uri="direct:findPetsByStatus"/> </get> - <get id="findPetsByTags" description="Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing." produces="application/xml,application/json" path="/pet/findByTags"> - <param arrayType="string" collectionFormat="multi" dataType="array" description="Tags to filter by" name="tags" required="true" type="query"/> + <get description="Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing." id="findPetsByTags" path="/pet/findByTags" produces="application/xml,application/json"> + <param collectionFormat="multi" dataType="array" description="Tags to filter by" name="tags" type="query"/> <to uri="direct:findPetsByTags"/> </get> - <get id="getPetById" description="Returns a single pet" produces="application/xml,application/json" path="/pet/{petId}"> - <param dataType="integer" description="ID of pet to return" name="petId" required="true" type="path"/> + <get description="Returns a single pet" id="getPetById" path="/pet/{petId}" produces="application/xml,application/json"> + <param dataType="integer" description="ID of pet to return" name="petId"/> <to uri="direct:getPetById"/> </get> <post consumes="application/x-www-form-urlencoded" id="updatePetWithForm" path="/pet/{petId}"> - <param dataType="integer" description="ID of pet that needs to be updated" name="petId" required="true" type="path"/> - <param dataType="string" description="Updated name of the pet" name="name" required="true" type="formData"/> - <param dataType="string" description="Updated status of the pet" name="status" required="true" type="formData"/> + <param dataType="integer" description="ID of pet that needs to be updated" name="petId"/> + <param description="Updated name of the pet" name="name" type="formData"/> + <param description="Updated status of the pet" name="status" type="formData"/> <to uri="direct:updatePetWithForm"/> </post> <delete id="deletePet" path="/pet/{petId}"> - <param dataType="string" name="api_key" required="false" type="header"/> - <param dataType="integer" description="Pet id to delete" name="petId" required="true" type="path"/> + <param name="api_key" required="false" type="header"/> + <param dataType="integer" description="Pet id to delete" name="petId"/> <to uri="direct:deletePet"/> </delete> - <post consumes="multipart/form-data" id="uploadFile" produces="application/json" path="/pet/{petId}/uploadImage"> - <param dataType="integer" description="ID of pet to update" name="petId" required="true" type="path"/> - <param dataType="string" description="Additional data to pass to server" name="additionalMetadata" required="true" type="formData"/> - <param dataType="string" description="file to upload" name="file" required="true" type="formData"/> + <post consumes="multipart/form-data" id="uploadFile" path="/pet/{petId}/uploadImage" produces="application/json"> + <param dataType="integer" description="ID of pet to update" name="petId"/> + <param description="Additional data to pass to server" name="additionalMetadata" type="formData"/> + <param description="file to upload" name="file" type="formData"/> <to uri="direct:uploadFile"/> </post> - <get id="getInventory" description="Returns a map of status codes to quantities" produces="application/json" path="/store/inventory"> + <get description="Returns a map of status codes to quantities" id="getInventory" path="/store/inventory" produces="application/json"> <to uri="direct:getInventory"/> </get> - <post consumes="*/*" id="placeOrder" produces="application/xml,application/json" path="/store/order"> - <param description="order placed for purchasing the pet" name="body" required="true" type="body"/> + <post consumes="*/*" id="placeOrder" path="/store/order" produces="application/xml,application/json"> + <param description="order placed for purchasing the pet" name="body" type="body"/> <to uri="direct:placeOrder"/> </post> - <get id="getOrderById" description="For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions" produces="application/xml,application/json" path="/store/order/{orderId}"> - <param dataType="integer" description="ID of pet that needs to be fetched" name="orderId" required="true" type="path"/> + <get description="For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions" id="getOrderById" path="/store/order/{orderId}" produces="application/xml,application/json"> + <param dataType="integer" description="ID of pet that needs to be fetched" name="orderId"/> <to uri="direct:getOrderById"/> </get> - <delete id="deleteOrder" description="For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors" path="/store/order/{orderId}"> - <param dataType="integer" description="ID of the order that needs to be deleted" name="orderId" required="true" type="path"/> + <delete description="For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors" id="deleteOrder" path="/store/order/{orderId}"> + <param dataType="integer" description="ID of the order that needs to be deleted" name="orderId"/> <to uri="direct:deleteOrder"/> </delete> - <post consumes="*/*" id="createUser" description="This can only be done by the logged in user." path="/user"> - <param description="Created user object" name="body" required="true" type="body"/> + <post consumes="*/*" description="This can only be done by the logged in user." id="createUser" path="/user"> + <param description="Created user object" name="body" type="body"/> <to uri="direct:createUser"/> </post> <post consumes="*/*" id="createUsersWithArrayInput" path="/user/createWithArray"> - <param description="List of user object" name="body" required="true" type="body"/> + <param description="List of user object" name="body" type="body"/> <to uri="direct:createUsersWithArrayInput"/> </post> <post consumes="*/*" id="createUsersWithListInput" path="/user/createWithList"> - <param description="List of user object" name="body" required="true" type="body"/> + <param description="List of user object" name="body" type="body"/> <to uri="direct:createUsersWithListInput"/> </post> - <get id="loginUser" produces="application/xml,application/json" path="/user/login"> - <param collectionFormat="multi" dataType="string" description="The user name for login" name="username" required="true" type="query"/> - <param collectionFormat="multi" dataType="string" description="The password for login in clear text" name="password" required="true" type="query"/> + <get id="loginUser" path="/user/login" produces="application/xml,application/json"> + <param collectionFormat="multi" description="The user name for login" name="username" type="query"/> + <param collectionFormat="multi" description="The password for login in clear text" name="password" type="query"/> <to uri="direct:loginUser"/> </get> <get id="logoutUser" path="/user/logout"> <to uri="direct:logoutUser"/> </get> - <get id="getUserByName" produces="application/xml,application/json" path="/user/{username}"> - <param dataType="string" description="The name that needs to be fetched. Use user1 for testing. " name="username" required="true" type="path"/> + <get id="getUserByName" path="/user/{username}" produces="application/xml,application/json"> + <param description="The name that needs to be fetched. Use user1 for testing. " name="username"/> <to uri="direct:getUserByName"/> </get> - <put consumes="*/*" id="updateUser" description="This can only be done by the logged in user." path="/user/{username}"> - <param dataType="string" description="name that need to be updated" name="username" required="true" type="path"/> - <param description="Updated user object" name="body" required="true" type="body"/> + <put consumes="*/*" description="This can only be done by the logged in user." id="updateUser" path="/user/{username}"> + <param description="name that need to be updated" name="username"/> + <param description="Updated user object" name="body" type="body"/> <to uri="direct:updateUser"/> </put> - <delete id="deleteUser" description="This can only be done by the logged in user." path="/user/{username}"> - <param dataType="string" description="The name that needs to be deleted" name="username" required="true" type="path"/> + <delete description="This can only be done by the logged in user." id="deleteUser" path="/user/{username}"> + <param description="The name that needs to be deleted" name="username"/> <to uri="direct:deleteUser"/> </delete> </rest> diff --git a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreWithRestComponentYaml.txt b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreWithRestComponentYaml.txt index a947da1521b..eca804bccec 100644 --- a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreWithRestComponentYaml.txt +++ b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreWithRestComponentYaml.txt @@ -10,7 +10,6 @@ param: - description: "Pet object that needs to be added to the store" name: "body" - required: true type: "body" to: "direct:updatePet" - id: "updateUser" @@ -18,14 +17,10 @@ description: "This can only be done by the logged in user." consumes: "*/*" param: - - dataType: "string" - description: "name that need to be updated" + - description: "name that need to be updated" name: "username" - required: true - type: "path" - description: "Updated user object" name: "body" - required: true type: "body" to: "direct:updateUser" post: @@ -42,7 +37,6 @@ type: "query" - description: "Pet object that needs to be added to the store" name: "body" - required: true type: "body" to: "direct:addPet" - id: "updatePetWithForm" @@ -52,17 +46,11 @@ - dataType: "integer" description: "ID of pet that needs to be updated" name: "petId" - required: true - type: "path" - - dataType: "string" - description: "Updated name of the pet" + - description: "Updated name of the pet" name: "name" - required: true type: "formData" - - dataType: "string" - description: "Updated status of the pet" + - description: "Updated status of the pet" name: "status" - required: true type: "formData" to: "direct:updatePetWithForm" - id: "uploadFile" @@ -73,17 +61,11 @@ - dataType: "integer" description: "ID of pet to update" name: "petId" - required: true - type: "path" - - dataType: "string" - description: "Additional data to pass to server" + - description: "Additional data to pass to server" name: "additionalMetadata" - required: true type: "formData" - - dataType: "string" - description: "file to upload" + - description: "file to upload" name: "file" - required: true type: "formData" to: "direct:uploadFile" - id: "placeOrder" @@ -93,7 +75,6 @@ param: - description: "order placed for purchasing the pet" name: "body" - required: true type: "body" to: "direct:placeOrder" - id: "createUser" @@ -103,7 +84,6 @@ param: - description: "Created user object" name: "body" - required: true type: "body" to: "direct:createUser" - id: "createUsersWithArrayInput" @@ -112,7 +92,6 @@ param: - description: "List of user object" name: "body" - required: true type: "body" to: "direct:createUsersWithArrayInput" - id: "createUsersWithListInput" @@ -121,7 +100,6 @@ param: - description: "List of user object" name: "body" - required: true type: "body" to: "direct:createUsersWithListInput" get: @@ -130,12 +108,10 @@ description: "Multiple status values can be provided with comma separated strings" produces: "application/xml,application/json" param: - - arrayType: "string" - collectionFormat: "multi" + - collectionFormat: "multi" dataType: "array" description: "Status values that need to be considered for filter" name: "status" - required: true type: "query" to: "direct:findPetsByStatus" - id: "findPetsByTags" @@ -144,12 +120,10 @@ \ tag1, tag2, tag3 for testing." produces: "application/xml,application/json" param: - - arrayType: "string" - collectionFormat: "multi" + - collectionFormat: "multi" dataType: "array" description: "Tags to filter by" name: "tags" - required: true type: "query" to: "direct:findPetsByTags" - id: "getPetById" @@ -160,8 +134,6 @@ - dataType: "integer" description: "ID of pet to return" name: "petId" - required: true - type: "path" to: "direct:getPetById" - id: "getInventory" path: "/store/inventory" @@ -177,24 +149,18 @@ - dataType: "integer" description: "ID of pet that needs to be fetched" name: "orderId" - required: true - type: "path" to: "direct:getOrderById" - id: "loginUser" path: "/user/login" produces: "application/xml,application/json" param: - collectionFormat: "multi" - dataType: "string" description: "The user name for login" name: "username" - required: true type: "query" - collectionFormat: "multi" - dataType: "string" description: "The password for login in clear text" name: "password" - required: true type: "query" to: "direct:loginUser" - id: "logoutUser" @@ -204,25 +170,19 @@ path: "/user/{username}" produces: "application/xml,application/json" param: - - dataType: "string" - description: "The name that needs to be fetched. Use user1 for testing. " + - description: "The name that needs to be fetched. Use user1 for testing. " name: "username" - required: true - type: "path" to: "direct:getUserByName" delete: - id: "deletePet" path: "/pet/{petId}" param: - - dataType: "string" - name: "api_key" + - name: "api_key" required: false type: "header" - dataType: "integer" description: "Pet id to delete" name: "petId" - required: true - type: "path" to: "direct:deletePet" - id: "deleteOrder" path: "/store/order/{orderId}" @@ -232,16 +192,11 @@ - dataType: "integer" description: "ID of the order that needs to be deleted" name: "orderId" - required: true - type: "path" to: "direct:deleteOrder" - id: "deleteUser" path: "/user/{username}" description: "This can only be done by the logged in user." param: - - dataType: "string" - description: "The name that needs to be deleted" + - description: "The name that needs to be deleted" name: "username" - required: true - type: "path" to: "direct:deleteUser" diff --git a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreXml.txt b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreXml.txt index f4016f3d427..7618f7f4f88 100644 --- a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreXml.txt +++ b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreXml.txt @@ -1,89 +1,89 @@ -<?xml version="1.0" encoding="UTF-8"?><rests xmlns="http://camel.apache.org/schema/spring"> +<?xml version="1.0" encoding="UTF-8"?><rests> <rest path="/api/v3"> <put consumes="application/json,application/xml" id="updatePet" path="/pet"> - <param description="Pet object that needs to be added to the store" name="body" required="true" type="body"/> + <param description="Pet object that needs to be added to the store" name="body" type="body"/> <to uri="direct:updatePet"/> </put> <post consumes="application/json,application/xml" id="addPet" path="/pet"> <param collectionFormat="multi" dataType="boolean" defaultValue="false" description="Verbose data" name="verbose" required="false" type="query"/> - <param description="Pet object that needs to be added to the store" name="body" required="true" type="body"/> + <param description="Pet object that needs to be added to the store" name="body" type="body"/> <to uri="direct:addPet"/> </post> - <get id="findPetsByStatus" description="Multiple status values can be provided with comma separated strings" produces="application/xml,application/json" path="/pet/findByStatus"> - <param arrayType="string" collectionFormat="multi" dataType="array" description="Status values that need to be considered for filter" name="status" required="true" type="query"/> + <get description="Multiple status values can be provided with comma separated strings" id="findPetsByStatus" path="/pet/findByStatus" produces="application/xml,application/json"> + <param collectionFormat="multi" dataType="array" description="Status values that need to be considered for filter" name="status" type="query"/> <to uri="direct:findPetsByStatus"/> </get> - <get id="findPetsByTags" description="Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing." produces="application/xml,application/json" path="/pet/findByTags"> - <param arrayType="string" collectionFormat="multi" dataType="array" description="Tags to filter by" name="tags" required="true" type="query"/> + <get description="Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing." id="findPetsByTags" path="/pet/findByTags" produces="application/xml,application/json"> + <param collectionFormat="multi" dataType="array" description="Tags to filter by" name="tags" type="query"/> <to uri="direct:findPetsByTags"/> </get> - <get id="getPetById" description="Returns a single pet" produces="application/xml,application/json" path="/pet/{petId}"> - <param dataType="integer" description="ID of pet to return" name="petId" required="true" type="path"/> + <get description="Returns a single pet" id="getPetById" path="/pet/{petId}" produces="application/xml,application/json"> + <param dataType="integer" description="ID of pet to return" name="petId"/> <to uri="direct:getPetById"/> </get> <post consumes="application/x-www-form-urlencoded" id="updatePetWithForm" path="/pet/{petId}"> - <param dataType="integer" description="ID of pet that needs to be updated" name="petId" required="true" type="path"/> - <param dataType="string" description="Updated name of the pet" name="name" required="true" type="formData"/> - <param dataType="string" description="Updated status of the pet" name="status" required="true" type="formData"/> + <param dataType="integer" description="ID of pet that needs to be updated" name="petId"/> + <param description="Updated name of the pet" name="name" type="formData"/> + <param description="Updated status of the pet" name="status" type="formData"/> <to uri="direct:updatePetWithForm"/> </post> <delete id="deletePet" path="/pet/{petId}"> - <param dataType="string" name="api_key" required="false" type="header"/> - <param dataType="integer" description="Pet id to delete" name="petId" required="true" type="path"/> + <param name="api_key" required="false" type="header"/> + <param dataType="integer" description="Pet id to delete" name="petId"/> <to uri="direct:deletePet"/> </delete> - <post consumes="multipart/form-data" id="uploadFile" produces="application/json" path="/pet/{petId}/uploadImage"> - <param dataType="integer" description="ID of pet to update" name="petId" required="true" type="path"/> - <param dataType="string" description="Additional data to pass to server" name="additionalMetadata" required="true" type="formData"/> - <param dataType="string" description="file to upload" name="file" required="true" type="formData"/> + <post consumes="multipart/form-data" id="uploadFile" path="/pet/{petId}/uploadImage" produces="application/json"> + <param dataType="integer" description="ID of pet to update" name="petId"/> + <param description="Additional data to pass to server" name="additionalMetadata" type="formData"/> + <param description="file to upload" name="file" type="formData"/> <to uri="direct:uploadFile"/> </post> - <get id="getInventory" description="Returns a map of status codes to quantities" produces="application/json" path="/store/inventory"> + <get description="Returns a map of status codes to quantities" id="getInventory" path="/store/inventory" produces="application/json"> <to uri="direct:getInventory"/> </get> - <post consumes="*/*" id="placeOrder" produces="application/xml,application/json" path="/store/order"> - <param description="order placed for purchasing the pet" name="body" required="true" type="body"/> + <post consumes="*/*" id="placeOrder" path="/store/order" produces="application/xml,application/json"> + <param description="order placed for purchasing the pet" name="body" type="body"/> <to uri="direct:placeOrder"/> </post> - <get id="getOrderById" description="For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions" produces="application/xml,application/json" path="/store/order/{orderId}"> - <param dataType="integer" description="ID of pet that needs to be fetched" name="orderId" required="true" type="path"/> + <get description="For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions" id="getOrderById" path="/store/order/{orderId}" produces="application/xml,application/json"> + <param dataType="integer" description="ID of pet that needs to be fetched" name="orderId"/> <to uri="direct:getOrderById"/> </get> - <delete id="deleteOrder" description="For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors" path="/store/order/{orderId}"> - <param dataType="integer" description="ID of the order that needs to be deleted" name="orderId" required="true" type="path"/> + <delete description="For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors" id="deleteOrder" path="/store/order/{orderId}"> + <param dataType="integer" description="ID of the order that needs to be deleted" name="orderId"/> <to uri="direct:deleteOrder"/> </delete> - <post consumes="*/*" id="createUser" description="This can only be done by the logged in user." path="/user"> - <param description="Created user object" name="body" required="true" type="body"/> + <post consumes="*/*" description="This can only be done by the logged in user." id="createUser" path="/user"> + <param description="Created user object" name="body" type="body"/> <to uri="direct:createUser"/> </post> <post consumes="*/*" id="createUsersWithArrayInput" path="/user/createWithArray"> - <param description="List of user object" name="body" required="true" type="body"/> + <param description="List of user object" name="body" type="body"/> <to uri="direct:createUsersWithArrayInput"/> </post> <post consumes="*/*" id="createUsersWithListInput" path="/user/createWithList"> - <param description="List of user object" name="body" required="true" type="body"/> + <param description="List of user object" name="body" type="body"/> <to uri="direct:createUsersWithListInput"/> </post> - <get id="loginUser" produces="application/xml,application/json" path="/user/login"> - <param collectionFormat="multi" dataType="string" description="The user name for login" name="username" required="true" type="query"/> - <param collectionFormat="multi" dataType="string" description="The password for login in clear text" name="password" required="true" type="query"/> + <get id="loginUser" path="/user/login" produces="application/xml,application/json"> + <param collectionFormat="multi" description="The user name for login" name="username" type="query"/> + <param collectionFormat="multi" description="The password for login in clear text" name="password" type="query"/> <to uri="direct:loginUser"/> </get> <get id="logoutUser" path="/user/logout"> <to uri="direct:logoutUser"/> </get> - <get id="getUserByName" produces="application/xml,application/json" path="/user/{username}"> - <param dataType="string" description="The name that needs to be fetched. Use user1 for testing. " name="username" required="true" type="path"/> + <get id="getUserByName" path="/user/{username}" produces="application/xml,application/json"> + <param description="The name that needs to be fetched. Use user1 for testing. " name="username"/> <to uri="direct:getUserByName"/> </get> - <put consumes="*/*" id="updateUser" description="This can only be done by the logged in user." path="/user/{username}"> - <param dataType="string" description="name that need to be updated" name="username" required="true" type="path"/> - <param description="Updated user object" name="body" required="true" type="body"/> + <put consumes="*/*" description="This can only be done by the logged in user." id="updateUser" path="/user/{username}"> + <param description="name that need to be updated" name="username"/> + <param description="Updated user object" name="body" type="body"/> <to uri="direct:updateUser"/> </put> - <delete id="deleteUser" description="This can only be done by the logged in user." path="/user/{username}"> - <param dataType="string" description="The name that needs to be deleted" name="username" required="true" type="path"/> + <delete description="This can only be done by the logged in user." id="deleteUser" path="/user/{username}"> + <param description="The name that needs to be deleted" name="username"/> <to uri="direct:deleteUser"/> </delete> </rest> diff --git a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreYaml.txt b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreYaml.txt index 4063d84205e..1e81ee04431 100644 --- a/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreYaml.txt +++ b/tooling/openapi-rest-dsl-generator/src/test/resources/OpenApiV3PetstoreYaml.txt @@ -7,7 +7,6 @@ param: - description: "Pet object that needs to be added to the store" name: "body" - required: true type: "body" to: "direct:updatePet" - id: "updateUser" @@ -15,14 +14,10 @@ description: "This can only be done by the logged in user." consumes: "*/*" param: - - dataType: "string" - description: "name that need to be updated" + - description: "name that need to be updated" name: "username" - required: true - type: "path" - description: "Updated user object" name: "body" - required: true type: "body" to: "direct:updateUser" post: @@ -39,7 +34,6 @@ type: "query" - description: "Pet object that needs to be added to the store" name: "body" - required: true type: "body" to: "direct:addPet" - id: "updatePetWithForm" @@ -49,17 +43,11 @@ - dataType: "integer" description: "ID of pet that needs to be updated" name: "petId" - required: true - type: "path" - - dataType: "string" - description: "Updated name of the pet" + - description: "Updated name of the pet" name: "name" - required: true type: "formData" - - dataType: "string" - description: "Updated status of the pet" + - description: "Updated status of the pet" name: "status" - required: true type: "formData" to: "direct:updatePetWithForm" - id: "uploadFile" @@ -70,17 +58,11 @@ - dataType: "integer" description: "ID of pet to update" name: "petId" - required: true - type: "path" - - dataType: "string" - description: "Additional data to pass to server" + - description: "Additional data to pass to server" name: "additionalMetadata" - required: true type: "formData" - - dataType: "string" - description: "file to upload" + - description: "file to upload" name: "file" - required: true type: "formData" to: "direct:uploadFile" - id: "placeOrder" @@ -90,7 +72,6 @@ param: - description: "order placed for purchasing the pet" name: "body" - required: true type: "body" to: "direct:placeOrder" - id: "createUser" @@ -100,7 +81,6 @@ param: - description: "Created user object" name: "body" - required: true type: "body" to: "direct:createUser" - id: "createUsersWithArrayInput" @@ -109,7 +89,6 @@ param: - description: "List of user object" name: "body" - required: true type: "body" to: "direct:createUsersWithArrayInput" - id: "createUsersWithListInput" @@ -118,7 +97,6 @@ param: - description: "List of user object" name: "body" - required: true type: "body" to: "direct:createUsersWithListInput" get: @@ -127,12 +105,10 @@ description: "Multiple status values can be provided with comma separated strings" produces: "application/xml,application/json" param: - - arrayType: "string" - collectionFormat: "multi" + - collectionFormat: "multi" dataType: "array" description: "Status values that need to be considered for filter" name: "status" - required: true type: "query" to: "direct:findPetsByStatus" - id: "findPetsByTags" @@ -141,12 +117,10 @@ \ tag1, tag2, tag3 for testing." produces: "application/xml,application/json" param: - - arrayType: "string" - collectionFormat: "multi" + - collectionFormat: "multi" dataType: "array" description: "Tags to filter by" name: "tags" - required: true type: "query" to: "direct:findPetsByTags" - id: "getPetById" @@ -157,8 +131,6 @@ - dataType: "integer" description: "ID of pet to return" name: "petId" - required: true - type: "path" to: "direct:getPetById" - id: "getInventory" path: "/store/inventory" @@ -174,24 +146,18 @@ - dataType: "integer" description: "ID of pet that needs to be fetched" name: "orderId" - required: true - type: "path" to: "direct:getOrderById" - id: "loginUser" path: "/user/login" produces: "application/xml,application/json" param: - collectionFormat: "multi" - dataType: "string" description: "The user name for login" name: "username" - required: true type: "query" - collectionFormat: "multi" - dataType: "string" description: "The password for login in clear text" name: "password" - required: true type: "query" to: "direct:loginUser" - id: "logoutUser" @@ -201,25 +167,19 @@ path: "/user/{username}" produces: "application/xml,application/json" param: - - dataType: "string" - description: "The name that needs to be fetched. Use user1 for testing. " + - description: "The name that needs to be fetched. Use user1 for testing. " name: "username" - required: true - type: "path" to: "direct:getUserByName" delete: - id: "deletePet" path: "/pet/{petId}" param: - - dataType: "string" - name: "api_key" + - name: "api_key" required: false type: "header" - dataType: "integer" description: "Pet id to delete" name: "petId" - required: true - type: "path" to: "direct:deletePet" - id: "deleteOrder" path: "/store/order/{orderId}" @@ -229,16 +189,11 @@ - dataType: "integer" description: "ID of the order that needs to be deleted" name: "orderId" - required: true - type: "path" to: "direct:deleteOrder" - id: "deleteUser" path: "/user/{username}" description: "This can only be done by the logged in user." param: - - dataType: "string" - description: "The name that needs to be deleted" + - description: "The name that needs to be deleted" name: "username" - required: true - type: "path" to: "direct:deleteUser"