[NIFI-2900] fixes timestamps to be ISO 8601 compliant, as it should b…#1136
[NIFI-2900] fixes timestamps to be ISO 8601 compliant, as it should b…#1136simplesteph wants to merge 2 commits intoapache:masterfrom
Conversation
…e because of OpenAPI specs
|
Hey @simplesteph, thanks for the PR! I'm not sure we can merge this in as is. I'm afraid that changing the format of the of pre-existing values (like all time values in this case) could break existing clients. We do have two separate adapters for Admittedly, I'm not super familiar with the OpenAPI spec. Rather than changing these values, would it help if we updated the documentation to better set the expectation of what's being returned? |
|
Hi, I understand the concern. The tests were passing on my end, but maybe something has been broken. Let me explain the rationale:
Looking forward to reading from you |
|
Our use of swagger is simply for generating the documentation. The swagger.json is generated into the target directory and is not made available as part of the released source or convenience binaries. I think the issue here is the inability of Swagger to understand the use of JAXB adapters. These values are String's already as the adapters support (un)marshalling them. I would guess that Swagger is simply reading the type of the property as a I would suggest we update the |
|
That could be a solution, but I believe it's a more complicated one than just keeping the date-time annotation and make the API compliant with the OpenAPI specs. If you create a "Time" class then it could work. I looked and it seems that yes, Swagger doesn't take JAXB adapters into account. I'm still wondering if it wouldn't be simpler and better to just keep it as date-time and update the UI to re-format it if need be. Which clients would be broken by this change? |
|
NiFi follows the semantic versioning guidelines. What your suggesting is changing the meaning of those fields. They are strings that are meant to be human-readable (one with the time and the other with the date and time). If we change them, we could be affecting any existing clients of that API that expect them to be human-readable strings. The clients I'm referring is anyone consuming this API in an existing version of NiFi. As you mentioned, in our case we would need to update the UI (which is a client of this API) to reformat it as necessary. This is not something we would expect others to do in a minor/incremental version change or without somehow versioning the API. As I mentioned earlier, I believe that any field using a JAXB adapter is currently being interpreted incorrectly by Swagger. While it would be nice if Swagger could correctly determine the actual data type (a string in this case and not a date-time) it appears they at least provide a mechanism for setting it explicitly. We should be taking advantage of that. |
|
I think then we need to add Let me know your thoughts |
|
Hey sorry, I was traveling yesterday. I don't see your most recent changes. Can you double check that you've pushed them? Update: |
|
@mcgilman - I would also like to see this REST API change in the next major release. Date localisation should be moved to the front-end, as only the browser knows the user's locale and timezone. Noting your comments above, would you be open to reviewing a pull request which corrects the API to use ISO timestamps, and also introduces |
|
@mike42 - Thanks for checking out Apache NiFi and looking to make improvements here. We just released version 1.0.0 so we don't have another major release scheduled in the immediate future. We could certainly look to update the endpoints to return these new values in addition to the existing ones (which could then be marked as deprecated). Or we could investigate a means for versioning the API so that existing clients wouldn't break and new clients could utilize the new endpoints. Though it may make sense to do this work when we add i18n support throughout the application which will likely require either a major NiFi version change or supporting multiple versions of the REST API concurrently. Regardless what additional work we identify here, I believe the work that was discussed with @simplesteph needs to happen as the documentation is currently misreporting the actual data type of these fields. |
|
Sorry I haven't had the time to work on it just yet... Agree with all the above |
…omply with ISO norms
|
hi @mcgilman , painful commit but it should be good now. The resulting |
|
Thanks @simplesteph! This has been merged to master (without the changes to the TimeAdapter). I've created a JIRA [1] to revisit the entirety of the Rest Api with regards to the OpenApi spec when possible. |
…e because of OpenAPI specs