godotengine / godot-asset-library

PHP frontend for Godot Engine's asset library
https://godotengine.org/asset-library
MIT License
292 stars 94 forks source link

Use the RFC3339 standard for dates, instead of a custom format #265

Open Frontrider opened 1 year ago

Frontrider commented 1 year ago

Hello!

I'm going off of @fenix-hub 's work on the openapi specifications for godot's api, and I attempted to use it with a java client. https://github.com/godotengine/godot-asset-library/pull/255

The asset library's API uses a custom date format instead of using the internet standard, and it breaks the clients you could produce with that. This is the same format used for HTTP headers and such. https://www.rfc-editor.org/rfc/rfc3339

An example from the standard's documentation: 1985-04-12T23:20:50.52Z Same in godot's format: 1985-04-12 23:20:50

fenix-hub commented 1 year ago

Hi @Frontrider thank you for checking this out. As the issue is addressed in the PR too, I had an interaction with @Calinou some time ago about this. I'm not going to speak on behalf of them, since I don't want to surpass any role and I'm a contributor as any other, but essentially Calinou agreed on changing the modify_date field as it is not used in the Godot Editor (at least, at the time we talked about it), so it shouldn't cause any breaking issue in the Editor's asset library. However I didn't have time to review this change sadly, as it required for me to go in deep in to the project source code and I couldn't. I think that this is something that could be reviewed again after having some confirmations, since things may have been changed in Godot Engine's source code, mostly after recent updates on both 3.x and 4.x versions.

Calinou commented 1 year ago

modify_date is not used anywhere in the Godot codebase on both master and 3.x:

image

Frontrider commented 1 year ago

Thank you, I believe that this would be really good for Godot as the community can start to experiment with how to interact with the asset library, and that is invaluable.

As a reference because it might be useful to others, this is how I got it to work:

        modify_date:
          type: string
          format: date-time
          #vendor extension to support annotations. Adds the data that the json parser needs to understand the format.
          x-setter-extra-annotation: "@com.fasterxml.jackson.annotation.JsonFormat(pattern = \"yyyy-MM-dd HH:mm:ss\")"
          description: >
            The date on which the asset entry was last updated.
            Note that entries can be edited independently of new asset versions being released.

Then I had to set the dateLibrary config to legacy. This changes the way the java generator handles time, it turns into java.util.Date, and that parses with no issues.