diff --git a/examples/TripPin.openapi3.json b/examples/TripPin.openapi3.json index e2233a43..f8254772 100644 --- a/examples/TripPin.openapi3.json +++ b/examples/TripPin.openapi3.json @@ -3364,6 +3364,9 @@ "title": "EventLocation", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "Address": { "type": "string" }, @@ -3380,6 +3383,9 @@ "title": "EventLocation (for create)", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "Address": { "type": "string" }, @@ -3412,6 +3418,9 @@ "title": "AirportLocation", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "Address": { "type": "string" }, @@ -3427,6 +3436,9 @@ "title": "AirportLocation (for create)", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "Address": { "type": "string" }, @@ -3846,6 +3858,9 @@ "title": "PublicTransportation", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "PlanItemId": { "type": "integer", "format": "int32" @@ -3888,6 +3903,9 @@ "title": "PublicTransportation (for create)", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "ConfirmationCode": { "type": "string", "nullable": true @@ -3964,6 +3982,9 @@ "title": "Flight", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "PlanItemId": { "type": "integer", "format": "int32" @@ -4012,6 +4033,9 @@ "title": "Flight (for create)", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "ConfirmationCode": { "type": "string", "nullable": true @@ -4091,6 +4115,9 @@ "title": "Event", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "PlanItemId": { "type": "integer", "format": "int32" @@ -4130,6 +4157,9 @@ "title": "Event (for create)", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "ConfirmationCode": { "type": "string", "nullable": true @@ -4408,6 +4438,9 @@ "type": "number" } }, + "type": { + "type": "string" + }, "error": { "type": "object", "required": [ diff --git a/examples/annotations.openapi3.json b/examples/annotations.openapi3.json index 8c058a96..c649b749 100644 --- a/examples/annotations.openapi3.json +++ b/examples/annotations.openapi3.json @@ -3061,6 +3061,9 @@ ], "description": "The number of entities in the collection. Available when using the [$count](http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptioncount) query option." }, + "type": { + "type": "string" + }, "error": { "type": "object", "required": [ diff --git a/examples/authorization.openapi3.json b/examples/authorization.openapi3.json index 597e65b4..db0b2d73 100644 --- a/examples/authorization.openapi3.json +++ b/examples/authorization.openapi3.json @@ -323,6 +323,9 @@ ], "description": "The number of entities in the collection. Available when using the [$count](http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptioncount) query option." }, + "type": { + "type": "string" + }, "error": { "type": "object", "required": [ diff --git a/examples/containment.openapi3.json b/examples/containment.openapi3.json index 68c21ef3..bd39aee9 100644 --- a/examples/containment.openapi3.json +++ b/examples/containment.openapi3.json @@ -5189,6 +5189,9 @@ ], "description": "The number of entities in the collection. Available when using the [$count](http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptioncount) query option." }, + "type": { + "type": "string" + }, "error": { "type": "object", "required": [ diff --git a/examples/csdl-16.1.openapi3.json b/examples/csdl-16.1.openapi3.json index 1315351e..35fd1c41 100644 --- a/examples/csdl-16.1.openapi3.json +++ b/examples/csdl-16.1.openapi3.json @@ -2402,6 +2402,9 @@ ], "description": "The number of entities in the collection. Available when using the [$count](http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptioncount) query option." }, + "type": { + "type": "string" + }, "error": { "type": "object", "required": [ diff --git a/examples/descriptions.openapi3.json b/examples/descriptions.openapi3.json index d9e45cb4..2608a8a4 100644 --- a/examples/descriptions.openapi3.json +++ b/examples/descriptions.openapi3.json @@ -1320,6 +1320,9 @@ ], "description": "The number of entities in the collection. Available when using the [$count](http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptioncount) query option." }, + "type": { + "type": "string" + }, "error": { "type": "object", "required": [ diff --git a/examples/example.openapi3.json b/examples/example.openapi3.json index d52d6589..8d913b95 100644 --- a/examples/example.openapi3.json +++ b/examples/example.openapi3.json @@ -3231,6 +3231,9 @@ "title": "FeaturedProduct", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "ID": { "type": "integer", "format": "int32" @@ -3309,6 +3312,9 @@ "title": "FeaturedProduct (for create)", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "ID": { "type": "integer", "format": "int32" @@ -3819,6 +3825,9 @@ "title": "Customer", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "ID": { "type": "integer", "format": "int32" @@ -3854,6 +3863,9 @@ "title": "Customer (for create)", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "ID": { "type": "integer", "format": "int32" @@ -3915,6 +3927,9 @@ "title": "Employee", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "ID": { "type": "integer", "format": "int32" @@ -3966,6 +3981,9 @@ "title": "Employee (for create)", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "ID": { "type": "integer", "format": "int32" @@ -4280,6 +4298,9 @@ ], "description": "The number of entities in the collection. Available when using the [$count](http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_SystemQueryOptioncount) query option." }, + "type": { + "type": "string" + }, "error": { "type": "object", "required": [ diff --git a/examples/miscellaneous.openapi3.json b/examples/miscellaneous.openapi3.json index 298b13ab..2d19c002 100644 --- a/examples/miscellaneous.openapi3.json +++ b/examples/miscellaneous.openapi3.json @@ -3380,6 +3380,9 @@ "title": "Manager", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "ID": { "type": "string" }, @@ -3426,6 +3429,9 @@ "title": "Manager (for create)", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "ID": { "type": "string" }, @@ -5903,10 +5909,20 @@ "type": "object" }, "Y.DeveloperType": { + "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + } + }, "title": "DeveloperType", "type": "object" }, "Y.DeveloperType-create": { + "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + } + }, "title": "DeveloperType (for create)", "type": "object" }, @@ -5960,6 +5976,9 @@ "title": "ArchivedMovieType", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "ArchivedAt": { "type": "string", "format": "date", @@ -5972,6 +5991,9 @@ "title": "ArchivedMovieType (for create)", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "ArchivedAt": { "type": "string", "format": "date", @@ -6131,6 +6153,9 @@ "type": "number" } }, + "type": { + "type": "string" + }, "error": { "type": "object", "required": [ diff --git a/examples/odata-rw-v3.openapi3.json b/examples/odata-rw-v3.openapi3.json index 02961bcc..92d56476 100644 --- a/examples/odata-rw-v3.openapi3.json +++ b/examples/odata-rw-v3.openapi3.json @@ -3079,7 +3079,7 @@ "format": "double", "example": 3.14 }, - "Categories@count": { + "Categories@odata.count": { "$ref": "#/components/schemas/count" }, "Categories": { @@ -3239,6 +3239,9 @@ "title": "FeaturedProduct", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "ID": { "type": "integer", "format": "int32" @@ -3278,7 +3281,7 @@ "format": "double", "example": 3.14 }, - "Categories@count": { + "Categories@odata.count": { "$ref": "#/components/schemas/count" }, "Categories": { @@ -3317,6 +3320,9 @@ "title": "FeaturedProduct (for create)", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "ID": { "type": "integer", "format": "int32" @@ -3501,7 +3507,7 @@ "type": "string", "nullable": true }, - "Products@count": { + "Products@odata.count": { "$ref": "#/components/schemas/count" }, "Products": { @@ -3577,7 +3583,7 @@ "type": "integer", "format": "int32" }, - "Products@count": { + "Products@odata.count": { "$ref": "#/components/schemas/count" }, "Products": { @@ -3827,6 +3833,9 @@ "title": "Customer", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "ID": { "type": "integer", "format": "int32" @@ -3862,6 +3871,9 @@ "title": "Customer (for create)", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "ID": { "type": "integer", "format": "int32" @@ -3923,6 +3935,9 @@ "title": "Employee", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "ID": { "type": "integer", "format": "int32" @@ -3974,6 +3989,9 @@ "title": "Employee (for create)", "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "ID": { "type": "integer", "format": "int32" @@ -4288,6 +4306,9 @@ "type": "number" } }, + "type": { + "type": "string" + }, "error": { "type": "object", "required": [ diff --git a/lib/csdl2openapi.js b/lib/csdl2openapi.js index 80c649c0..4365e0da 100644 --- a/lib/csdl2openapi.js +++ b/lib/csdl2openapi.js @@ -1329,7 +1329,7 @@ module.exports.csdl2openapi = function ( type: 'object', title: 'Collection of ' + nameParts(type.$Type || 'Edm.String').name, properties: { - [csdl.$Version > '4.0' ? '@count' : '@odata.count']: ref('count'), + [`@${csdl.$Version > '4.0' ? '' : 'odata.'}count`]: ref('count'), value: s } } @@ -1402,6 +1402,7 @@ module.exports.csdl2openapi = function ( inlineTypes(s); if (csdl.$EntityContainer) { + s.type = type(); s.count = count(); s.error = error(); } @@ -1495,13 +1496,18 @@ module.exports.csdl2openapi = function ( const creProperties = {}; const updProperties = {}; + if (type && type.$BaseType) { + allProperties[`@${csdl.$Version > '4.0' ? '' : 'odata.'}type`] = ref('type'); + creProperties[`@${csdl.$Version > '4.0' ? '' : 'odata.'}type`] = ref('type'); + } + const properties = propertiesOfStructuredType(type); Object.keys(properties).forEach(name => { const property = properties[name]; allProperties[name] = schema(property); if (property.$Kind == 'NavigationProperty') { if (property.$Collection) { - allProperties[`${name}@${csdl.$Version === '4.0' ? 'odata.' : ''}count`] = ref('count'); + allProperties[`${name}@${csdl.$Version > '4.0' ? '' : 'odata.'}count`] = ref('count'); } creProperties[name] = schema(property, '-create'); if (deepUpdate) @@ -1692,6 +1698,14 @@ module.exports.csdl2openapi = function ( }; } + /** + * Construct OData type response + * @return {object} Type response schema + */ + function type() { + return { type: "string" }; + } + /** * Construct Schema Object for model object referencing a type * @param {object} modelElement referencing a type diff --git a/tools/V4-CSDL-to-OpenAPI.xsl b/tools/V4-CSDL-to-OpenAPI.xsl index c250bdff..26b83237 100644 --- a/tools/V4-CSDL-to-OpenAPI.xsl +++ b/tools/V4-CSDL-to-OpenAPI.xsl @@ -897,6 +897,17 @@ + + + "metadata":{"type":"object", + "description":"This name/value pair is not data, but instead, specifies the metadata for the EntityType instance that the JSON object represents.", + "properties":{"id":{"type":"string"},"uri":{"type":"string"},"type":{"type":"string"}} + }, + + + "type":{"type":"string"}, + + "count": @@ -1426,6 +1437,27 @@ ,"properties":{ + + + + + "__metadata":{"$ref":" + + metadata"}, + + + + "@ + + odata. + + type":{"$ref":" + + type"}, + + + + @@ -4261,7 +4293,7 @@ @ - + odata. count":{"$ref":" diff --git a/tools/tests/Northwind-key-as-segment.openapi3.json b/tools/tests/Northwind-key-as-segment.openapi3.json index a2f6e7ff..7f0d5387 100644 --- a/tools/tests/Northwind-key-as-segment.openapi3.json +++ b/tools/tests/Northwind-key-as-segment.openapi3.json @@ -13824,6 +13824,9 @@ }, "title": "Summary_of_Sales_by_Year (for update)" }, + "type": { + "type": "string" + }, "count": { "anyOf": [ { diff --git a/tools/tests/Northwind-key-as-segment.swagger.json b/tools/tests/Northwind-key-as-segment.swagger.json index 93a3e8a7..b3fbbd70 100644 --- a/tools/tests/Northwind-key-as-segment.swagger.json +++ b/tools/tests/Northwind-key-as-segment.swagger.json @@ -13061,6 +13061,9 @@ }, "title": "Summary_of_Sales_by_Year (for update)" }, + "type": { + "type": "string" + }, "count": { "anyOf": [ { diff --git a/tools/tests/TripPin.openapi3.json b/tools/tests/TripPin.openapi3.json index b8a8467d..301fcb7e 100644 --- a/tools/tests/TripPin.openapi3.json +++ b/tools/tests/TripPin.openapi3.json @@ -3827,6 +3827,9 @@ "Microsoft.OData.SampleService.Models.TripPin.PublicTransportation": { "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "PlanItemId": { "type": "integer", "format": "int32" @@ -3951,6 +3954,9 @@ "Microsoft.OData.SampleService.Models.TripPin.Flight": { "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "PlanItemId": { "type": "integer", "format": "int32" @@ -4078,6 +4084,9 @@ "Microsoft.OData.SampleService.Models.TripPin.Event": { "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "PlanItemId": { "type": "integer", "format": "int32" @@ -4353,6 +4362,9 @@ }, "title": "Trip (for update)" }, + "type": { + "type": "string" + }, "count": { "anyOf": [ { diff --git a/tools/tests/TripPin.swagger.json b/tools/tests/TripPin.swagger.json index cd8e2960..907c024b 100644 --- a/tools/tests/TripPin.swagger.json +++ b/tools/tests/TripPin.swagger.json @@ -3361,6 +3361,9 @@ "Microsoft.OData.SampleService.Models.TripPin.PublicTransportation": { "type": "object", "properties": { + "@odata.type": { + "$ref": "#/definitions/type" + }, "PlanItemId": { "type": "integer", "format": "int32" @@ -3497,6 +3500,9 @@ "Microsoft.OData.SampleService.Models.TripPin.Flight": { "type": "object", "properties": { + "@odata.type": { + "$ref": "#/definitions/type" + }, "PlanItemId": { "type": "integer", "format": "int32" @@ -3660,6 +3666,9 @@ "Microsoft.OData.SampleService.Models.TripPin.Event": { "type": "object", "properties": { + "@odata.type": { + "$ref": "#/definitions/type" + }, "PlanItemId": { "type": "integer", "format": "int32" @@ -3974,6 +3983,9 @@ }, "title": "Trip (for update)" }, + "type": { + "type": "string" + }, "count": { "anyOf": [ { diff --git a/tools/tests/annotations-v2.openapi3.json b/tools/tests/annotations-v2.openapi3.json index 41a2eede..088b99de 100644 --- a/tools/tests/annotations-v2.openapi3.json +++ b/tools/tests/annotations-v2.openapi3.json @@ -13,6 +13,9 @@ "Supported.Annotations.SinglePartKey": { "type": "object", "properties": { + "__metadata": { + "$ref": "#/components/schemas/metadata" + }, "ID": { "type": "string" }, diff --git a/tools/tests/annotations-v2.swagger.json b/tools/tests/annotations-v2.swagger.json index 00336998..40aa0f53 100644 --- a/tools/tests/annotations-v2.swagger.json +++ b/tools/tests/annotations-v2.swagger.json @@ -12,6 +12,9 @@ "Supported.Annotations.SinglePartKey": { "type": "object", "properties": { + "__metadata": { + "$ref": "#/definitions/metadata" + }, "ID": { "type": "string" }, diff --git a/tools/tests/annotations.openapi3.json b/tools/tests/annotations.openapi3.json index 46847242..b33a40ff 100644 --- a/tools/tests/annotations.openapi3.json +++ b/tools/tests/annotations.openapi3.json @@ -3073,6 +3073,9 @@ "type": "object", "title": "TwoPartKey (for update)" }, + "type": { + "type": "string" + }, "count": { "anyOf": [ { diff --git a/tools/tests/annotations.swagger.json b/tools/tests/annotations.swagger.json index 63b38e89..2b86ab2d 100644 --- a/tools/tests/annotations.swagger.json +++ b/tools/tests/annotations.swagger.json @@ -2766,6 +2766,9 @@ "type": "object", "title": "TwoPartKey (for update)" }, + "type": { + "type": "string" + }, "count": { "anyOf": [ { diff --git a/tools/tests/authorization.openapi3.json b/tools/tests/authorization.openapi3.json index 5ed0a848..edc7d682 100644 --- a/tools/tests/authorization.openapi3.json +++ b/tools/tests/authorization.openapi3.json @@ -312,6 +312,9 @@ }, "title": "Person (for update)" }, + "type": { + "type": "string" + }, "count": { "anyOf": [ { diff --git a/tools/tests/authorization.swagger.json b/tools/tests/authorization.swagger.json index d27e7eea..cc959edf 100644 --- a/tools/tests/authorization.swagger.json +++ b/tools/tests/authorization.swagger.json @@ -300,6 +300,9 @@ }, "title": "Person (for update)" }, + "type": { + "type": "string" + }, "count": { "anyOf": [ { diff --git a/tools/tests/containment.openapi3.json b/tools/tests/containment.openapi3.json index 7b64be60..226f924e 100644 --- a/tools/tests/containment.openapi3.json +++ b/tools/tests/containment.openapi3.json @@ -5175,6 +5175,9 @@ }, "title": "Folder (for update)" }, + "type": { + "type": "string" + }, "count": { "anyOf": [ { diff --git a/tools/tests/containment.swagger.json b/tools/tests/containment.swagger.json index bf955a4d..e21fe2f7 100644 --- a/tools/tests/containment.swagger.json +++ b/tools/tests/containment.swagger.json @@ -4553,6 +4553,9 @@ }, "title": "Folder (for update)" }, + "type": { + "type": "string" + }, "count": { "anyOf": [ { diff --git a/tools/tests/csdl-16.1.openapi3.json b/tools/tests/csdl-16.1.openapi3.json index 4999fd80..5597573b 100644 --- a/tools/tests/csdl-16.1.openapi3.json +++ b/tools/tests/csdl-16.1.openapi3.json @@ -2277,6 +2277,9 @@ }, "title": "Address (for update)" }, + "type": { + "type": "string" + }, "count": { "anyOf": [ { diff --git a/tools/tests/csdl-16.1.swagger.json b/tools/tests/csdl-16.1.swagger.json index 4ad5abe9..87a19274 100644 --- a/tools/tests/csdl-16.1.swagger.json +++ b/tools/tests/csdl-16.1.swagger.json @@ -2117,6 +2117,9 @@ }, "title": "Address (for update)" }, + "type": { + "type": "string" + }, "count": { "anyOf": [ { diff --git a/tools/tests/descriptions.openapi3.json b/tools/tests/descriptions.openapi3.json index 7d297a9f..ec745c45 100644 --- a/tools/tests/descriptions.openapi3.json +++ b/tools/tests/descriptions.openapi3.json @@ -1275,6 +1275,9 @@ }, "components": { "schemas": { + "type": { + "type": "string" + }, "count": { "anyOf": [ { diff --git a/tools/tests/descriptions.swagger.json b/tools/tests/descriptions.swagger.json index fea10f16..2fc725c5 100644 --- a/tools/tests/descriptions.swagger.json +++ b/tools/tests/descriptions.swagger.json @@ -1179,6 +1179,9 @@ } }, "definitions": { + "type": { + "type": "string" + }, "count": { "anyOf": [ { diff --git a/tools/tests/odata-rw-v2.openapi3.json b/tools/tests/odata-rw-v2.openapi3.json index 9873b615..fd480f56 100644 --- a/tools/tests/odata-rw-v2.openapi3.json +++ b/tools/tests/odata-rw-v2.openapi3.json @@ -1490,6 +1490,9 @@ "ODataDemo.Product": { "type": "object", "properties": { + "__metadata": { + "$ref": "#/components/schemas/metadata" + }, "ID": { "type": "integer", "format": "int32" @@ -1632,6 +1635,9 @@ "ODataDemo.Category": { "type": "object", "properties": { + "__metadata": { + "$ref": "#/components/schemas/metadata" + }, "ID": { "type": "integer", "format": "int32" @@ -1695,6 +1701,9 @@ "ODataDemo.Supplier": { "type": "object", "properties": { + "__metadata": { + "$ref": "#/components/schemas/metadata" + }, "ID": { "type": "integer", "format": "int32" @@ -1854,6 +1863,21 @@ }, "title": "Address (for update)" }, + "metadata": { + "type": "object", + "description": "This name/value pair is not data, but instead, specifies the metadata for the EntityType instance that the JSON object represents.", + "properties": { + "id": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "type": { + "type": "string" + } + } + }, "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." diff --git a/tools/tests/odata-rw-v2.swagger.json b/tools/tests/odata-rw-v2.swagger.json index 89cb479d..9891dba1 100644 --- a/tools/tests/odata-rw-v2.swagger.json +++ b/tools/tests/odata-rw-v2.swagger.json @@ -1323,6 +1323,9 @@ "ODataDemo.Product": { "type": "object", "properties": { + "__metadata": { + "$ref": "#/definitions/metadata" + }, "ID": { "type": "integer", "format": "int32" @@ -1469,6 +1472,9 @@ "ODataDemo.Category": { "type": "object", "properties": { + "__metadata": { + "$ref": "#/definitions/metadata" + }, "ID": { "type": "integer", "format": "int32" @@ -1541,6 +1547,9 @@ "ODataDemo.Supplier": { "type": "object", "properties": { + "__metadata": { + "$ref": "#/definitions/metadata" + }, "ID": { "type": "integer", "format": "int32" @@ -1754,6 +1763,21 @@ }, "title": "Address (for update)" }, + "metadata": { + "type": "object", + "description": "This name/value pair is not data, but instead, specifies the metadata for the EntityType instance that the JSON object represents.", + "properties": { + "id": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "type": { + "type": "string" + } + } + }, "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." diff --git a/tools/tests/odata-rw-v3.openapi3.json b/tools/tests/odata-rw-v3.openapi3.json index 8e8e7183..7ce08316 100644 --- a/tools/tests/odata-rw-v3.openapi3.json +++ b/tools/tests/odata-rw-v3.openapi3.json @@ -138,7 +138,7 @@ "title": "Collection of Product", "type": "object", "properties": { - "@count": { + "@odata.count": { "$ref": "#/components/schemas/count" }, "value": { @@ -467,7 +467,7 @@ "title": "Collection of Category", "type": "object", "properties": { - "@count": { + "@odata.count": { "$ref": "#/components/schemas/count" }, "value": { @@ -754,7 +754,7 @@ "title": "Collection of ProductDetail", "type": "object", "properties": { - "@count": { + "@odata.count": { "$ref": "#/components/schemas/count" }, "value": { @@ -1142,7 +1142,7 @@ "title": "Collection of Category", "type": "object", "properties": { - "@count": { + "@odata.count": { "$ref": "#/components/schemas/count" }, "value": { @@ -1421,7 +1421,7 @@ "title": "Collection of Product", "type": "object", "properties": { - "@count": { + "@odata.count": { "$ref": "#/components/schemas/count" }, "value": { @@ -1570,7 +1570,7 @@ "title": "Collection of Supplier", "type": "object", "properties": { - "@count": { + "@odata.count": { "$ref": "#/components/schemas/count" }, "value": { @@ -1852,7 +1852,7 @@ "title": "Collection of Product", "type": "object", "properties": { - "@count": { + "@odata.count": { "$ref": "#/components/schemas/count" }, "value": { @@ -1992,7 +1992,7 @@ "title": "Collection of Person", "type": "object", "properties": { - "@count": { + "@odata.count": { "$ref": "#/components/schemas/count" }, "value": { @@ -2329,7 +2329,7 @@ "title": "Collection of PersonDetail", "type": "object", "properties": { - "@count": { + "@odata.count": { "$ref": "#/components/schemas/count" }, "value": { @@ -2657,7 +2657,7 @@ "title": "Collection of Advertisement", "type": "object", "properties": { - "@count": { + "@odata.count": { "$ref": "#/components/schemas/count" }, "value": { @@ -2903,7 +2903,7 @@ "title": "Collection of Product", "type": "object", "properties": { - "@count": { + "@odata.count": { "$ref": "#/components/schemas/count" }, "value": { @@ -3200,6 +3200,9 @@ "ODataDemo.FeaturedProduct": { "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "ID": { "type": "integer", "format": "int32" @@ -3785,6 +3788,9 @@ "ODataDemo.Customer": { "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "ID": { "type": "integer", "format": "int32" @@ -3881,6 +3887,9 @@ "ODataDemo.Employee": { "type": "object", "properties": { + "@odata.type": { + "$ref": "#/components/schemas/type" + }, "ID": { "type": "integer", "format": "int32" @@ -4210,6 +4219,9 @@ }, "title": "Advertisement (for update)" }, + "type": { + "type": "string" + }, "count": { "anyOf": [ { diff --git a/tools/tests/odata-rw-v3.swagger.json b/tools/tests/odata-rw-v3.swagger.json index 3df0ed02..57936e27 100644 --- a/tools/tests/odata-rw-v3.swagger.json +++ b/tools/tests/odata-rw-v3.swagger.json @@ -131,7 +131,7 @@ "title": "Collection of Product", "type": "object", "properties": { - "@count": { + "@odata.count": { "$ref": "#/definitions/count" }, "value": { @@ -413,7 +413,7 @@ "title": "Collection of Category", "type": "object", "properties": { - "@count": { + "@odata.count": { "$ref": "#/definitions/count" }, "value": { @@ -656,7 +656,7 @@ "title": "Collection of ProductDetail", "type": "object", "properties": { - "@count": { + "@odata.count": { "$ref": "#/definitions/count" }, "value": { @@ -987,7 +987,7 @@ "title": "Collection of Category", "type": "object", "properties": { - "@count": { + "@odata.count": { "$ref": "#/definitions/count" }, "value": { @@ -1231,7 +1231,7 @@ "title": "Collection of Product", "type": "object", "properties": { - "@count": { + "@odata.count": { "$ref": "#/definitions/count" }, "value": { @@ -1360,7 +1360,7 @@ "title": "Collection of Supplier", "type": "object", "properties": { - "@count": { + "@odata.count": { "$ref": "#/definitions/count" }, "value": { @@ -1607,7 +1607,7 @@ "title": "Collection of Product", "type": "object", "properties": { - "@count": { + "@odata.count": { "$ref": "#/definitions/count" }, "value": { @@ -1727,7 +1727,7 @@ "title": "Collection of Person", "type": "object", "properties": { - "@count": { + "@odata.count": { "$ref": "#/definitions/count" }, "value": { @@ -2019,7 +2019,7 @@ "title": "Collection of PersonDetail", "type": "object", "properties": { - "@count": { + "@odata.count": { "$ref": "#/definitions/count" }, "value": { @@ -2302,7 +2302,7 @@ "title": "Collection of Advertisement", "type": "object", "properties": { - "@count": { + "@odata.count": { "$ref": "#/definitions/count" }, "value": { @@ -2511,7 +2511,7 @@ "title": "Collection of Product", "type": "object", "properties": { - "@count": { + "@odata.count": { "$ref": "#/definitions/count" }, "value": { @@ -2774,6 +2774,9 @@ "ODataDemo.FeaturedProduct": { "type": "object", "properties": { + "@odata.type": { + "$ref": "#/definitions/type" + }, "ID": { "type": "integer", "format": "int32" @@ -3339,6 +3342,9 @@ "ODataDemo.Customer": { "type": "object", "properties": { + "@odata.type": { + "$ref": "#/definitions/type" + }, "ID": { "type": "integer", "format": "int32" @@ -3422,6 +3428,9 @@ "ODataDemo.Employee": { "type": "object", "properties": { + "@odata.type": { + "$ref": "#/definitions/type" + }, "ID": { "type": "integer", "format": "int32" @@ -3709,6 +3718,9 @@ }, "title": "Advertisement (for update)" }, + "type": { + "type": "string" + }, "count": { "anyOf": [ {