This is interesting and infuriating. I have learned that JSON and OpenAPI have different conventions for date formats-pattern. JSON has milliseconds* and OpenAPI does not. IBM BPM/BAW adds to this by the way system data types Date and Time are defined and seemingly different behaviours for exposed automation services and consumed REST services that generate discovered objects.
The Date type has a validation pattern that indicates it will contain only the date portion, but in reality it can contain the time portion as well. Looking at the XML it is a datetime. We have not yet tested how to specify an OpenAPi service with format: date so that the time portion is included; this is not according to standards if the link in my original post is correct. In an EAS, the OpenAPI will say the Date variable for my UCA is a string with format: date and it will gladly accept the JSON string with milliseconds. More generally, a server side script with tw.local.myDate = "2012-04-23T18:25:43.511Z" works just fine, but tw.local.myDate = "2012-04-23T18:25:43Z" will default to midnight.
The Time type also has a validation pattern. Consuming a REST OpenAPI service will discover a Time parameter for format: date-time. Curiosly, using the default value feature for a service variable with a Time parameter will look like autoObject.myTime = new TWDate(). Eeehhh?
*JSON has milliseconds
https://stackoverflow.com/questions/10286204/what-is-the-right-json-date-format------------------------------
Mattias Edling
------------------------------
Original Message:
Sent: Wed January 26, 2022 04:57 AM
From: Mattias Edling
Subject: Date type in discovered business object from REST with OpenAPI?
Asking for a developer colleague, but I am the one who needs it.
We are using the standard REST web service features to get discovered business objects. However it seems there are problems in generating parameters with variable type "Date". The latest I heard was that they could add some format tag "date" or "time" to complement the string in the response, but that this only gave either the date or time portions of the datetime.
I noticed that the system toolkit contains Date and Time business objects that have validation/restriction on top of their XML dateTime type. On the other hand a TWDate or tw.object.Date has both date and time inside of it.
Sorry for the lack of details, but are we missing something obvious? How should the string-which-is-date element in the OpenAPI response schema be defined?
I found this:
https://stackoverflow.com/questions/49379006/what-is-the-correct-way-to-declare-a-date-in-an-openapi-swagger-file
------------------------------
Mattias Edling
------------------------------