Closed pauly4it closed 8 months ago
This request seems like a good idea! There are definitely limitations to what can be generated (especially early on in the tech preview), so providing this escape hatch can remove a lot of headache 👍🏻
I'm thinking maybe a similar "flattened" style to the overrides, like:
data_sources:
gists:
read:
path: /gists/{gist_id}
method: GET
schema:
ignores:
# Ignore a specific property in an object
- fork_of.forks
# Ignore an entire object and all child properties
- fork_of
# Ignore a specific property at the root
- comments_url
Or in your example:
data_sources:
system:
read:
path: /system
method: GET
schema:
ignores:
- feature_a.customization
- feature_c
I think it's possible that in the future, it might be desired to ignore specific properties just on the request/response body for create/read/update/delete, so maybe will need to consider how best to introduce this configuration 🤔
This has been released with v0.2.0
$ go install github.com/hashicorp/terraform-plugin-codegen-openapi/cmd/tfplugingen-openapi@latest
go: downloading github.com/hashicorp/terraform-plugin-codegen-openapi v0.2.0
Documentation for this functionality can be found on the HashiCorp developer site here: https://developer.hashicorp.com/terraform/plugin/code-generation/openapi-generator#ignoring-oas-properties
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.
Similar to how you can override an attribute description in the generator config, it would be useful to be able to exclude an attribute or sub-attribute from a resource or data source.
Use cases
Example A System resource post request has the following:
For this resource, let's say we don't want to expose the configuration of Feature C via the Terraform provider, and we want to disable Feature A's
customization
because it's an Any Type schema not currently supported by the codegen tool.