hashicorp / terraform-plugin-codegen-openapi

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

Remove `stdout` option as default and implement base logging #61

Closed austinvalle closed 11 months ago

austinvalle commented 11 months ago

This PR:

Notes

For OpenApi Specs that have circular references (like my example below with stripe's OAS), you'll now receive a warning like below:

time=2023-09-26T16:08:35.006-04:00 level=WARN msg="circular reference found in OpenAPI spec" circular_ref="payment_intent -> customer -> invoice_setting_customer_setting -> payment_method -> payment_method_card -> payment_method_card_generated_card -> setup_attempt -> api_errors -> payment_intent"

This may result in a later error, but not always, which is why it's not considered a "fail" use-case 😄

austinvalle commented 11 months ago

Will have another PR coming up with more error handling, but the general idea behind the logging will be more descriptive errors to help identify where in the OAS the problem is. Example for an int/string multi-type:

https://github.com/kubernetes/kubernetes/blob/bf1fa0c6691bb3bc6c5c03f900c53ed609e580a4/api/openapi-spec/v3/apis__apps__v1_openapi.json#L879

time=2023-09-28T15:54:35.502-04:00 level=WARN msg="skipping resource schema mapping" resource=deployment_v1 err="[integer, string] - unsupported multi-type schema, attribute cannot be created" oas_property=spec.strategy.rollingUpdate.maxSurge oas_line_number=879
austinvalle commented 11 months ago

Not sure if it'll be an issue, but I bumped to 1.21 to use the stable log/slog. It's not a hard requirement for the logging so I can swap it and downgrade later if it's a problem 👍🏻

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.