hashicorp / terraform-plugin-codegen-openapi

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

Allow overriding computability + implement for resources/data sources #12

Closed austinvalle closed 1 year ago

austinvalle commented 1 year ago

Closes #11
(Should merge following #10 to see better diffs on the generated filed 👍🏻)

This PR introduces a GlobalSchemaOpts struct and OverrideComputability field that is recursively passed through an OASSchema as it is building resource + data source attributes.

This allows us to override an OAS's required property when it doesn't make sense to check it, like in the case of a GET response body marking fields as required.

If you look at internal/cmd/testdata/github/generated_framework_ir.json in this PR, you can see it now better reflects the actual POST API requirements for a repo, where:

Note

austinvalle commented 1 year ago

Generated IR JSON files are all up to date 👍🏻 - you can now see how many attributes were being incorrectly marked as required 😆

github-actions[bot] commented 3 months ago

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