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

Generate something nicer than interfaces when we use disjunctions in Go models. #165

Open
spinillos opened this issue May 25, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@spinillos
Copy link
Member

Given:

myValue: #StructA | #StructB

Generates:

myValue *interface{}

We are loosing the concreteness of the possible values in myValue.

Previously we added fixRawData decorator to remove a lot of autogenerated code that added a lot of functions with a format that we didn't want. It was added to simplify the migration of oapi-codegen library and setting interface{} by default was the easiest solution at this moment.

Removing concreteness forces to generate manual validators and functions to know that the information received on these fields are correct to avoid to save inconsistent information in systems.

We need to evaluate if we can create Validate() error for fields that have these kind of disjuncts and/or functions to retrieve its concrete values.

@spinillos spinillos added the enhancement New feature or request label May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant