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

Enum constants not prefixed with type name #1614

Open
adriansuarez opened this issue May 16, 2024 · 0 comments
Open

Enum constants not prefixed with type name #1614

adriansuarez opened this issue May 16, 2024 · 0 comments

Comments

@adriansuarez
Copy link

adriansuarez commented May 16, 2024

After expanding the set of tags (-include-tags) that we generate code for, the type prefix that used to appear on enum constants vanishes, breaking existing code.

The unexpected changes are the following:

diff --git a/openapi/types.go b/openapi/types.go
index 4dbefa8..ae56387 100644
--- a/openapi/types.go
+++ b/openapi/types.go
@@ -55,14 +55,14 @@ const (

 // Defines values for ProjectStatusModelState.
 const (
-       ProjectStatusModelStateAvailable ProjectStatusModelState = "Available"
-       ProjectStatusModelStateCreating  ProjectStatusModelState = "Creating"
-       ProjectStatusModelStateDeleting  ProjectStatusModelState = "Deleting"
-       ProjectStatusModelStateExpired   ProjectStatusModelState = "Expired"
-       ProjectStatusModelStateFailed    ProjectStatusModelState = "Failed"
-       ProjectStatusModelStateModifying ProjectStatusModelState = "Modifying"
-       ProjectStatusModelStateStopped   ProjectStatusModelState = "Stopped"
-       ProjectStatusModelStateStopping  ProjectStatusModelState = "Stopping"
+       Available ProjectStatusModelState = "Available"
+       Creating  ProjectStatusModelState = "Creating"
+       Deleting  ProjectStatusModelState = "Deleting"
+       Expired   ProjectStatusModelState = "Expired"
+       Failed    ProjectStatusModelState = "Failed"
+       Modifying ProjectStatusModelState = "Modifying"
+       Stopped   ProjectStatusModelState = "Stopped"
+       Stopping  ProjectStatusModelState = "Stopping"
 )

 // BackupCreateModel defines model for BackupCreateModel.

This schema was not changed at all. The only change is to -include-tags.

I pushed the following branch in our repo that exposes this issue: https://github.com/nuodb/terraform-provider-nuodbaas/tree/asuarez/enum-constants-issue

The issue can be reproduced by checking out that branch and running make generate.

adriansuarez added a commit to nuodb/terraform-provider-nuodbaas that referenced this issue May 22, 2024
This change adds the backuppolicy resource for managing backup policies
via the NuoDB DBaaS REST API, the backuppolicy data source for obtaining
the state of an existing backup policy, and the backuppolicies data
source for listing existing backup policies.

Other changes:
- Update the set of REST resources and models that we generate Golang
  code for using oapi-codegen, which exposed a bug in oapi-codegen
  (oapi-codegen/oapi-codegen#1614). The
  fix-generated.sh script implements a workaround for that bug.
- Strip ANSI color codes and remove special formatting and line-wrapping
  from Error and Warning messages to allow asserts to check for the
  presence of substrings.
adriansuarez added a commit to nuodb/terraform-provider-nuodbaas that referenced this issue May 23, 2024
This change adds the backuppolicy resource for managing backup policies
via the NuoDB DBaaS REST API, the backuppolicy data source for obtaining
the state of an existing backup policy, and the backuppolicies data
source for listing existing backup policies.

Other changes:
- Update the set of REST resources and models that we generate Golang
  code for using oapi-codegen, which exposed a bug in oapi-codegen
  (oapi-codegen/oapi-codegen#1614). The
  fix-generated.sh script implements a workaround for that bug.
- Strip ANSI color codes and remove special formatting and line-wrapping
  from Error and Warning messages to allow asserts to check for the
  presence of substrings.
- Change the examples tests to only run `terraform validate` on the
  examples, rather than `terraform plan` or `terraform apply`. This
  allows us to test the examples without a server, which avoids
  introducing dependencies on the REST server supporting a particular
  resource or data source.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant