From f14be7e7fae8ba52902c85d3598e7d2910a40203 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Heiko=20Thei=C3=9Fen?= Date: Wed, 27 Nov 2024 10:27:29 +0100 Subject: [PATCH 1/5] Key fields not required --- tools/V4-CSDL-to-OpenAPI.xsl | 5 +- .../Northwind-key-as-segment.openapi3.json | 104 ------------------ .../Northwind-key-as-segment.swagger.json | 104 ------------------ tools/tests/annotations-v2.openapi3.json | 6 - tools/tests/annotations-v2.swagger.json | 6 - tools/tests/annotations.openapi3.json | 5 - tools/tests/annotations.swagger.json | 5 - tools/tests/authorization.openapi3.json | 3 - tools/tests/authorization.swagger.json | 3 - tools/tests/containment.openapi3.json | 13 --- tools/tests/containment.swagger.json | 13 --- tools/tests/csdl-16.1.openapi3.json | 12 -- tools/tests/csdl-16.1.swagger.json | 12 -- tools/tests/descriptions.openapi3.json | 6 - tools/tests/descriptions.swagger.json | 6 - tools/tests/keys-v4.01.openapi3.json | 6 - tools/tests/keys-v4.01.swagger.json | 6 - tools/tests/keys-v4.openapi3.json | 6 - tools/tests/keys-v4.swagger.json | 6 - tools/tests/media-entities-v2.openapi3.json | 3 - tools/tests/media-entities-v2.swagger.json | 3 - tools/tests/odata-rw-v2.openapi3.json | 9 -- tools/tests/odata-rw-v2.swagger.json | 9 -- tools/tests/odata-rw-v3.openapi3.json | 30 ----- tools/tests/odata-rw-v3.swagger.json | 30 ----- 25 files changed, 2 insertions(+), 409 deletions(-) diff --git a/tools/V4-CSDL-to-OpenAPI.xsl b/tools/V4-CSDL-to-OpenAPI.xsl index 0c60fcf8..6609d1fe 100644 --- a/tools/V4-CSDL-to-OpenAPI.xsl +++ b/tools/V4-CSDL-to-OpenAPI.xsl @@ -1556,10 +1556,9 @@ - + + concat($qualifiedName,'/',@Name)=$mandatory or concat($aliasQualifiedName,'/',@Name)=$mandatory]"> , diff --git a/tools/tests/Northwind-key-as-segment.openapi3.json b/tools/tests/Northwind-key-as-segment.openapi3.json index 5ab63942..e4952202 100644 --- a/tools/tests/Northwind-key-as-segment.openapi3.json +++ b/tools/tests/Northwind-key-as-segment.openapi3.json @@ -10355,9 +10355,6 @@ } } }, - "required": [ - "CategoryID" - ], "title": "Category (for create)" }, "NorthwindModel.Category-update": { @@ -10417,9 +10414,6 @@ } } }, - "required": [ - "CustomerTypeID" - ], "title": "CustomerDemographic (for create)" }, "NorthwindModel.CustomerDemographic-update": { @@ -10572,9 +10566,6 @@ } } }, - "required": [ - "CustomerID" - ], "title": "Customer (for create)" }, "NorthwindModel.Customer-update": { @@ -10870,9 +10861,6 @@ } } }, - "required": [ - "EmployeeID" - ], "title": "Employee (for create)" }, "NorthwindModel.Employee-update": { @@ -11065,10 +11053,6 @@ "$ref": "#/components/schemas/NorthwindModel.Product-create" } }, - "required": [ - "OrderID", - "ProductID" - ], "title": "Order_Detail (for create)" }, "NorthwindModel.Order_Detail-update": { @@ -11344,9 +11328,6 @@ ] } }, - "required": [ - "OrderID" - ], "title": "Order (for create)" }, "NorthwindModel.Order-update": { @@ -11602,9 +11583,6 @@ ] } }, - "required": [ - "ProductID" - ], "title": "Product (for create)" }, "NorthwindModel.Product-update": { @@ -11704,9 +11682,6 @@ } } }, - "required": [ - "RegionID" - ], "title": "Region (for create)" }, "NorthwindModel.Region-update": { @@ -11767,9 +11742,6 @@ } } }, - "required": [ - "ShipperID" - ], "title": "Shipper (for create)" }, "NorthwindModel.Shipper-update": { @@ -11923,9 +11895,6 @@ } } }, - "required": [ - "SupplierID" - ], "title": "Supplier (for create)" }, "NorthwindModel.Supplier-update": { @@ -12039,9 +12008,6 @@ } } }, - "required": [ - "TerritoryID" - ], "title": "Territory (for create)" }, "NorthwindModel.Territory-update": { @@ -12190,12 +12156,6 @@ "maxLength": 15 } }, - "required": [ - "ProductID", - "ProductName", - "Discontinued", - "CategoryName" - ], "title": "Alphabetical_list_of_product (for create)" }, "NorthwindModel.Alphabetical_list_of_product-update": { @@ -12300,9 +12260,6 @@ "example": 0 } }, - "required": [ - "CategoryName" - ], "title": "Category_Sales_for_1997 (for create)" }, "NorthwindModel.Category_Sales_for_1997-update": { @@ -12353,10 +12310,6 @@ "maxLength": 40 } }, - "required": [ - "ProductID", - "ProductName" - ], "title": "Current_Product_List (for create)" }, "NorthwindModel.Current_Product_List-update": { @@ -12409,10 +12362,6 @@ "maxLength": 9 } }, - "required": [ - "CompanyName", - "Relationship" - ], "title": "Customer_and_Suppliers_by_City (for create)" }, "NorthwindModel.Customer_and_Suppliers_by_City-update": { @@ -12771,17 +12720,6 @@ "example": 0 } }, - "required": [ - "CustomerName", - "Salesperson", - "OrderID", - "ShipperName", - "ProductID", - "ProductName", - "UnitPrice", - "Quantity", - "Discount" - ], "title": "Invoice (for create)" }, "NorthwindModel.Invoice-update": { @@ -13028,14 +12966,6 @@ "example": 0 } }, - "required": [ - "OrderID", - "ProductID", - "ProductName", - "UnitPrice", - "Quantity", - "Discount" - ], "title": "Order_Details_Extended (for create)" }, "NorthwindModel.Order_Details_Extended-update": { @@ -13110,9 +13040,6 @@ "example": 0 } }, - "required": [ - "OrderID" - ], "title": "Order_Subtotal (for create)" }, "NorthwindModel.Order_Subtotal-update": { @@ -13371,10 +13298,6 @@ "maxLength": 15 } }, - "required": [ - "OrderID", - "CompanyName" - ], "title": "Orders_Qry (for create)" }, "NorthwindModel.Orders_Qry-update": { @@ -13545,10 +13468,6 @@ "example": 0 } }, - "required": [ - "CategoryName", - "ProductName" - ], "title": "Product_Sales_for_1997 (for create)" }, "NorthwindModel.Product_Sales_for_1997-update": { @@ -13623,9 +13542,6 @@ "example": 0 } }, - "required": [ - "ProductName" - ], "title": "Products_Above_Average_Price (for create)" }, "NorthwindModel.Products_Above_Average_Price-update": { @@ -13702,11 +13618,6 @@ "type": "boolean" } }, - "required": [ - "CategoryName", - "ProductName", - "Discontinued" - ], "title": "Products_by_Category (for create)" }, "NorthwindModel.Products_by_Category-update": { @@ -13791,11 +13702,6 @@ "example": 0 } }, - "required": [ - "CategoryID", - "CategoryName", - "ProductName" - ], "title": "Sales_by_Category (for create)" }, "NorthwindModel.Sales_by_Category-update": { @@ -13890,10 +13796,6 @@ "example": "2017-04-13T15:51:04Z" } }, - "required": [ - "OrderID", - "CompanyName" - ], "title": "Sales_Totals_by_Amount (for create)" }, "NorthwindModel.Sales_Totals_by_Amount-update": { @@ -13986,9 +13888,6 @@ "example": 0 } }, - "required": [ - "OrderID" - ], "title": "Summary_of_Sales_by_Quarter (for create)" }, "NorthwindModel.Summary_of_Sales_by_Quarter-update": { @@ -14081,9 +13980,6 @@ "example": 0 } }, - "required": [ - "OrderID" - ], "title": "Summary_of_Sales_by_Year (for create)" }, "NorthwindModel.Summary_of_Sales_by_Year-update": { diff --git a/tools/tests/Northwind-key-as-segment.swagger.json b/tools/tests/Northwind-key-as-segment.swagger.json index 8f3b1061..32c5fdd8 100644 --- a/tools/tests/Northwind-key-as-segment.swagger.json +++ b/tools/tests/Northwind-key-as-segment.swagger.json @@ -8977,9 +8977,6 @@ } } }, - "required": [ - "CategoryID" - ], "title": "Category (for create)" }, "NorthwindModel.Category-update": { @@ -9050,9 +9047,6 @@ } } }, - "required": [ - "CustomerTypeID" - ], "title": "CustomerDemographic (for create)" }, "NorthwindModel.CustomerDemographic-update": { @@ -9262,9 +9256,6 @@ } } }, - "required": [ - "CustomerID" - ], "title": "Customer (for create)" }, "NorthwindModel.Customer-update": { @@ -9659,9 +9650,6 @@ } } }, - "required": [ - "EmployeeID" - ], "title": "Employee (for create)" }, "NorthwindModel.Employee-update": { @@ -9879,10 +9867,6 @@ "$ref": "#/definitions/NorthwindModel.Product-create" } }, - "required": [ - "OrderID", - "ProductID" - ], "title": "Order_Detail (for create)" }, "NorthwindModel.Order_Detail-update": { @@ -10174,9 +10158,6 @@ "$ref": "#/definitions/NorthwindModel.Shipper-create" } }, - "required": [ - "OrderID" - ], "title": "Order (for create)" }, "NorthwindModel.Order-update": { @@ -10457,9 +10438,6 @@ "$ref": "#/definitions/NorthwindModel.Supplier-create" } }, - "required": [ - "ProductID" - ], "title": "Product (for create)" }, "NorthwindModel.Product-update": { @@ -10568,9 +10546,6 @@ } } }, - "required": [ - "RegionID" - ], "title": "Region (for create)" }, "NorthwindModel.Region-update": { @@ -10637,9 +10612,6 @@ } } }, - "required": [ - "ShipperID" - ], "title": "Shipper (for create)" }, "NorthwindModel.Shipper-update": { @@ -10856,9 +10828,6 @@ } } }, - "required": [ - "SupplierID" - ], "title": "Supplier (for create)" }, "NorthwindModel.Supplier-update": { @@ -11002,9 +10971,6 @@ } } }, - "required": [ - "TerritoryID" - ], "title": "Territory (for create)" }, "NorthwindModel.Territory-update": { @@ -11171,12 +11137,6 @@ "maxLength": 15 } }, - "required": [ - "ProductID", - "ProductName", - "Discontinued", - "CategoryName" - ], "title": "Alphabetical_list_of_product (for create)" }, "NorthwindModel.Alphabetical_list_of_product-update": { @@ -11282,9 +11242,6 @@ "example": 0 } }, - "required": [ - "CategoryName" - ], "title": "Category_Sales_for_1997 (for create)" }, "NorthwindModel.Category_Sales_for_1997-update": { @@ -11331,10 +11288,6 @@ "maxLength": 40 } }, - "required": [ - "ProductID", - "ProductName" - ], "title": "Current_Product_List (for create)" }, "NorthwindModel.Current_Product_List-update": { @@ -11399,10 +11352,6 @@ "maxLength": 9 } }, - "required": [ - "CompanyName", - "Relationship" - ], "title": "Customer_and_Suppliers_by_City (for create)" }, "NorthwindModel.Customer_and_Suppliers_by_City-update": { @@ -11819,17 +11768,6 @@ "example": 0 } }, - "required": [ - "CustomerName", - "Salesperson", - "OrderID", - "ShipperName", - "ProductID", - "ProductName", - "UnitPrice", - "Quantity", - "Discount" - ], "title": "Invoice (for create)" }, "NorthwindModel.Invoice-update": { @@ -12086,14 +12024,6 @@ "example": 0 } }, - "required": [ - "OrderID", - "ProductID", - "ProductName", - "UnitPrice", - "Quantity", - "Discount" - ], "title": "Order_Details_Extended (for create)" }, "NorthwindModel.Order_Details_Extended-update": { @@ -12156,9 +12086,6 @@ "example": 0 } }, - "required": [ - "OrderID" - ], "title": "Order_Subtotal (for create)" }, "NorthwindModel.Order_Subtotal-update": { @@ -12497,10 +12424,6 @@ "example": "string" } }, - "required": [ - "OrderID", - "CompanyName" - ], "title": "Orders_Qry (for create)" }, "NorthwindModel.Orders_Qry-update": { @@ -12705,10 +12628,6 @@ "example": 0 } }, - "required": [ - "CategoryName", - "ProductName" - ], "title": "Product_Sales_for_1997 (for create)" }, "NorthwindModel.Product_Sales_for_1997-update": { @@ -12771,9 +12690,6 @@ "example": 0 } }, - "required": [ - "ProductName" - ], "title": "Products_Above_Average_Price (for create)" }, "NorthwindModel.Products_Above_Average_Price-update": { @@ -12856,11 +12772,6 @@ "type": "boolean" } }, - "required": [ - "CategoryName", - "ProductName", - "Discontinued" - ], "title": "Products_by_Category (for create)" }, "NorthwindModel.Products_by_Category-update": { @@ -12942,11 +12853,6 @@ "example": 0 } }, - "required": [ - "CategoryID", - "CategoryName", - "ProductName" - ], "title": "Sales_by_Category (for create)" }, "NorthwindModel.Sales_by_Category-update": { @@ -13033,10 +12939,6 @@ "example": "2017-04-13T15:51:04Z" } }, - "required": [ - "OrderID", - "CompanyName" - ], "title": "Sales_Totals_by_Amount (for create)" }, "NorthwindModel.Sales_Totals_by_Amount-update": { @@ -13123,9 +13025,6 @@ "example": 0 } }, - "required": [ - "OrderID" - ], "title": "Summary_of_Sales_by_Quarter (for create)" }, "NorthwindModel.Summary_of_Sales_by_Quarter-update": { @@ -13212,9 +13111,6 @@ "example": 0 } }, - "required": [ - "OrderID" - ], "title": "Summary_of_Sales_by_Year (for create)" }, "NorthwindModel.Summary_of_Sales_by_Year-update": { diff --git a/tools/tests/annotations-v2.openapi3.json b/tools/tests/annotations-v2.openapi3.json index 6ac8f67c..d41f05db 100644 --- a/tools/tests/annotations-v2.openapi3.json +++ b/tools/tests/annotations-v2.openapi3.json @@ -694,9 +694,6 @@ "example": "Hello World" } }, - "required": [ - "ID" - ], "title": "SinglePartKey (for create)" }, "Supported.Annotations.SinglePartKey-update": { @@ -766,9 +763,6 @@ "example": "/Date(1492098664000)/" } }, - "required": [ - "ID" - ], "title": "PlainDateTimeKey (for create)" }, "Supported.Annotations.PlainDateTimeKey-update": { diff --git a/tools/tests/annotations-v2.swagger.json b/tools/tests/annotations-v2.swagger.json index 6bfa60a0..8b2396e9 100644 --- a/tools/tests/annotations-v2.swagger.json +++ b/tools/tests/annotations-v2.swagger.json @@ -663,9 +663,6 @@ "example": "Hello World" } }, - "required": [ - "ID" - ], "title": "SinglePartKey (for create)" }, "Supported.Annotations.SinglePartKey-update": { @@ -747,9 +744,6 @@ "example": "/Date(1492098664000)/" } }, - "required": [ - "ID" - ], "title": "PlainDateTimeKey (for create)" }, "Supported.Annotations.PlainDateTimeKey-update": { diff --git a/tools/tests/annotations.openapi3.json b/tools/tests/annotations.openapi3.json index b76926be..62ed1f32 100644 --- a/tools/tests/annotations.openapi3.json +++ b/tools/tests/annotations.openapi3.json @@ -3134,7 +3134,6 @@ } }, "required": [ - "ID", "PatternExt", "AllowedValuesExt" ], @@ -3318,10 +3317,6 @@ "example": "15:51:04" } }, - "required": [ - "One", - "Two" - ], "title": "TwoPartKey (for create)" }, "Supported.Annotations.TwoPartKey-update": { diff --git a/tools/tests/annotations.swagger.json b/tools/tests/annotations.swagger.json index dce97dda..34e9d793 100644 --- a/tools/tests/annotations.swagger.json +++ b/tools/tests/annotations.swagger.json @@ -2783,7 +2783,6 @@ } }, "required": [ - "ID", "PatternExt", "AllowedValuesExt" ], @@ -2970,10 +2969,6 @@ "example": "15:51:04" } }, - "required": [ - "One", - "Two" - ], "title": "TwoPartKey (for create)" }, "Supported.Annotations.TwoPartKey-update": { diff --git a/tools/tests/authorization.openapi3.json b/tools/tests/authorization.openapi3.json index a84af013..a7318429 100644 --- a/tools/tests/authorization.openapi3.json +++ b/tools/tests/authorization.openapi3.json @@ -304,9 +304,6 @@ "nullable": true } }, - "required": [ - "ID" - ], "title": "Person (for create)" }, "auth.example.Person-update": { diff --git a/tools/tests/authorization.swagger.json b/tools/tests/authorization.swagger.json index 2493234f..50eeddff 100644 --- a/tools/tests/authorization.swagger.json +++ b/tools/tests/authorization.swagger.json @@ -285,9 +285,6 @@ "example": "string" } }, - "required": [ - "ID" - ], "title": "Person (for create)" }, "auth.example.Person-update": { diff --git a/tools/tests/containment.openapi3.json b/tools/tests/containment.openapi3.json index 9c28f5f2..d08b3270 100644 --- a/tools/tests/containment.openapi3.json +++ b/tools/tests/containment.openapi3.json @@ -5079,9 +5079,6 @@ } } }, - "required": [ - "ID" - ], "title": "Whole (for create)" }, "Containment.Whole-update": { @@ -5164,9 +5161,6 @@ } } }, - "required": [ - "index" - ], "title": "Part (for create)" }, "Containment.Part-update": { @@ -5199,10 +5193,6 @@ "format": "int32" } }, - "required": [ - "One", - "Two" - ], "title": "SubPart (for create)" }, "Containment.SubPart-update": { @@ -5245,9 +5235,6 @@ } } }, - "required": [ - "Name" - ], "title": "Folder (for create)" }, "Containment.Folder-update": { diff --git a/tools/tests/containment.swagger.json b/tools/tests/containment.swagger.json index 2466d424..01fcf1de 100644 --- a/tools/tests/containment.swagger.json +++ b/tools/tests/containment.swagger.json @@ -4377,9 +4377,6 @@ } } }, - "required": [ - "ID" - ], "title": "Whole (for create)" }, "Containment.Whole-update": { @@ -4455,9 +4452,6 @@ } } }, - "required": [ - "index" - ], "title": "Part (for create)" }, "Containment.Part-update": { @@ -4490,10 +4484,6 @@ "format": "int32" } }, - "required": [ - "One", - "Two" - ], "title": "SubPart (for create)" }, "Containment.SubPart-update": { @@ -4542,9 +4532,6 @@ } } }, - "required": [ - "Name" - ], "title": "Folder (for create)" }, "Containment.Folder-update": { diff --git a/tools/tests/csdl-16.1.openapi3.json b/tools/tests/csdl-16.1.openapi3.json index ce5a29d6..5b5f5df3 100644 --- a/tools/tests/csdl-16.1.openapi3.json +++ b/tools/tests/csdl-16.1.openapi3.json @@ -2043,9 +2043,6 @@ ] } }, - "required": [ - "ID" - ], "title": "Product (for create)" }, "ODataDemo.Product-update": { @@ -2130,9 +2127,6 @@ } } }, - "required": [ - "ID" - ], "title": "Category (for create)" }, "ODataDemo.Category-update": { @@ -2194,9 +2188,6 @@ } } }, - "required": [ - "ID" - ], "title": "Supplier (for create)" }, "ODataDemo.Supplier-update": { @@ -2242,9 +2233,6 @@ "nullable": true } }, - "required": [ - "Code" - ], "title": "Country (for create)" }, "ODataDemo.Country-update": { diff --git a/tools/tests/csdl-16.1.swagger.json b/tools/tests/csdl-16.1.swagger.json index 02bef9a7..8a1ae4ea 100644 --- a/tools/tests/csdl-16.1.swagger.json +++ b/tools/tests/csdl-16.1.swagger.json @@ -1796,9 +1796,6 @@ "$ref": "#/definitions/ODataDemo.Supplier-create" } }, - "required": [ - "ID" - ], "title": "Product (for create)" }, "ODataDemo.Product-update": { @@ -1891,9 +1888,6 @@ } } }, - "required": [ - "ID" - ], "title": "Category (for create)" }, "ODataDemo.Category-update": { @@ -1961,9 +1955,6 @@ } } }, - "required": [ - "ID" - ], "title": "Supplier (for create)" }, "ODataDemo.Supplier-update": { @@ -2018,9 +2009,6 @@ "example": "string" } }, - "required": [ - "Code" - ], "title": "Country (for create)" }, "ODataDemo.Country-update": { diff --git a/tools/tests/descriptions.openapi3.json b/tools/tests/descriptions.openapi3.json index 3b1672e7..222a2098 100644 --- a/tools/tests/descriptions.openapi3.json +++ b/tools/tests/descriptions.openapi3.json @@ -3082,9 +3082,6 @@ } } }, - "required": [ - "id" - ], "title": "Entity Type - Description (for create)", "description": "Entity Type - LongDescription" }, @@ -3111,9 +3108,6 @@ "maxLength": 70 } }, - "required": [ - "id" - ], "title": "subEntity (for create)" }, "descriptions.subEntity-update": { diff --git a/tools/tests/descriptions.swagger.json b/tools/tests/descriptions.swagger.json index 436f0c1a..c10177c8 100644 --- a/tools/tests/descriptions.swagger.json +++ b/tools/tests/descriptions.swagger.json @@ -2707,9 +2707,6 @@ } } }, - "required": [ - "id" - ], "title": "Entity Type - Description (for create)", "description": "Entity Type - LongDescription" }, @@ -2736,9 +2733,6 @@ "maxLength": 70 } }, - "required": [ - "id" - ], "title": "subEntity (for create)" }, "descriptions.subEntity-update": { diff --git a/tools/tests/keys-v4.01.openapi3.json b/tools/tests/keys-v4.01.openapi3.json index dff6f1a6..b611bd57 100644 --- a/tools/tests/keys-v4.01.openapi3.json +++ b/tools/tests/keys-v4.01.openapi3.json @@ -364,12 +364,6 @@ "example": "P4DT15H51M04S" } }, - "required": [ - "int32", - "timeOfDay", - "boolean", - "duration" - ], "title": "MultiPartKey (for create)" }, "KeyTypes.MultiPartKey-update": { diff --git a/tools/tests/keys-v4.01.swagger.json b/tools/tests/keys-v4.01.swagger.json index 73b2f91e..567e4313 100644 --- a/tools/tests/keys-v4.01.swagger.json +++ b/tools/tests/keys-v4.01.swagger.json @@ -329,12 +329,6 @@ "example": "P4DT15H51M04S" } }, - "required": [ - "int32", - "timeOfDay", - "boolean", - "duration" - ], "title": "MultiPartKey (for create)" }, "KeyTypes.MultiPartKey-update": { diff --git a/tools/tests/keys-v4.openapi3.json b/tools/tests/keys-v4.openapi3.json index bb1ab31b..54ff9641 100644 --- a/tools/tests/keys-v4.openapi3.json +++ b/tools/tests/keys-v4.openapi3.json @@ -364,12 +364,6 @@ "example": "P4DT15H51M04S" } }, - "required": [ - "int32", - "timeOfDay", - "boolean", - "duration" - ], "title": "MultiPartKey (for create)" }, "KeyTypes.MultiPartKey-update": { diff --git a/tools/tests/keys-v4.swagger.json b/tools/tests/keys-v4.swagger.json index ccb25193..53e7f96d 100644 --- a/tools/tests/keys-v4.swagger.json +++ b/tools/tests/keys-v4.swagger.json @@ -329,12 +329,6 @@ "example": "P4DT15H51M04S" } }, - "required": [ - "int32", - "timeOfDay", - "boolean", - "duration" - ], "title": "MultiPartKey (for create)" }, "KeyTypes.MultiPartKey-update": { diff --git a/tools/tests/media-entities-v2.openapi3.json b/tools/tests/media-entities-v2.openapi3.json index 1d3bae2b..f272ee12 100644 --- a/tools/tests/media-entities-v2.openapi3.json +++ b/tools/tests/media-entities-v2.openapi3.json @@ -346,9 +346,6 @@ "format": "int32" } }, - "required": [ - "ID" - ], "title": "MediaType (for create)" }, "Media.Entities.MediaType-update": { diff --git a/tools/tests/media-entities-v2.swagger.json b/tools/tests/media-entities-v2.swagger.json index 33eceb0f..3a6e73b0 100644 --- a/tools/tests/media-entities-v2.swagger.json +++ b/tools/tests/media-entities-v2.swagger.json @@ -319,9 +319,6 @@ "format": "int32" } }, - "required": [ - "ID" - ], "title": "MediaType (for create)" }, "Media.Entities.MediaType-update": { diff --git a/tools/tests/odata-rw-v2.openapi3.json b/tools/tests/odata-rw-v2.openapi3.json index 5d53fbc2..60acd974 100644 --- a/tools/tests/odata-rw-v2.openapi3.json +++ b/tools/tests/odata-rw-v2.openapi3.json @@ -1591,9 +1591,6 @@ ] } }, - "required": [ - "ID" - ], "title": "Product (for create)" }, "ODataDemo.Product-update": { @@ -1677,9 +1674,6 @@ } } }, - "required": [ - "ID" - ], "title": "Category (for create)" }, "ODataDemo.Category-update": { @@ -1754,9 +1748,6 @@ } } }, - "required": [ - "ID" - ], "title": "Supplier (for create)" }, "ODataDemo.Supplier-update": { diff --git a/tools/tests/odata-rw-v2.swagger.json b/tools/tests/odata-rw-v2.swagger.json index 28c4fc51..5a6f1dd2 100644 --- a/tools/tests/odata-rw-v2.swagger.json +++ b/tools/tests/odata-rw-v2.swagger.json @@ -1420,9 +1420,6 @@ "$ref": "#/definitions/ODataDemo.Supplier-create" } }, - "required": [ - "ID" - ], "title": "Product (for create)" }, "ODataDemo.Product-update": { @@ -1520,9 +1517,6 @@ } } }, - "required": [ - "ID" - ], "title": "Category (for create)" }, "ODataDemo.Category-update": { @@ -1606,9 +1600,6 @@ } } }, - "required": [ - "ID" - ], "title": "Supplier (for create)" }, "ODataDemo.Supplier-update": { diff --git a/tools/tests/odata-rw-v3.openapi3.json b/tools/tests/odata-rw-v3.openapi3.json index 5125e875..1457e97d 100644 --- a/tools/tests/odata-rw-v3.openapi3.json +++ b/tools/tests/odata-rw-v3.openapi3.json @@ -3111,9 +3111,6 @@ ] } }, - "required": [ - "ID" - ], "anyOf": [ { "$ref": "#/components/schemas/ODataDemo.FeaturedProduct-create" @@ -3317,9 +3314,6 @@ ] } }, - "required": [ - "ID" - ], "title": "FeaturedProduct (for create)" }, "ODataDemo.FeaturedProduct-update": { @@ -3405,9 +3399,6 @@ ] } }, - "required": [ - "ProductID" - ], "title": "ProductDetail (for create)" }, "ODataDemo.ProductDetail-update": { @@ -3458,9 +3449,6 @@ } } }, - "required": [ - "ID" - ], "title": "Category (for create)" }, "ODataDemo.Category-update": { @@ -3551,9 +3539,6 @@ } } }, - "required": [ - "ID" - ], "title": "Supplier (for create)" }, "ODataDemo.Supplier-update": { @@ -3715,9 +3700,6 @@ ] } }, - "required": [ - "ID" - ], "anyOf": [ { "$ref": "#/components/schemas/ODataDemo.Customer-create" @@ -3816,9 +3798,6 @@ "example": 0 } }, - "required": [ - "ID" - ], "title": "Customer (for create)" }, "ODataDemo.Customer-update": { @@ -3944,9 +3923,6 @@ "example": 3.14 } }, - "required": [ - "ID" - ], "title": "Employee (for create)" }, "ODataDemo.Employee-update": { @@ -4068,9 +4044,6 @@ ] } }, - "required": [ - "PersonID" - ], "title": "PersonDetail (for create)" }, "ODataDemo.PersonDetail-update": { @@ -4156,9 +4129,6 @@ ] } }, - "required": [ - "ID" - ], "title": "Advertisement (for create)" }, "ODataDemo.Advertisement-update": { diff --git a/tools/tests/odata-rw-v3.swagger.json b/tools/tests/odata-rw-v3.swagger.json index 9593418d..942299ed 100644 --- a/tools/tests/odata-rw-v3.swagger.json +++ b/tools/tests/odata-rw-v3.swagger.json @@ -2703,9 +2703,6 @@ "$ref": "#/definitions/ODataDemo.ProductDetail-create" } }, - "required": [ - "ID" - ], "title": "Product (for create)" }, "ODataDemo.Product-update": { @@ -2879,9 +2876,6 @@ "$ref": "#/definitions/ODataDemo.Advertisement-create" } }, - "required": [ - "ID" - ], "title": "FeaturedProduct (for create)" }, "ODataDemo.FeaturedProduct-update": { @@ -2967,9 +2961,6 @@ "$ref": "#/definitions/ODataDemo.Product-create" } }, - "required": [ - "ProductID" - ], "title": "ProductDetail (for create)" }, "ODataDemo.ProductDetail-update": { @@ -3029,9 +3020,6 @@ } } }, - "required": [ - "ID" - ], "title": "Category (for create)" }, "ODataDemo.Category-update": { @@ -3111,9 +3099,6 @@ } } }, - "required": [ - "ID" - ], "title": "Supplier (for create)" }, "ODataDemo.Supplier-update": { @@ -3300,9 +3285,6 @@ "$ref": "#/definitions/ODataDemo.PersonDetail-create" } }, - "required": [ - "ID" - ], "title": "Person (for create)" }, "ODataDemo.Person-update": { @@ -3374,9 +3356,6 @@ "example": 0 } }, - "required": [ - "ID" - ], "title": "Customer (for create)" }, "ODataDemo.Customer-update": { @@ -3481,9 +3460,6 @@ "example": 3.14 } }, - "required": [ - "ID" - ], "title": "Employee (for create)" }, "ODataDemo.Employee-update": { @@ -3586,9 +3562,6 @@ "$ref": "#/definitions/ODataDemo.Person-create" } }, - "required": [ - "PersonID" - ], "title": "PersonDetail (for create)" }, "ODataDemo.PersonDetail-update": { @@ -3668,9 +3641,6 @@ "$ref": "#/definitions/ODataDemo.FeaturedProduct-create" } }, - "required": [ - "ID" - ], "title": "Advertisement (for create)" }, "ODataDemo.Advertisement-update": { From fc5d02cbc52c0c54fe34dd64f0fc2e59a095a5db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Heiko=20Thei=C3=9Fen?= Date: Wed, 27 Nov 2024 15:44:28 +0100 Subject: [PATCH 2/5] Core.ComputedDefaultValue --- tools/V4-CSDL-to-OpenAPI.xsl | 12 +- .../Northwind-key-as-segment.openapi3.json | 104 ++++++++++++++++++ .../Northwind-key-as-segment.swagger.json | 104 ++++++++++++++++++ tools/tests/annotations-v2.openapi3.json | 6 + tools/tests/annotations-v2.swagger.json | 6 + tools/tests/annotations.openapi3.json | 5 + tools/tests/annotations.swagger.json | 5 + tools/tests/authorization.openapi3.json | 3 + tools/tests/authorization.swagger.json | 3 + tools/tests/containment.openapi3.json | 13 +++ tools/tests/containment.swagger.json | 13 +++ tools/tests/csdl-16.1.openapi3.json | 12 ++ tools/tests/csdl-16.1.swagger.json | 12 ++ tools/tests/descriptions.openapi3.json | 6 + tools/tests/descriptions.swagger.json | 6 + tools/tests/keys-v4.01.openapi3.json | 6 + tools/tests/keys-v4.01.swagger.json | 6 + tools/tests/keys-v4.openapi3.json | 6 + tools/tests/keys-v4.swagger.json | 6 + tools/tests/media-entities-v2.openapi3.json | 3 + tools/tests/media-entities-v2.swagger.json | 3 + tools/tests/odata-rw-v2.openapi3.json | 9 ++ tools/tests/odata-rw-v2.swagger.json | 9 ++ tools/tests/odata-rw-v3.openapi3.json | 30 +++++ tools/tests/odata-rw-v3.swagger.json | 30 +++++ 25 files changed, 413 insertions(+), 5 deletions(-) diff --git a/tools/V4-CSDL-to-OpenAPI.xsl b/tools/V4-CSDL-to-OpenAPI.xsl index 6609d1fe..ca905bb5 100644 --- a/tools/V4-CSDL-to-OpenAPI.xsl +++ b/tools/V4-CSDL-to-OpenAPI.xsl @@ -108,6 +108,8 @@ + + @@ -1490,9 +1492,9 @@ - + + [edm:Annotation[@Term=$coreComputed or @Term=$coreComputedAliased or @Term=$coreComputedDefaultValue or @Term=$coreComputedDefaultValueAliased]]/@Target" /> - + - + (@Name=../edm:Key/edm:PropertyRef/@Name and not(@Name=$read-only or @Name=$computed or concat($qualifiedName,'/',@Name) = $computed-ext or concat($aliasQualifiedName,'/',@Name) = $computed-ext)) + or concat($qualifiedName,'/',@Name)=$mandatory or concat($aliasQualifiedName,'/',@Name)=$mandatory]"> , " diff --git a/tools/tests/Northwind-key-as-segment.openapi3.json b/tools/tests/Northwind-key-as-segment.openapi3.json index e4952202..5ab63942 100644 --- a/tools/tests/Northwind-key-as-segment.openapi3.json +++ b/tools/tests/Northwind-key-as-segment.openapi3.json @@ -10355,6 +10355,9 @@ } } }, + "required": [ + "CategoryID" + ], "title": "Category (for create)" }, "NorthwindModel.Category-update": { @@ -10414,6 +10417,9 @@ } } }, + "required": [ + "CustomerTypeID" + ], "title": "CustomerDemographic (for create)" }, "NorthwindModel.CustomerDemographic-update": { @@ -10566,6 +10572,9 @@ } } }, + "required": [ + "CustomerID" + ], "title": "Customer (for create)" }, "NorthwindModel.Customer-update": { @@ -10861,6 +10870,9 @@ } } }, + "required": [ + "EmployeeID" + ], "title": "Employee (for create)" }, "NorthwindModel.Employee-update": { @@ -11053,6 +11065,10 @@ "$ref": "#/components/schemas/NorthwindModel.Product-create" } }, + "required": [ + "OrderID", + "ProductID" + ], "title": "Order_Detail (for create)" }, "NorthwindModel.Order_Detail-update": { @@ -11328,6 +11344,9 @@ ] } }, + "required": [ + "OrderID" + ], "title": "Order (for create)" }, "NorthwindModel.Order-update": { @@ -11583,6 +11602,9 @@ ] } }, + "required": [ + "ProductID" + ], "title": "Product (for create)" }, "NorthwindModel.Product-update": { @@ -11682,6 +11704,9 @@ } } }, + "required": [ + "RegionID" + ], "title": "Region (for create)" }, "NorthwindModel.Region-update": { @@ -11742,6 +11767,9 @@ } } }, + "required": [ + "ShipperID" + ], "title": "Shipper (for create)" }, "NorthwindModel.Shipper-update": { @@ -11895,6 +11923,9 @@ } } }, + "required": [ + "SupplierID" + ], "title": "Supplier (for create)" }, "NorthwindModel.Supplier-update": { @@ -12008,6 +12039,9 @@ } } }, + "required": [ + "TerritoryID" + ], "title": "Territory (for create)" }, "NorthwindModel.Territory-update": { @@ -12156,6 +12190,12 @@ "maxLength": 15 } }, + "required": [ + "ProductID", + "ProductName", + "Discontinued", + "CategoryName" + ], "title": "Alphabetical_list_of_product (for create)" }, "NorthwindModel.Alphabetical_list_of_product-update": { @@ -12260,6 +12300,9 @@ "example": 0 } }, + "required": [ + "CategoryName" + ], "title": "Category_Sales_for_1997 (for create)" }, "NorthwindModel.Category_Sales_for_1997-update": { @@ -12310,6 +12353,10 @@ "maxLength": 40 } }, + "required": [ + "ProductID", + "ProductName" + ], "title": "Current_Product_List (for create)" }, "NorthwindModel.Current_Product_List-update": { @@ -12362,6 +12409,10 @@ "maxLength": 9 } }, + "required": [ + "CompanyName", + "Relationship" + ], "title": "Customer_and_Suppliers_by_City (for create)" }, "NorthwindModel.Customer_and_Suppliers_by_City-update": { @@ -12720,6 +12771,17 @@ "example": 0 } }, + "required": [ + "CustomerName", + "Salesperson", + "OrderID", + "ShipperName", + "ProductID", + "ProductName", + "UnitPrice", + "Quantity", + "Discount" + ], "title": "Invoice (for create)" }, "NorthwindModel.Invoice-update": { @@ -12966,6 +13028,14 @@ "example": 0 } }, + "required": [ + "OrderID", + "ProductID", + "ProductName", + "UnitPrice", + "Quantity", + "Discount" + ], "title": "Order_Details_Extended (for create)" }, "NorthwindModel.Order_Details_Extended-update": { @@ -13040,6 +13110,9 @@ "example": 0 } }, + "required": [ + "OrderID" + ], "title": "Order_Subtotal (for create)" }, "NorthwindModel.Order_Subtotal-update": { @@ -13298,6 +13371,10 @@ "maxLength": 15 } }, + "required": [ + "OrderID", + "CompanyName" + ], "title": "Orders_Qry (for create)" }, "NorthwindModel.Orders_Qry-update": { @@ -13468,6 +13545,10 @@ "example": 0 } }, + "required": [ + "CategoryName", + "ProductName" + ], "title": "Product_Sales_for_1997 (for create)" }, "NorthwindModel.Product_Sales_for_1997-update": { @@ -13542,6 +13623,9 @@ "example": 0 } }, + "required": [ + "ProductName" + ], "title": "Products_Above_Average_Price (for create)" }, "NorthwindModel.Products_Above_Average_Price-update": { @@ -13618,6 +13702,11 @@ "type": "boolean" } }, + "required": [ + "CategoryName", + "ProductName", + "Discontinued" + ], "title": "Products_by_Category (for create)" }, "NorthwindModel.Products_by_Category-update": { @@ -13702,6 +13791,11 @@ "example": 0 } }, + "required": [ + "CategoryID", + "CategoryName", + "ProductName" + ], "title": "Sales_by_Category (for create)" }, "NorthwindModel.Sales_by_Category-update": { @@ -13796,6 +13890,10 @@ "example": "2017-04-13T15:51:04Z" } }, + "required": [ + "OrderID", + "CompanyName" + ], "title": "Sales_Totals_by_Amount (for create)" }, "NorthwindModel.Sales_Totals_by_Amount-update": { @@ -13888,6 +13986,9 @@ "example": 0 } }, + "required": [ + "OrderID" + ], "title": "Summary_of_Sales_by_Quarter (for create)" }, "NorthwindModel.Summary_of_Sales_by_Quarter-update": { @@ -13980,6 +14081,9 @@ "example": 0 } }, + "required": [ + "OrderID" + ], "title": "Summary_of_Sales_by_Year (for create)" }, "NorthwindModel.Summary_of_Sales_by_Year-update": { diff --git a/tools/tests/Northwind-key-as-segment.swagger.json b/tools/tests/Northwind-key-as-segment.swagger.json index 32c5fdd8..8f3b1061 100644 --- a/tools/tests/Northwind-key-as-segment.swagger.json +++ b/tools/tests/Northwind-key-as-segment.swagger.json @@ -8977,6 +8977,9 @@ } } }, + "required": [ + "CategoryID" + ], "title": "Category (for create)" }, "NorthwindModel.Category-update": { @@ -9047,6 +9050,9 @@ } } }, + "required": [ + "CustomerTypeID" + ], "title": "CustomerDemographic (for create)" }, "NorthwindModel.CustomerDemographic-update": { @@ -9256,6 +9262,9 @@ } } }, + "required": [ + "CustomerID" + ], "title": "Customer (for create)" }, "NorthwindModel.Customer-update": { @@ -9650,6 +9659,9 @@ } } }, + "required": [ + "EmployeeID" + ], "title": "Employee (for create)" }, "NorthwindModel.Employee-update": { @@ -9867,6 +9879,10 @@ "$ref": "#/definitions/NorthwindModel.Product-create" } }, + "required": [ + "OrderID", + "ProductID" + ], "title": "Order_Detail (for create)" }, "NorthwindModel.Order_Detail-update": { @@ -10158,6 +10174,9 @@ "$ref": "#/definitions/NorthwindModel.Shipper-create" } }, + "required": [ + "OrderID" + ], "title": "Order (for create)" }, "NorthwindModel.Order-update": { @@ -10438,6 +10457,9 @@ "$ref": "#/definitions/NorthwindModel.Supplier-create" } }, + "required": [ + "ProductID" + ], "title": "Product (for create)" }, "NorthwindModel.Product-update": { @@ -10546,6 +10568,9 @@ } } }, + "required": [ + "RegionID" + ], "title": "Region (for create)" }, "NorthwindModel.Region-update": { @@ -10612,6 +10637,9 @@ } } }, + "required": [ + "ShipperID" + ], "title": "Shipper (for create)" }, "NorthwindModel.Shipper-update": { @@ -10828,6 +10856,9 @@ } } }, + "required": [ + "SupplierID" + ], "title": "Supplier (for create)" }, "NorthwindModel.Supplier-update": { @@ -10971,6 +11002,9 @@ } } }, + "required": [ + "TerritoryID" + ], "title": "Territory (for create)" }, "NorthwindModel.Territory-update": { @@ -11137,6 +11171,12 @@ "maxLength": 15 } }, + "required": [ + "ProductID", + "ProductName", + "Discontinued", + "CategoryName" + ], "title": "Alphabetical_list_of_product (for create)" }, "NorthwindModel.Alphabetical_list_of_product-update": { @@ -11242,6 +11282,9 @@ "example": 0 } }, + "required": [ + "CategoryName" + ], "title": "Category_Sales_for_1997 (for create)" }, "NorthwindModel.Category_Sales_for_1997-update": { @@ -11288,6 +11331,10 @@ "maxLength": 40 } }, + "required": [ + "ProductID", + "ProductName" + ], "title": "Current_Product_List (for create)" }, "NorthwindModel.Current_Product_List-update": { @@ -11352,6 +11399,10 @@ "maxLength": 9 } }, + "required": [ + "CompanyName", + "Relationship" + ], "title": "Customer_and_Suppliers_by_City (for create)" }, "NorthwindModel.Customer_and_Suppliers_by_City-update": { @@ -11768,6 +11819,17 @@ "example": 0 } }, + "required": [ + "CustomerName", + "Salesperson", + "OrderID", + "ShipperName", + "ProductID", + "ProductName", + "UnitPrice", + "Quantity", + "Discount" + ], "title": "Invoice (for create)" }, "NorthwindModel.Invoice-update": { @@ -12024,6 +12086,14 @@ "example": 0 } }, + "required": [ + "OrderID", + "ProductID", + "ProductName", + "UnitPrice", + "Quantity", + "Discount" + ], "title": "Order_Details_Extended (for create)" }, "NorthwindModel.Order_Details_Extended-update": { @@ -12086,6 +12156,9 @@ "example": 0 } }, + "required": [ + "OrderID" + ], "title": "Order_Subtotal (for create)" }, "NorthwindModel.Order_Subtotal-update": { @@ -12424,6 +12497,10 @@ "example": "string" } }, + "required": [ + "OrderID", + "CompanyName" + ], "title": "Orders_Qry (for create)" }, "NorthwindModel.Orders_Qry-update": { @@ -12628,6 +12705,10 @@ "example": 0 } }, + "required": [ + "CategoryName", + "ProductName" + ], "title": "Product_Sales_for_1997 (for create)" }, "NorthwindModel.Product_Sales_for_1997-update": { @@ -12690,6 +12771,9 @@ "example": 0 } }, + "required": [ + "ProductName" + ], "title": "Products_Above_Average_Price (for create)" }, "NorthwindModel.Products_Above_Average_Price-update": { @@ -12772,6 +12856,11 @@ "type": "boolean" } }, + "required": [ + "CategoryName", + "ProductName", + "Discontinued" + ], "title": "Products_by_Category (for create)" }, "NorthwindModel.Products_by_Category-update": { @@ -12853,6 +12942,11 @@ "example": 0 } }, + "required": [ + "CategoryID", + "CategoryName", + "ProductName" + ], "title": "Sales_by_Category (for create)" }, "NorthwindModel.Sales_by_Category-update": { @@ -12939,6 +13033,10 @@ "example": "2017-04-13T15:51:04Z" } }, + "required": [ + "OrderID", + "CompanyName" + ], "title": "Sales_Totals_by_Amount (for create)" }, "NorthwindModel.Sales_Totals_by_Amount-update": { @@ -13025,6 +13123,9 @@ "example": 0 } }, + "required": [ + "OrderID" + ], "title": "Summary_of_Sales_by_Quarter (for create)" }, "NorthwindModel.Summary_of_Sales_by_Quarter-update": { @@ -13111,6 +13212,9 @@ "example": 0 } }, + "required": [ + "OrderID" + ], "title": "Summary_of_Sales_by_Year (for create)" }, "NorthwindModel.Summary_of_Sales_by_Year-update": { diff --git a/tools/tests/annotations-v2.openapi3.json b/tools/tests/annotations-v2.openapi3.json index d41f05db..6ac8f67c 100644 --- a/tools/tests/annotations-v2.openapi3.json +++ b/tools/tests/annotations-v2.openapi3.json @@ -694,6 +694,9 @@ "example": "Hello World" } }, + "required": [ + "ID" + ], "title": "SinglePartKey (for create)" }, "Supported.Annotations.SinglePartKey-update": { @@ -763,6 +766,9 @@ "example": "/Date(1492098664000)/" } }, + "required": [ + "ID" + ], "title": "PlainDateTimeKey (for create)" }, "Supported.Annotations.PlainDateTimeKey-update": { diff --git a/tools/tests/annotations-v2.swagger.json b/tools/tests/annotations-v2.swagger.json index 8b2396e9..6bfa60a0 100644 --- a/tools/tests/annotations-v2.swagger.json +++ b/tools/tests/annotations-v2.swagger.json @@ -663,6 +663,9 @@ "example": "Hello World" } }, + "required": [ + "ID" + ], "title": "SinglePartKey (for create)" }, "Supported.Annotations.SinglePartKey-update": { @@ -744,6 +747,9 @@ "example": "/Date(1492098664000)/" } }, + "required": [ + "ID" + ], "title": "PlainDateTimeKey (for create)" }, "Supported.Annotations.PlainDateTimeKey-update": { diff --git a/tools/tests/annotations.openapi3.json b/tools/tests/annotations.openapi3.json index 62ed1f32..b76926be 100644 --- a/tools/tests/annotations.openapi3.json +++ b/tools/tests/annotations.openapi3.json @@ -3134,6 +3134,7 @@ } }, "required": [ + "ID", "PatternExt", "AllowedValuesExt" ], @@ -3317,6 +3318,10 @@ "example": "15:51:04" } }, + "required": [ + "One", + "Two" + ], "title": "TwoPartKey (for create)" }, "Supported.Annotations.TwoPartKey-update": { diff --git a/tools/tests/annotations.swagger.json b/tools/tests/annotations.swagger.json index 34e9d793..dce97dda 100644 --- a/tools/tests/annotations.swagger.json +++ b/tools/tests/annotations.swagger.json @@ -2783,6 +2783,7 @@ } }, "required": [ + "ID", "PatternExt", "AllowedValuesExt" ], @@ -2969,6 +2970,10 @@ "example": "15:51:04" } }, + "required": [ + "One", + "Two" + ], "title": "TwoPartKey (for create)" }, "Supported.Annotations.TwoPartKey-update": { diff --git a/tools/tests/authorization.openapi3.json b/tools/tests/authorization.openapi3.json index a7318429..a84af013 100644 --- a/tools/tests/authorization.openapi3.json +++ b/tools/tests/authorization.openapi3.json @@ -304,6 +304,9 @@ "nullable": true } }, + "required": [ + "ID" + ], "title": "Person (for create)" }, "auth.example.Person-update": { diff --git a/tools/tests/authorization.swagger.json b/tools/tests/authorization.swagger.json index 50eeddff..2493234f 100644 --- a/tools/tests/authorization.swagger.json +++ b/tools/tests/authorization.swagger.json @@ -285,6 +285,9 @@ "example": "string" } }, + "required": [ + "ID" + ], "title": "Person (for create)" }, "auth.example.Person-update": { diff --git a/tools/tests/containment.openapi3.json b/tools/tests/containment.openapi3.json index d08b3270..9c28f5f2 100644 --- a/tools/tests/containment.openapi3.json +++ b/tools/tests/containment.openapi3.json @@ -5079,6 +5079,9 @@ } } }, + "required": [ + "ID" + ], "title": "Whole (for create)" }, "Containment.Whole-update": { @@ -5161,6 +5164,9 @@ } } }, + "required": [ + "index" + ], "title": "Part (for create)" }, "Containment.Part-update": { @@ -5193,6 +5199,10 @@ "format": "int32" } }, + "required": [ + "One", + "Two" + ], "title": "SubPart (for create)" }, "Containment.SubPart-update": { @@ -5235,6 +5245,9 @@ } } }, + "required": [ + "Name" + ], "title": "Folder (for create)" }, "Containment.Folder-update": { diff --git a/tools/tests/containment.swagger.json b/tools/tests/containment.swagger.json index 01fcf1de..2466d424 100644 --- a/tools/tests/containment.swagger.json +++ b/tools/tests/containment.swagger.json @@ -4377,6 +4377,9 @@ } } }, + "required": [ + "ID" + ], "title": "Whole (for create)" }, "Containment.Whole-update": { @@ -4452,6 +4455,9 @@ } } }, + "required": [ + "index" + ], "title": "Part (for create)" }, "Containment.Part-update": { @@ -4484,6 +4490,10 @@ "format": "int32" } }, + "required": [ + "One", + "Two" + ], "title": "SubPart (for create)" }, "Containment.SubPart-update": { @@ -4532,6 +4542,9 @@ } } }, + "required": [ + "Name" + ], "title": "Folder (for create)" }, "Containment.Folder-update": { diff --git a/tools/tests/csdl-16.1.openapi3.json b/tools/tests/csdl-16.1.openapi3.json index 5b5f5df3..ce5a29d6 100644 --- a/tools/tests/csdl-16.1.openapi3.json +++ b/tools/tests/csdl-16.1.openapi3.json @@ -2043,6 +2043,9 @@ ] } }, + "required": [ + "ID" + ], "title": "Product (for create)" }, "ODataDemo.Product-update": { @@ -2127,6 +2130,9 @@ } } }, + "required": [ + "ID" + ], "title": "Category (for create)" }, "ODataDemo.Category-update": { @@ -2188,6 +2194,9 @@ } } }, + "required": [ + "ID" + ], "title": "Supplier (for create)" }, "ODataDemo.Supplier-update": { @@ -2233,6 +2242,9 @@ "nullable": true } }, + "required": [ + "Code" + ], "title": "Country (for create)" }, "ODataDemo.Country-update": { diff --git a/tools/tests/csdl-16.1.swagger.json b/tools/tests/csdl-16.1.swagger.json index 8a1ae4ea..02bef9a7 100644 --- a/tools/tests/csdl-16.1.swagger.json +++ b/tools/tests/csdl-16.1.swagger.json @@ -1796,6 +1796,9 @@ "$ref": "#/definitions/ODataDemo.Supplier-create" } }, + "required": [ + "ID" + ], "title": "Product (for create)" }, "ODataDemo.Product-update": { @@ -1888,6 +1891,9 @@ } } }, + "required": [ + "ID" + ], "title": "Category (for create)" }, "ODataDemo.Category-update": { @@ -1955,6 +1961,9 @@ } } }, + "required": [ + "ID" + ], "title": "Supplier (for create)" }, "ODataDemo.Supplier-update": { @@ -2009,6 +2018,9 @@ "example": "string" } }, + "required": [ + "Code" + ], "title": "Country (for create)" }, "ODataDemo.Country-update": { diff --git a/tools/tests/descriptions.openapi3.json b/tools/tests/descriptions.openapi3.json index 222a2098..3b1672e7 100644 --- a/tools/tests/descriptions.openapi3.json +++ b/tools/tests/descriptions.openapi3.json @@ -3082,6 +3082,9 @@ } } }, + "required": [ + "id" + ], "title": "Entity Type - Description (for create)", "description": "Entity Type - LongDescription" }, @@ -3108,6 +3111,9 @@ "maxLength": 70 } }, + "required": [ + "id" + ], "title": "subEntity (for create)" }, "descriptions.subEntity-update": { diff --git a/tools/tests/descriptions.swagger.json b/tools/tests/descriptions.swagger.json index c10177c8..436f0c1a 100644 --- a/tools/tests/descriptions.swagger.json +++ b/tools/tests/descriptions.swagger.json @@ -2707,6 +2707,9 @@ } } }, + "required": [ + "id" + ], "title": "Entity Type - Description (for create)", "description": "Entity Type - LongDescription" }, @@ -2733,6 +2736,9 @@ "maxLength": 70 } }, + "required": [ + "id" + ], "title": "subEntity (for create)" }, "descriptions.subEntity-update": { diff --git a/tools/tests/keys-v4.01.openapi3.json b/tools/tests/keys-v4.01.openapi3.json index b611bd57..dff6f1a6 100644 --- a/tools/tests/keys-v4.01.openapi3.json +++ b/tools/tests/keys-v4.01.openapi3.json @@ -364,6 +364,12 @@ "example": "P4DT15H51M04S" } }, + "required": [ + "int32", + "timeOfDay", + "boolean", + "duration" + ], "title": "MultiPartKey (for create)" }, "KeyTypes.MultiPartKey-update": { diff --git a/tools/tests/keys-v4.01.swagger.json b/tools/tests/keys-v4.01.swagger.json index 567e4313..73b2f91e 100644 --- a/tools/tests/keys-v4.01.swagger.json +++ b/tools/tests/keys-v4.01.swagger.json @@ -329,6 +329,12 @@ "example": "P4DT15H51M04S" } }, + "required": [ + "int32", + "timeOfDay", + "boolean", + "duration" + ], "title": "MultiPartKey (for create)" }, "KeyTypes.MultiPartKey-update": { diff --git a/tools/tests/keys-v4.openapi3.json b/tools/tests/keys-v4.openapi3.json index 54ff9641..bb1ab31b 100644 --- a/tools/tests/keys-v4.openapi3.json +++ b/tools/tests/keys-v4.openapi3.json @@ -364,6 +364,12 @@ "example": "P4DT15H51M04S" } }, + "required": [ + "int32", + "timeOfDay", + "boolean", + "duration" + ], "title": "MultiPartKey (for create)" }, "KeyTypes.MultiPartKey-update": { diff --git a/tools/tests/keys-v4.swagger.json b/tools/tests/keys-v4.swagger.json index 53e7f96d..ccb25193 100644 --- a/tools/tests/keys-v4.swagger.json +++ b/tools/tests/keys-v4.swagger.json @@ -329,6 +329,12 @@ "example": "P4DT15H51M04S" } }, + "required": [ + "int32", + "timeOfDay", + "boolean", + "duration" + ], "title": "MultiPartKey (for create)" }, "KeyTypes.MultiPartKey-update": { diff --git a/tools/tests/media-entities-v2.openapi3.json b/tools/tests/media-entities-v2.openapi3.json index f272ee12..1d3bae2b 100644 --- a/tools/tests/media-entities-v2.openapi3.json +++ b/tools/tests/media-entities-v2.openapi3.json @@ -346,6 +346,9 @@ "format": "int32" } }, + "required": [ + "ID" + ], "title": "MediaType (for create)" }, "Media.Entities.MediaType-update": { diff --git a/tools/tests/media-entities-v2.swagger.json b/tools/tests/media-entities-v2.swagger.json index 3a6e73b0..33eceb0f 100644 --- a/tools/tests/media-entities-v2.swagger.json +++ b/tools/tests/media-entities-v2.swagger.json @@ -319,6 +319,9 @@ "format": "int32" } }, + "required": [ + "ID" + ], "title": "MediaType (for create)" }, "Media.Entities.MediaType-update": { diff --git a/tools/tests/odata-rw-v2.openapi3.json b/tools/tests/odata-rw-v2.openapi3.json index 60acd974..5d53fbc2 100644 --- a/tools/tests/odata-rw-v2.openapi3.json +++ b/tools/tests/odata-rw-v2.openapi3.json @@ -1591,6 +1591,9 @@ ] } }, + "required": [ + "ID" + ], "title": "Product (for create)" }, "ODataDemo.Product-update": { @@ -1674,6 +1677,9 @@ } } }, + "required": [ + "ID" + ], "title": "Category (for create)" }, "ODataDemo.Category-update": { @@ -1748,6 +1754,9 @@ } } }, + "required": [ + "ID" + ], "title": "Supplier (for create)" }, "ODataDemo.Supplier-update": { diff --git a/tools/tests/odata-rw-v2.swagger.json b/tools/tests/odata-rw-v2.swagger.json index 5a6f1dd2..28c4fc51 100644 --- a/tools/tests/odata-rw-v2.swagger.json +++ b/tools/tests/odata-rw-v2.swagger.json @@ -1420,6 +1420,9 @@ "$ref": "#/definitions/ODataDemo.Supplier-create" } }, + "required": [ + "ID" + ], "title": "Product (for create)" }, "ODataDemo.Product-update": { @@ -1517,6 +1520,9 @@ } } }, + "required": [ + "ID" + ], "title": "Category (for create)" }, "ODataDemo.Category-update": { @@ -1600,6 +1606,9 @@ } } }, + "required": [ + "ID" + ], "title": "Supplier (for create)" }, "ODataDemo.Supplier-update": { diff --git a/tools/tests/odata-rw-v3.openapi3.json b/tools/tests/odata-rw-v3.openapi3.json index 1457e97d..5125e875 100644 --- a/tools/tests/odata-rw-v3.openapi3.json +++ b/tools/tests/odata-rw-v3.openapi3.json @@ -3111,6 +3111,9 @@ ] } }, + "required": [ + "ID" + ], "anyOf": [ { "$ref": "#/components/schemas/ODataDemo.FeaturedProduct-create" @@ -3314,6 +3317,9 @@ ] } }, + "required": [ + "ID" + ], "title": "FeaturedProduct (for create)" }, "ODataDemo.FeaturedProduct-update": { @@ -3399,6 +3405,9 @@ ] } }, + "required": [ + "ProductID" + ], "title": "ProductDetail (for create)" }, "ODataDemo.ProductDetail-update": { @@ -3449,6 +3458,9 @@ } } }, + "required": [ + "ID" + ], "title": "Category (for create)" }, "ODataDemo.Category-update": { @@ -3539,6 +3551,9 @@ } } }, + "required": [ + "ID" + ], "title": "Supplier (for create)" }, "ODataDemo.Supplier-update": { @@ -3700,6 +3715,9 @@ ] } }, + "required": [ + "ID" + ], "anyOf": [ { "$ref": "#/components/schemas/ODataDemo.Customer-create" @@ -3798,6 +3816,9 @@ "example": 0 } }, + "required": [ + "ID" + ], "title": "Customer (for create)" }, "ODataDemo.Customer-update": { @@ -3923,6 +3944,9 @@ "example": 3.14 } }, + "required": [ + "ID" + ], "title": "Employee (for create)" }, "ODataDemo.Employee-update": { @@ -4044,6 +4068,9 @@ ] } }, + "required": [ + "PersonID" + ], "title": "PersonDetail (for create)" }, "ODataDemo.PersonDetail-update": { @@ -4129,6 +4156,9 @@ ] } }, + "required": [ + "ID" + ], "title": "Advertisement (for create)" }, "ODataDemo.Advertisement-update": { diff --git a/tools/tests/odata-rw-v3.swagger.json b/tools/tests/odata-rw-v3.swagger.json index 942299ed..9593418d 100644 --- a/tools/tests/odata-rw-v3.swagger.json +++ b/tools/tests/odata-rw-v3.swagger.json @@ -2703,6 +2703,9 @@ "$ref": "#/definitions/ODataDemo.ProductDetail-create" } }, + "required": [ + "ID" + ], "title": "Product (for create)" }, "ODataDemo.Product-update": { @@ -2876,6 +2879,9 @@ "$ref": "#/definitions/ODataDemo.Advertisement-create" } }, + "required": [ + "ID" + ], "title": "FeaturedProduct (for create)" }, "ODataDemo.FeaturedProduct-update": { @@ -2961,6 +2967,9 @@ "$ref": "#/definitions/ODataDemo.Product-create" } }, + "required": [ + "ProductID" + ], "title": "ProductDetail (for create)" }, "ODataDemo.ProductDetail-update": { @@ -3020,6 +3029,9 @@ } } }, + "required": [ + "ID" + ], "title": "Category (for create)" }, "ODataDemo.Category-update": { @@ -3099,6 +3111,9 @@ } } }, + "required": [ + "ID" + ], "title": "Supplier (for create)" }, "ODataDemo.Supplier-update": { @@ -3285,6 +3300,9 @@ "$ref": "#/definitions/ODataDemo.PersonDetail-create" } }, + "required": [ + "ID" + ], "title": "Person (for create)" }, "ODataDemo.Person-update": { @@ -3356,6 +3374,9 @@ "example": 0 } }, + "required": [ + "ID" + ], "title": "Customer (for create)" }, "ODataDemo.Customer-update": { @@ -3460,6 +3481,9 @@ "example": 3.14 } }, + "required": [ + "ID" + ], "title": "Employee (for create)" }, "ODataDemo.Employee-update": { @@ -3562,6 +3586,9 @@ "$ref": "#/definitions/ODataDemo.Person-create" } }, + "required": [ + "PersonID" + ], "title": "PersonDetail (for create)" }, "ODataDemo.PersonDetail-update": { @@ -3641,6 +3668,9 @@ "$ref": "#/definitions/ODataDemo.FeaturedProduct-create" } }, + "required": [ + "ID" + ], "title": "Advertisement (for create)" }, "ODataDemo.Advertisement-update": { From ec2358c7575de079e8ab3b22c3d29b7575cc589e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Heiko=20Thei=C3=9Fen?= Date: Wed, 27 Nov 2024 15:45:35 +0100 Subject: [PATCH 3/5] Whitespace only --- tools/V4-CSDL-to-OpenAPI.xsl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/V4-CSDL-to-OpenAPI.xsl b/tools/V4-CSDL-to-OpenAPI.xsl index ca905bb5..c2f780ef 100644 --- a/tools/V4-CSDL-to-OpenAPI.xsl +++ b/tools/V4-CSDL-to-OpenAPI.xsl @@ -1561,7 +1561,8 @@ + or concat($qualifiedName,'/',@Name)=$mandatory or concat($aliasQualifiedName,'/',@Name)=$mandatory]"> + , " From cbfb3a42adba9a6ca1d618afe37f2089216ed930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Heiko=20Thei=C3=9Fen?= Date: Wed, 27 Nov 2024 16:06:02 +0100 Subject: [PATCH 4/5] Added test case --- tools/V4-CSDL-to-OpenAPI.xsl | 11 ++++++++--- tools/tests/csdl-16.1.openapi3.json | 3 --- tools/tests/csdl-16.1.swagger.json | 3 --- tools/tests/csdl-16.1.xml | 4 +++- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/tools/V4-CSDL-to-OpenAPI.xsl b/tools/V4-CSDL-to-OpenAPI.xsl index c2f780ef..04d5fcff 100644 --- a/tools/V4-CSDL-to-OpenAPI.xsl +++ b/tools/V4-CSDL-to-OpenAPI.xsl @@ -1492,9 +1492,12 @@ - + + [edm:Annotation[@Term=$coreComputed or @Term=$coreComputedAliased]]/@Target" /> + + , diff --git a/tools/tests/csdl-16.1.openapi3.json b/tools/tests/csdl-16.1.openapi3.json index ce5a29d6..9b74f460 100644 --- a/tools/tests/csdl-16.1.openapi3.json +++ b/tools/tests/csdl-16.1.openapi3.json @@ -2043,9 +2043,6 @@ ] } }, - "required": [ - "ID" - ], "title": "Product (for create)" }, "ODataDemo.Product-update": { diff --git a/tools/tests/csdl-16.1.swagger.json b/tools/tests/csdl-16.1.swagger.json index 02bef9a7..998ff9f6 100644 --- a/tools/tests/csdl-16.1.swagger.json +++ b/tools/tests/csdl-16.1.swagger.json @@ -1796,9 +1796,6 @@ "$ref": "#/definitions/ODataDemo.Supplier-create" } }, - "required": [ - "ID" - ], "title": "Product (for create)" }, "ODataDemo.Product-update": { diff --git a/tools/tests/csdl-16.1.xml b/tools/tests/csdl-16.1.xml index dd87d986..035e2609 100644 --- a/tools/tests/csdl-16.1.xml +++ b/tools/tests/csdl-16.1.xml @@ -18,7 +18,9 @@ - + + + From 8ef8f655dccf1b60491e5f05bc6af3f09c6a0c48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Heiko=20Thei=C3=9Fen?= Date: Fri, 29 Nov 2024 10:28:07 +0100 Subject: [PATCH 5/5] FieldControl=Mandatory does not mean required during create --- tools/V4-CSDL-to-OpenAPI.xsl | 16 +++------------- tools/tests/annotations.openapi3.json | 4 +--- tools/tests/annotations.swagger.json | 4 +--- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/tools/V4-CSDL-to-OpenAPI.xsl b/tools/V4-CSDL-to-OpenAPI.xsl index 04d5fcff..c8688088 100644 --- a/tools/V4-CSDL-to-OpenAPI.xsl +++ b/tools/V4-CSDL-to-OpenAPI.xsl @@ -179,10 +179,6 @@ - - - - @@ -1508,11 +1504,6 @@ /edm:EnumMember[.=$corePermissionRead or .=$corePermissionReadAliased]]/@Name" /> - - - @@ -1561,12 +1552,11 @@ - + + or @Name=$computeddefaultvalue or concat($qualifiedName,'/',@Name) = $computeddefaultvalue-ext or concat($aliasQualifiedName,'/',@Name) = $computeddefaultvalue-ext)]"> , diff --git a/tools/tests/annotations.openapi3.json b/tools/tests/annotations.openapi3.json index b76926be..01e0723e 100644 --- a/tools/tests/annotations.openapi3.json +++ b/tools/tests/annotations.openapi3.json @@ -3134,9 +3134,7 @@ } }, "required": [ - "ID", - "PatternExt", - "AllowedValuesExt" + "ID" ], "title": "SinglePartKey (for create)" }, diff --git a/tools/tests/annotations.swagger.json b/tools/tests/annotations.swagger.json index dce97dda..acecabe1 100644 --- a/tools/tests/annotations.swagger.json +++ b/tools/tests/annotations.swagger.json @@ -2783,9 +2783,7 @@ } }, "required": [ - "ID", - "PatternExt", - "AllowedValuesExt" + "ID" ], "title": "SinglePartKey (for create)" },