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

Consider mapping JSON schema date-time format to timetypes.RFC3339 custom type #102

Open
1 task done
austinvalle opened this issue Dec 13, 2023 · 0 comments
Open
1 task done
Labels
enhancement New feature or request

Comments

@austinvalle
Copy link
Member

austinvalle commented Dec 13, 2023

Use Cases or Problem Statement

JSON schema (the backbone of all the request/response body schemas in OpenAPI 3.0/3.1) supports designating a type: string as an RFC3339 string via format: date-time: https://json-schema.org/understanding-json-schema/reference/string#dates-and-times.

Recently, HashiCorp has published terraform-plugin-framework-timetypes, which contains an RFC3339 custom string type, which provides validation and semantic equality handling that is often required for RFC3339 strings. The Provider code specification already supports custom types.

Proposal

For any string types that define a format of date-time, add the timetypes.RFC3339Type type and timetypes.RFC3339 value to the custom type in the outputted provider code spec.

Schema

rfc3339_prop:
  description: RFC3339 date-time string!
  type: string
  format: date-time

IR Attribute

{
  "name": "rfc3339_prop",
  "string": {
    "computed_optional_required": "computed",
    "description": "RFC3339 date-time string!",
    "custom_type": {
      "import": {
        "path": "github.com/hashicorp/terraform-plugin-framework-timetypes/timetypes"
      },
      "type": "timetypes.RFC3339Type",
      "value_type": "timetypes.RFC3339"
    }
  }
}

Additional Information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@austinvalle austinvalle added the enhancement New feature or request label Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant