Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Frontrider opened this issue Dec 20, 2022 · 3 comments
Open

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

Frontrider opened this issue Dec 20, 2022 · 3 comments

Comments

@Frontrider
Copy link

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.
#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
Copy link

fenix-hub commented Dec 20, 2022

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
Copy link
Member

Calinou commented Dec 20, 2022

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

image

@Frontrider
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants