From f0054e0276f238cc15bfbcdbc36cc7d0f4f6bbcd Mon Sep 17 00:00:00 2001 From: Ralf Handl Date: Fri, 18 Oct 2024 17:21:19 +0200 Subject: [PATCH] XSLT, OData V2: no direct create for non-addressable entity sets (#312) * New test case * Update addressable-v2.xml * No direct create for non-addressable entity sets * No root paths for non-addressable entity sets * PATCH and DELETE for addressable=false * Remove undocumented V2 annotation It doesn't work, and it is not documented --- tools/V2-to-V4-CSDL.xsl | 24 +- tools/tests/addressable-v2.openapi3.json | 760 +++++++++++++++++++++++ tools/tests/addressable-v2.swagger.json | 700 +++++++++++++++++++++ tools/tests/addressable-v2.xml | 112 ++++ 4 files changed, 1590 insertions(+), 6 deletions(-) create mode 100644 tools/tests/addressable-v2.openapi3.json create mode 100644 tools/tests/addressable-v2.swagger.json create mode 100644 tools/tests/addressable-v2.xml diff --git a/tools/V2-to-V4-CSDL.xsl b/tools/V2-to-V4-CSDL.xsl index 3dc61f19..040c2a9a 100644 --- a/tools/V2-to-V4-CSDL.xsl +++ b/tools/V2-to-V4-CSDL.xsl @@ -466,6 +466,15 @@ + + + + + true + + + + @@ -1032,6 +1041,15 @@ + + + + .InsertRestrictions + + + + + @@ -1192,12 +1210,6 @@ - - - - - - diff --git a/tools/tests/addressable-v2.openapi3.json b/tools/tests/addressable-v2.openapi3.json new file mode 100644 index 00000000..82cbee47 --- /dev/null +++ b/tools/tests/addressable-v2.openapi3.json @@ -0,0 +1,760 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Service for namespace ZE_API_DEMO_SRV", + "version": "", + "description": "This service is located at [https://localhost/service-root/](https://localhost/service-root/)\n\n## Entity Data Model\n![ER Diagram](https://yuml.me/diagram/class/[Head{bg:orange}],[Head]-*>[Address{bg:orange}],[Address{bg:orange}],[HeadSet{bg:dodgerblue}]++-*>[Head],[AddressSet{bg:dodgerblue}]++-*>[Address])\n\n### Legend\n![Legend](https://yuml.me/diagram/plain;dir:TB;scale:60/class/[External.Type{bg:whitesmoke}],[ComplexType],[EntityType{bg:orange}],[EntitySet/Singleton/Operation{bg:dodgerblue}])" + }, + "servers": [ + { + "url": "https://localhost/service-root" + } + ], + "tags": [ + { + "name": "HeadSet" + }, + { + "name": "AddressSet" + } + ], + "paths": { + "/HeadSet": { + "get": { + "summary": "Get entities from HeadSet", + "tags": [ + "HeadSet" + ], + "parameters": [ + { + "name": "$filter", + "in": "query", + "description": "Filter items by property values, see [Filtering](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=64)", + "schema": { + "type": "string" + } + }, + { + "$ref": "#/components/parameters/count" + }, + { + "name": "$select", + "in": "query", + "description": "Select properties to be returned, see [Select](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=68)", + "explode": false, + "schema": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ + "BusinessPartner", + "Type", + "Grouping", + "Title", + "FirstName", + "LastName", + "IsBlocked", + "ETag", + "to_Address" + ] + } + } + }, + { + "name": "$expand", + "in": "query", + "description": "Expand related entities, see [Expand](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=63)", + "explode": false, + "schema": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ + "to_Address" + ] + } + } + } + ], + "responses": { + "200": { + "description": "Retrieved entities", + "content": { + "application/json": { + "schema": { + "title": "Wrapper", + "type": "object", + "properties": { + "d": { + "title": "Collection of Head", + "type": "object", + "properties": { + "__count": { + "$ref": "#/components/schemas/count" + }, + "results": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ZE_API_DEMO_SRV.Head" + } + } + } + } + } + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/error" + } + } + }, + "post": { + "summary": "Add new entity to HeadSet", + "tags": [ + "HeadSet" + ], + "requestBody": { + "required": true, + "description": "New entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ZE_API_DEMO_SRV.Head-create" + } + } + } + }, + "responses": { + "201": { + "description": "Created entity", + "content": { + "application/json": { + "schema": { + "title": "Head", + "type": "object", + "properties": { + "d": { + "$ref": "#/components/schemas/ZE_API_DEMO_SRV.Head" + } + } + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/error" + } + } + } + }, + "/HeadSet('{BusinessPartner}')": { + "parameters": [ + { + "name": "BusinessPartner", + "in": "path", + "required": true, + "description": "Geschäftspartnernummer", + "schema": { + "type": "string", + "maxLength": 10 + } + } + ], + "get": { + "summary": "Get entity from HeadSet by key", + "tags": [ + "HeadSet" + ], + "parameters": [ + { + "name": "$select", + "in": "query", + "description": "Select properties to be returned, see [Select](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=68)", + "explode": false, + "schema": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ + "BusinessPartner", + "Type", + "Grouping", + "Title", + "FirstName", + "LastName", + "IsBlocked", + "ETag", + "to_Address" + ] + } + } + }, + { + "name": "$expand", + "in": "query", + "description": "Expand related entities, see [Expand](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=63)", + "explode": false, + "schema": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ + "to_Address" + ] + } + } + } + ], + "responses": { + "200": { + "description": "Retrieved entity", + "content": { + "application/json": { + "schema": { + "title": "Head", + "type": "object", + "properties": { + "d": { + "$ref": "#/components/schemas/ZE_API_DEMO_SRV.Head" + } + } + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/error" + } + } + } + }, + "/HeadSet('{BusinessPartner}')/to_Address": { + "parameters": [ + { + "name": "BusinessPartner", + "in": "path", + "required": true, + "description": "Geschäftspartnernummer", + "schema": { + "type": "string", + "maxLength": 10 + } + } + ], + "get": { + "summary": "Get entities from related to_Address", + "tags": [ + "HeadSet", + "AddressSet" + ], + "parameters": [ + { + "name": "$filter", + "in": "query", + "description": "Filter items by property values, see [Filtering](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=64)", + "schema": { + "type": "string" + } + }, + { + "$ref": "#/components/parameters/count" + }, + { + "name": "$select", + "in": "query", + "description": "Select properties to be returned, see [Select](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=68)", + "explode": false, + "schema": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ + "BusinessPartner", + "AddressId", + "District", + "Street", + "HouseNumber", + "PostalCode", + "City", + "Country", + "ETag" + ] + } + } + } + ], + "responses": { + "200": { + "description": "Retrieved entities", + "content": { + "application/json": { + "schema": { + "title": "Wrapper", + "type": "object", + "properties": { + "d": { + "title": "Collection of Address", + "type": "object", + "properties": { + "__count": { + "$ref": "#/components/schemas/count" + }, + "results": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ZE_API_DEMO_SRV.Address" + } + } + } + } + } + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/error" + } + } + }, + "post": { + "summary": "Add new entity to related to_Address", + "tags": [ + "HeadSet", + "AddressSet" + ], + "requestBody": { + "required": true, + "description": "New entity", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ZE_API_DEMO_SRV.Address-create" + } + } + } + }, + "responses": { + "201": { + "description": "Created entity", + "content": { + "application/json": { + "schema": { + "title": "Address", + "type": "object", + "properties": { + "d": { + "$ref": "#/components/schemas/ZE_API_DEMO_SRV.Address" + } + } + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/error" + } + } + } + }, + "/AddressSet(BusinessPartner='{BusinessPartner}',AddressId='{AddressId}')": { + "parameters": [ + { + "name": "BusinessPartner", + "in": "path", + "required": true, + "description": "Geschäftspartnernummer", + "schema": { + "type": "string", + "maxLength": 10 + } + }, + { + "name": "AddressId", + "in": "path", + "required": true, + "description": "Adressnummer", + "schema": { + "type": "string", + "maxLength": 10 + } + } + ], + "patch": { + "summary": "Update entity in AddressSet", + "tags": [ + "AddressSet" + ], + "requestBody": { + "required": true, + "description": "New property values", + "content": { + "application/json": { + "schema": { + "title": "Modified Address", + "type": "object", + "properties": { + "d": { + "$ref": "#/components/schemas/ZE_API_DEMO_SRV.Address-update" + } + } + } + } + } + }, + "responses": { + "204": { + "description": "Success" + }, + "4XX": { + "$ref": "#/components/responses/error" + } + } + }, + "delete": { + "summary": "Delete entity from AddressSet", + "tags": [ + "AddressSet" + ], + "responses": { + "204": { + "description": "Success" + }, + "4XX": { + "$ref": "#/components/responses/error" + } + } + } + }, + "/$batch": { + "post": { + "summary": "Send a group of requests", + "description": "Group multiple requests into a single request payload, see [Batch Requests](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=152).\n\n*Please note that \"Try it out\" is not supported for this request.*", + "tags": [ + "Batch Requests" + ], + "requestBody": { + "required": true, + "description": "Batch request", + "content": { + "multipart/mixed;boundary=request-separator": { + "schema": { + "type": "string" + }, + "example": "--request-separator\nContent-Type: application/http\nContent-Transfer-Encoding: binary\n\nGET HeadSet HTTP/1.1\nAccept: application/json\n\n\n--request-separator--" + } + } + }, + "responses": { + "202": { + "description": "Batch response", + "content": { + "multipart/mixed": { + "schema": { + "type": "string" + }, + "example": "--response-separator\nContent-Type: application/http\n\nHTTP/1.1 200 OK\nContent-Type: application/json\n\n{...}\n--response-separator--" + } + } + }, + "4XX": { + "$ref": "#/components/responses/error" + } + } + } + } + }, + "components": { + "schemas": { + "ZE_API_DEMO_SRV.Head": { + "type": "object", + "properties": { + "BusinessPartner": { + "type": "string", + "maxLength": 10, + "title": "GeschPartner", + "description": "Geschäftspartnernummer" + }, + "Type": { + "type": "string", + "maxLength": 4, + "title": "Partnerart", + "description": "Geschäftspartnerart" + }, + "Grouping": { + "type": "string", + "maxLength": 4, + "title": "Gruppierung", + "description": "Geschäftspartnergruppierung" + }, + "Title": { + "type": "string", + "maxLength": 4, + "title": "Anrede", + "description": "Anredeschlüssel" + }, + "FirstName": { + "type": "string", + "maxLength": 40, + "title": "Vorname", + "description": "Vorname des Geschäftspartners (Person)" + }, + "LastName": { + "type": "string", + "maxLength": 40, + "title": "Nachname", + "description": "Nachname des Geschäftspartners (Person)" + }, + "IsBlocked": { + "type": "boolean", + "title": "Zentrale Sperre", + "description": "Zentrale Sperre für den Geschäftspartner" + }, + "ETag": { + "type": "string", + "maxLength": 40, + "title": "Hash-Wert", + "description": "Hash-Wert (160 Bits)" + }, + "to_Address": { + "type": "object", + "properties": { + "results": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ZE_API_DEMO_SRV.Address" + } + } + } + } + }, + "title": "Head" + }, + "ZE_API_DEMO_SRV.Head-create": { + "type": "object", + "properties": { + "Title": { + "type": "string", + "maxLength": 4, + "title": "Anrede", + "description": "Anredeschlüssel" + }, + "FirstName": { + "type": "string", + "maxLength": 40, + "title": "Vorname", + "description": "Vorname des Geschäftspartners (Person)" + }, + "LastName": { + "type": "string", + "maxLength": 40, + "title": "Nachname", + "description": "Nachname des Geschäftspartners (Person)" + }, + "to_Address": { + "type": "object", + "properties": { + "results": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ZE_API_DEMO_SRV.Address-create" + } + } + } + } + }, + "title": "Head (for create)" + }, + "ZE_API_DEMO_SRV.Head-update": { + "type": "object", + "title": "Head (for update)" + }, + "ZE_API_DEMO_SRV.Address": { + "type": "object", + "properties": { + "BusinessPartner": { + "type": "string", + "maxLength": 10, + "title": "GeschPartner", + "description": "Geschäftspartnernummer" + }, + "AddressId": { + "type": "string", + "maxLength": 10, + "title": "Adressnummer" + }, + "District": { + "type": "string", + "maxLength": 40, + "title": "Ortsteil" + }, + "Street": { + "type": "string", + "maxLength": 60, + "title": "Straße" + }, + "HouseNumber": { + "type": "string", + "maxLength": 10, + "title": "Hausnummer" + }, + "PostalCode": { + "type": "string", + "maxLength": 10, + "title": "Postleitzahl", + "description": "Postleitzahl des Orts" + }, + "City": { + "type": "string", + "maxLength": 40, + "title": "Ort" + }, + "Country": { + "type": "string", + "maxLength": 2, + "title": "ISO-Code", + "description": "ISO-Code des Landes" + }, + "ETag": { + "type": "string", + "maxLength": 40, + "title": "Hash-Wert", + "description": "Hash-Wert (160 Bits)" + } + }, + "title": "Address" + }, + "ZE_API_DEMO_SRV.Address-create": { + "type": "object", + "properties": { + "District": { + "type": "string", + "maxLength": 40, + "title": "Ortsteil" + }, + "Street": { + "type": "string", + "maxLength": 60, + "title": "Straße" + }, + "HouseNumber": { + "type": "string", + "maxLength": 10, + "title": "Hausnummer" + }, + "PostalCode": { + "type": "string", + "maxLength": 10, + "title": "Postleitzahl", + "description": "Postleitzahl des Orts" + }, + "City": { + "type": "string", + "maxLength": 40, + "title": "Ort" + } + }, + "title": "Address (for create)" + }, + "ZE_API_DEMO_SRV.Address-update": { + "type": "object", + "title": "Address (for update)" + }, + "count": { + "type": "string", + "description": "The number of entities in the collection. Available when using the [$inlinecount](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=67) query option." + }, + "error": { + "type": "object", + "required": [ + "error" + ], + "properties": { + "error": { + "type": "object", + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "object", + "required": [ + "lang", + "value" + ], + "properties": { + "lang": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, + "innererror": { + "type": "object", + "description": "The structure of this object is service-specific" + } + } + } + } + } + }, + "parameters": { + "top": { + "name": "$top", + "in": "query", + "description": "Show only the first n items, see [Paging - Top](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=66)", + "schema": { + "type": "integer", + "minimum": 0 + }, + "example": 50 + }, + "skip": { + "name": "$skip", + "in": "query", + "description": "Skip the first n items, see [Paging - Skip](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=65)", + "schema": { + "type": "integer", + "minimum": 0 + } + }, + "count": { + "name": "$inlinecount", + "in": "query", + "description": "Include count of items, see [Inlinecount](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=67)", + "schema": { + "type": "string", + "enum": [ + "allpages", + "none" + ] + } + } + }, + "responses": { + "error": { + "description": "Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error" + } + } + } + } + } + } +} \ No newline at end of file diff --git a/tools/tests/addressable-v2.swagger.json b/tools/tests/addressable-v2.swagger.json new file mode 100644 index 00000000..0c07e99a --- /dev/null +++ b/tools/tests/addressable-v2.swagger.json @@ -0,0 +1,700 @@ +{ + "swagger": "2.0", + "info": { + "title": "Service for namespace ZE_API_DEMO_SRV", + "version": "", + "description": "This service is located at [https://localhost/service-root/](https://localhost/service-root/)\n\n## Entity Data Model\n![ER Diagram](https://yuml.me/diagram/class/[Head{bg:orange}],[Head]-*>[Address{bg:orange}],[Address{bg:orange}],[HeadSet{bg:dodgerblue}]++-*>[Head],[AddressSet{bg:dodgerblue}]++-*>[Address])\n\n### Legend\n![Legend](https://yuml.me/diagram/plain;dir:TB;scale:60/class/[External.Type{bg:whitesmoke}],[ComplexType],[EntityType{bg:orange}],[EntitySet/Singleton/Operation{bg:dodgerblue}])" + }, + "schemes": [ + "https" + ], + "host": "localhost", + "basePath": "/service-root", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + { + "name": "HeadSet" + }, + { + "name": "AddressSet" + } + ], + "paths": { + "/HeadSet": { + "get": { + "summary": "Get entities from HeadSet", + "tags": [ + "HeadSet" + ], + "parameters": [ + { + "name": "$filter", + "in": "query", + "description": "Filter items by property values, see [Filtering](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=64)", + "type": "string" + }, + { + "$ref": "#/parameters/count" + }, + { + "name": "$select", + "in": "query", + "description": "Select properties to be returned, see [Select](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=68)", + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ + "BusinessPartner", + "Type", + "Grouping", + "Title", + "FirstName", + "LastName", + "IsBlocked", + "ETag", + "to_Address" + ] + } + }, + { + "name": "$expand", + "in": "query", + "description": "Expand related entities, see [Expand](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=63)", + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ + "to_Address" + ] + } + } + ], + "responses": { + "200": { + "description": "Retrieved entities", + "schema": { + "title": "Wrapper", + "type": "object", + "properties": { + "d": { + "title": "Collection of Head", + "type": "object", + "properties": { + "__count": { + "$ref": "#/definitions/count" + }, + "results": { + "type": "array", + "items": { + "$ref": "#/definitions/ZE_API_DEMO_SRV.Head" + } + } + } + } + } + } + }, + "400": { + "$ref": "#/responses/error" + } + } + }, + "post": { + "summary": "Add new entity to HeadSet", + "tags": [ + "HeadSet" + ], + "parameters": [ + { + "name": "Head", + "in": "body", + "description": "New entity", + "schema": { + "$ref": "#/definitions/ZE_API_DEMO_SRV.Head-create" + } + } + ], + "responses": { + "201": { + "description": "Created entity", + "schema": { + "title": "Head", + "type": "object", + "properties": { + "d": { + "$ref": "#/definitions/ZE_API_DEMO_SRV.Head" + } + } + } + }, + "400": { + "$ref": "#/responses/error" + } + } + } + }, + "/HeadSet('{BusinessPartner}')": { + "parameters": [ + { + "name": "BusinessPartner", + "in": "path", + "required": true, + "description": "Geschäftspartnernummer", + "type": "string" + } + ], + "get": { + "summary": "Get entity from HeadSet by key", + "tags": [ + "HeadSet" + ], + "parameters": [ + { + "name": "$select", + "in": "query", + "description": "Select properties to be returned, see [Select](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=68)", + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ + "BusinessPartner", + "Type", + "Grouping", + "Title", + "FirstName", + "LastName", + "IsBlocked", + "ETag", + "to_Address" + ] + } + }, + { + "name": "$expand", + "in": "query", + "description": "Expand related entities, see [Expand](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=63)", + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ + "to_Address" + ] + } + } + ], + "responses": { + "200": { + "description": "Retrieved entity", + "schema": { + "title": "Head", + "type": "object", + "properties": { + "d": { + "$ref": "#/definitions/ZE_API_DEMO_SRV.Head" + } + } + } + }, + "400": { + "$ref": "#/responses/error" + } + } + } + }, + "/HeadSet('{BusinessPartner}')/to_Address": { + "parameters": [ + { + "name": "BusinessPartner", + "in": "path", + "required": true, + "description": "Geschäftspartnernummer", + "type": "string" + } + ], + "get": { + "summary": "Get entities from related to_Address", + "tags": [ + "HeadSet", + "AddressSet" + ], + "parameters": [ + { + "name": "$filter", + "in": "query", + "description": "Filter items by property values, see [Filtering](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=64)", + "type": "string" + }, + { + "$ref": "#/parameters/count" + }, + { + "name": "$select", + "in": "query", + "description": "Select properties to be returned, see [Select](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=68)", + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": [ + "BusinessPartner", + "AddressId", + "District", + "Street", + "HouseNumber", + "PostalCode", + "City", + "Country", + "ETag" + ] + } + } + ], + "responses": { + "200": { + "description": "Retrieved entities", + "schema": { + "title": "Wrapper", + "type": "object", + "properties": { + "d": { + "title": "Collection of Address", + "type": "object", + "properties": { + "__count": { + "$ref": "#/definitions/count" + }, + "results": { + "type": "array", + "items": { + "$ref": "#/definitions/ZE_API_DEMO_SRV.Address" + } + } + } + } + } + } + }, + "400": { + "$ref": "#/responses/error" + } + } + }, + "post": { + "summary": "Add new entity to related to_Address", + "tags": [ + "HeadSet", + "AddressSet" + ], + "parameters": [ + { + "name": "Address", + "in": "body", + "description": "New entity", + "schema": { + "$ref": "#/definitions/ZE_API_DEMO_SRV.Address-create" + } + } + ], + "responses": { + "201": { + "description": "Created entity", + "schema": { + "title": "Address", + "type": "object", + "properties": { + "d": { + "$ref": "#/definitions/ZE_API_DEMO_SRV.Address" + } + } + } + }, + "400": { + "$ref": "#/responses/error" + } + } + } + }, + "/AddressSet(BusinessPartner='{BusinessPartner}',AddressId='{AddressId}')": { + "parameters": [ + { + "name": "BusinessPartner", + "in": "path", + "required": true, + "description": "Geschäftspartnernummer", + "type": "string" + }, + { + "name": "AddressId", + "in": "path", + "required": true, + "description": "Adressnummer", + "type": "string" + } + ], + "patch": { + "summary": "Update entity in AddressSet", + "tags": [ + "AddressSet" + ], + "parameters": [ + { + "name": "Address", + "in": "body", + "description": "New property values", + "schema": { + "title": "Modified Address", + "type": "object", + "properties": { + "d": { + "$ref": "#/definitions/ZE_API_DEMO_SRV.Address-update" + } + } + } + } + ], + "responses": { + "204": { + "description": "Success" + }, + "400": { + "$ref": "#/responses/error" + } + } + }, + "delete": { + "summary": "Delete entity from AddressSet", + "tags": [ + "AddressSet" + ], + "responses": { + "204": { + "description": "Success" + }, + "400": { + "$ref": "#/responses/error" + } + } + } + }, + "/$batch": { + "post": { + "summary": "Send a group of requests", + "description": "Group multiple requests into a single request payload, see [Batch Requests](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=152).", + "tags": [ + "Batch Requests" + ], + "consumes": [ + "multipart/mixed;boundary=request-separator" + ], + "produces": [ + "multipart/mixed" + ], + "parameters": [ + { + "name": "requestBody", + "in": "body", + "description": "Batch request", + "schema": { + "type": "string", + "example": "--request-separator\nContent-Type: application/http\nContent-Transfer-Encoding: binary\n\nGET HeadSet HTTP/1.1\nAccept: application/json\n\n\n--request-separator--" + } + } + ], + "responses": { + "202": { + "description": "Batch response", + "schema": { + "type": "string", + "example": "--response-separator\nContent-Type: application/http\n\nHTTP/1.1 200 OK\nContent-Type: application/json\n\n{...}\n--response-separator--" + } + }, + "400": { + "$ref": "#/responses/error" + } + } + } + } + }, + "definitions": { + "ZE_API_DEMO_SRV.Head": { + "type": "object", + "properties": { + "BusinessPartner": { + "type": "string", + "maxLength": 10, + "title": "GeschPartner", + "description": "Geschäftspartnernummer" + }, + "Type": { + "type": "string", + "maxLength": 4, + "title": "Partnerart", + "description": "Geschäftspartnerart" + }, + "Grouping": { + "type": "string", + "maxLength": 4, + "title": "Gruppierung", + "description": "Geschäftspartnergruppierung" + }, + "Title": { + "type": "string", + "maxLength": 4, + "title": "Anrede", + "description": "Anredeschlüssel" + }, + "FirstName": { + "type": "string", + "maxLength": 40, + "title": "Vorname", + "description": "Vorname des Geschäftspartners (Person)" + }, + "LastName": { + "type": "string", + "maxLength": 40, + "title": "Nachname", + "description": "Nachname des Geschäftspartners (Person)" + }, + "IsBlocked": { + "type": "boolean", + "title": "Zentrale Sperre", + "description": "Zentrale Sperre für den Geschäftspartner" + }, + "ETag": { + "type": "string", + "maxLength": 40, + "title": "Hash-Wert", + "description": "Hash-Wert (160 Bits)" + }, + "to_Address": { + "type": "object", + "properties": { + "results": { + "type": "array", + "items": { + "$ref": "#/definitions/ZE_API_DEMO_SRV.Address" + } + } + } + } + }, + "title": "Head" + }, + "ZE_API_DEMO_SRV.Head-create": { + "type": "object", + "properties": { + "Title": { + "type": "string", + "maxLength": 4, + "title": "Anrede", + "description": "Anredeschlüssel" + }, + "FirstName": { + "type": "string", + "maxLength": 40, + "title": "Vorname", + "description": "Vorname des Geschäftspartners (Person)" + }, + "LastName": { + "type": "string", + "maxLength": 40, + "title": "Nachname", + "description": "Nachname des Geschäftspartners (Person)" + }, + "to_Address": { + "type": "object", + "properties": { + "results": { + "type": "array", + "items": { + "$ref": "#/definitions/ZE_API_DEMO_SRV.Address-create" + } + } + } + } + }, + "title": "Head (for create)" + }, + "ZE_API_DEMO_SRV.Head-update": { + "type": "object", + "title": "Head (for update)" + }, + "ZE_API_DEMO_SRV.Address": { + "type": "object", + "properties": { + "BusinessPartner": { + "type": "string", + "maxLength": 10, + "title": "GeschPartner", + "description": "Geschäftspartnernummer" + }, + "AddressId": { + "type": "string", + "maxLength": 10, + "title": "Adressnummer" + }, + "District": { + "type": "string", + "maxLength": 40, + "title": "Ortsteil" + }, + "Street": { + "type": "string", + "maxLength": 60, + "title": "Straße" + }, + "HouseNumber": { + "type": "string", + "maxLength": 10, + "title": "Hausnummer" + }, + "PostalCode": { + "type": "string", + "maxLength": 10, + "title": "Postleitzahl", + "description": "Postleitzahl des Orts" + }, + "City": { + "type": "string", + "maxLength": 40, + "title": "Ort" + }, + "Country": { + "type": "string", + "maxLength": 2, + "title": "ISO-Code", + "description": "ISO-Code des Landes" + }, + "ETag": { + "type": "string", + "maxLength": 40, + "title": "Hash-Wert", + "description": "Hash-Wert (160 Bits)" + } + }, + "title": "Address" + }, + "ZE_API_DEMO_SRV.Address-create": { + "type": "object", + "properties": { + "District": { + "type": "string", + "maxLength": 40, + "title": "Ortsteil" + }, + "Street": { + "type": "string", + "maxLength": 60, + "title": "Straße" + }, + "HouseNumber": { + "type": "string", + "maxLength": 10, + "title": "Hausnummer" + }, + "PostalCode": { + "type": "string", + "maxLength": 10, + "title": "Postleitzahl", + "description": "Postleitzahl des Orts" + }, + "City": { + "type": "string", + "maxLength": 40, + "title": "Ort" + } + }, + "title": "Address (for create)" + }, + "ZE_API_DEMO_SRV.Address-update": { + "type": "object", + "title": "Address (for update)" + }, + "count": { + "type": "string", + "description": "The number of entities in the collection. Available when using the [$inlinecount](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=67) query option." + }, + "error": { + "type": "object", + "required": [ + "error" + ], + "properties": { + "error": { + "type": "object", + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "object", + "required": [ + "lang", + "value" + ], + "properties": { + "lang": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, + "innererror": { + "type": "object", + "description": "The structure of this object is service-specific" + } + } + } + } + } + }, + "parameters": { + "top": { + "name": "$top", + "in": "query", + "description": "Show only the first n items, see [Paging - Top](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=66)", + "type": "integer", + "minimum": 0 + }, + "skip": { + "name": "$skip", + "in": "query", + "description": "Skip the first n items, see [Paging - Skip](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=65)", + "type": "integer", + "minimum": 0 + }, + "count": { + "name": "$inlinecount", + "in": "query", + "description": "Include count of items, see [Inlinecount](https://help.sap.com/doc/5890d27be418427993fafa6722cdc03b/Cloud/en-US/OdataV2.pdf#page=67)", + "type": "string", + "enum": [ + "allpages", + "none" + ] + } + }, + "responses": { + "error": { + "description": "Error", + "schema": { + "$ref": "#/definitions/error" + } + } + } +} \ No newline at end of file diff --git a/tools/tests/addressable-v2.xml b/tools/tests/addressable-v2.xml new file mode 100644 index 00000000..14ef762e --- /dev/null +++ b/tools/tests/addressable-v2.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +