-
Notifications
You must be signed in to change notification settings - Fork 103
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
Skip code generation of data filter functions for shapes that do not contain sensitive fields (recursive) #722
Conversation
b837e38
to
ff59244
Compare
...script-codegen/src/main/java/software/amazon/smithy/typescript/codegen/CommandGenerator.java
Outdated
Show resolved
Hide resolved
* @param model - model context for the shape, containing its related shapes. | ||
* @return whether a sensitive field exists in the shape and its downstream shapes. | ||
*/ | ||
public boolean findsSensitiveData(Shape shape, Model model) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method name is a little confusing. Maybe containsSensitiveData
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to use contains
because the subject of the method is not a container like the collections that typically use that method name. How about findsSensitiveDataIn
for the phrase finder.findsSensitiveDataIn(shape)
?
* a given shape. | ||
*/ | ||
public class SensitiveDataFinder { | ||
private Map<Shape, Boolean> cache = new HashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this cache supposed to work? The public method takes in a model, which could change. I don't think this will work as expected, unless the same model is used every time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the model
to be a constructor parameter.
Adds a recursive check for sensitive fields before generating a sensitive data filter function.
Currently all input/output have their own function even if it does nothing. This removes the no-op functions to reduce the code size.
For diff in JSv3 as an example, see aws/aws-sdk-js-v3#4544
(first commit contains a single client for easier viewing).
~> [trait|sensitive]
, look forSelector.parse
(suggestion from @kstich)