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

format date-time generates invalid identifier #749

Closed
kontsaki opened this issue Mar 26, 2024 · 5 comments
Closed

format date-time generates invalid identifier #749

kontsaki opened this issue Mar 26, 2024 · 5 comments
Assignees

Comments

@kontsaki
Copy link

Hello,

progenitor from main

a property like the following

              "created_at": {
                "type": "string",
                "format": "date-time",
                "readOnly": true,
                "default": "1970-01-01T00:00:00Z"
              }

results in

error: proc macro panicked
 --> src/main.rs:5:1
  |
5 | / generate_api!(
6 | |     spec = "../openapi_spec.json",
7 | |     derives = [schemars::JsonSchema],
8 | | );
  | |_^
  |
  = help: message: `"DateTime<chrono"` is not a valid identifier
@ahl
Copy link
Collaborator

ahl commented Mar 28, 2024

Great bug! Thanks for finding it.

It turns out to be an issue in typify. I've put the details here: oxidecomputer/typify#539

Are you using progenitor from a git reference or the released version on crates.io? If the latter, I can get a new release out.

@kontsaki
Copy link
Author

Thank you for fixing this. I tried both from git main branch and the released crate. I don't have an immediate need for a crate release so it's up to you.

I am trying to make progenitor work with the schema generated by rocket_okapi and it seems they are some incompatibilities. I will try to investigate further.

@ahl
Copy link
Collaborator

ahl commented Mar 29, 2024

Thanks for taking a look. Can you share the schema? It's not surprising to me that there might be constructions that we haven't encountered before.

@ahl ahl self-assigned this Mar 29, 2024
@kontsaki
Copy link
Author

Hey, I will try to find the minimum schema that can reproduce the problem.

This may be related to the following generated schema GREsau/okapi#145, which if I remove progenitor works fine.

@ahl
Copy link
Collaborator

ahl commented Apr 10, 2024

That typify bug has a minimal reproduction. I'm closing this as it should work in progenitor now that we've synced up with the typify git dependency.

@ahl ahl closed this as completed Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants