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

Ability to ignore specific fields in the API #510

Closed
muvaf opened this issue Nov 16, 2020 · 0 comments · Fixed by #501
Closed

Ability to ignore specific fields in the API #510

muvaf opened this issue Nov 16, 2020 · 0 comments · Fixed by #501
Labels
kind/enhancement Categorizes issue or PR as related to existing feature enhancements.

Comments

@muvaf
Copy link
Contributor

muvaf commented Nov 16, 2020

Is your feature request related to a problem?
In generator.yaml, users are able to supply custom configuration that will be taken into account during the generation. When I tried using the following generator.yaml for apigatewayv2.yaml, it didn't have any effect:

ignore:
  shape_names:
    - Name

When I dug into the code, I realized that the code checks whether memberShapeRef.Shape.ShapeName appears in the ignore list or not. However, the value of that field is StringWithLengthBetween1And128. When I let it go through all the top level fields of API CRD, it appears that memberShapeRef.Shape.ShapeName could either be a known type like CorsConfiguration or just a detailed version of string like StringWithLengthBetween1And128 though it's still represented as string in the codebase. There are cases like ECR Repository where the type for RepositoryName is RepositoryName in the json file but that's just a wrap around string similar to StringWithLengthBetween1And128, it's still string in the codebase. However, since there is a differentiating layer there, we're able to target that one specific field by its type in json.

Describe the solution you'd like

What I wanted to achieve is essentially to ignore some of the fields in the API because I'd like to handle them manually. Using ignore.shape_names is sort of abusing it for a purpose it wasn't meant to but I feel like the initial purpose might be same as what I'm aiming for here, i.e. ignoring a field in a struct, rather than a type which might be string.

I thought we can be more precise if we ignored a specific field of a type. For example, CreateApiInput.Name is very specific and not tied to the type of that field. Here is an implementation of this suggestion that keeps shape_name in place, but there is some overlap in the objectives of the two. So, we might want to expand one of them to cover what we want or just keep both separated as they are in the PR.

Describe alternatives you've considered

Another alternative could be to have users give the field path relative to CRD itself. For example, instead of having to specify both CreateApiInput.Name and DeleteApiInput.Name, they can just say .Name, meaning Name field in at the top level spec struct should be ignored. If it's not top level, it could be given as CorsConfiguration.SomeField where CorsConfiguration is a type included in types.go This is kind of trickier to implement but doable.

@muvaf muvaf added the kind/enhancement Categorizes issue or PR as related to existing feature enhancements. label Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Categorizes issue or PR as related to existing feature enhancements.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant