hashicorp / terraform-plugin-codegen-openapi

OpenAPI to Terraform Provider Code Generation Specification
Mozilla Public License 2.0
49 stars 9 forks source link

Consider handling `string-able` multi-types #57

Closed austinvalle closed 10 months ago

austinvalle commented 11 months ago

Currently the only multi-type supported is null + any type, using oneOf, anyOf, or a type array.

A new use-case for multi-types could be supporting string + any primitive, with the result defaulting to StringAttribute, rather than throwing an error.

The kubernetes OpenAPI spec has an example of this: https://github.com/kubernetes/kubernetes/blob/master/api/openapi-spec/v3/apis__apps__v1_openapi.json#L5092-L5102

"io.k8s.apimachinery.pkg.api.resource.Quantity": {
  "oneOf": [
    {
      "type": "string"
    },
    {
      "type": "number"
    }
  ]
}
github-actions[bot] commented 3 months ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.