oxidecomputer / typify

compiler from JSON Schema into idiomatic Rust types
Apache License 2.0
393 stars 57 forks source link

date-time with default panics #539

Closed ahl closed 5 months ago

ahl commented 5 months ago

This schema causes a panic:

    {
      "type": "object",
      "properties": {
        "when": {
          "type": "string",
          "format": "date-time",
          "default": "1970-01-01T00:00:00Z"
        }
      }
    }

"DateTime<chrono" is not a valid Ident

If we remove the default, it's fine. Why? This: https://github.com/oxidecomputer/typify/blob/99ec168e1f4c4dc37bcc79759dd7f4b3d904102f/typify-impl/src/value.rs#L141-L151

Instead we need to do what's done here: https://github.com/oxidecomputer/typify/blob/99ec168e1f4c4dc37bcc79759dd7f4b3d904102f/typify-impl/src/type_entry.rs#L1617-L1623