oasis-tcs / odata-openapi

OASIS OData TC: Tools for producing API descriptions for OData services that adhere to the OpenAPI Specification
https://oasis-tcs.github.io/odata-openapi/
Other
193 stars 80 forks source link

Incorrect Handling of sap:display-format="Date" decorator #301

Closed sosl-beep closed 2 months ago

sosl-beep commented 2 months ago

Hi,

Version used is 0.25.4

I found a bug in the logic for converting EDMX files which contain properties with the decorator sap:display-format="Date".

to replicate this EDMX file from SAP can be used. It's for the SalesOrder API which uses OData V2. 2022_FPS_02_OP_API_SALES_ORDER_SRV_0001.txt

Expected behavior is that all properties with type Edm.Datetime gets converted to

"Name": {
  "type": "string",
  "example" "/Date(1492098664000)/",
  "nullable": true
}

What currently happens is that the properties get converted to

"Name": {
  "type": "string",
  "format": "date",
  "example" "2017-04-13",
  "nullable": true
}

If the decorator is removed from the properties then the OpenApi spec is generated correctly.

As a test the correct OpenApi spec should match the one provided by SAP: 2022_FPS_02_OP_API_SALES_ORDER_SRV_0001.json

ralfhandl commented 2 months ago

@sosl-beep This is a bug in the JS-based implementation, whose support for OData V2 is incomplete.

You may want to use the XSLT-based implementation in https://github.com/oasis-tcs/odata-openapi/tree/main/tools, it produces the expected output.

ralfhandl commented 2 months ago

Fixed with version 0.26.0

sosl-beep commented 2 months ago

Hi @ralfhandl,

Thank you very much! Awesome turnaround.