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

feat(namespaces): remove namespaces with only a log filter #3823

Merged
merged 2 commits into from
Jul 26, 2022

Conversation

kuhe
Copy link
Contributor

@kuhe kuhe commented Jul 25, 2022

Model Namespaces

Problem: model namespaces containing only a filterSensitiveLog function are generated alongside most model interfaces. This is distracting to readers of the model file, and worse, creates an interruption when users use VSCode’s go-to-definition functionality on model interfaces that have an identical name with these namespaces.

Solution: remove these namespaces and generate the filter functions with unique names.

Because the diff is excessively large, this is what it looks like in general:

Old

models_{n}.ts

export interface ResultType { ... }
export namespace ResultType {
    export const filterSensitiveLog = (obj: any) => { ... }
}

{Name}Command.ts

import { InputType, ResultType } from 'models_{n}';
...
    const handlerExecutionContext: HandlerExecutionContext = {
      logger,
      clientName,
      commandName,
      inputFilterSensitiveLog: InputType.filterSensitiveLog,
      outputFilterSensitiveLog: ResultType.filterSensitiveLog,
    };
...

New

models_{n}.ts

export interface InputType {}
export interface ResultType {}
export type T {}

// aggregated at bottom of file
export const InputTypeFilterSensitiveLog ...
export const ResultTypeFilterSensitiveLog ...
export const TFilterSensitiveLog ...

{Name}Command.ts

import { InputType, InputTypeFilterSensitiveLog ... } from 'models_{n}';

...
    const handlerExecutionContext: HandlerExecutionContext = {
      logger,
      clientName,
      commandName,
      inputFilterSensitiveLog: InputTypeFilterSensitiveLog,
      outputFilterSensitiveLog: ResultTypeFilterSensitiveLog,
    };
...

Testing

CI only

@kuhe kuhe requested a review from a team as a code owner July 25, 2022 20:30
@kuhe kuhe merged commit 33e6822 into aws:main Jul 26, 2022
@kuhe kuhe deleted the feat/namespaces branch July 26, 2022 02:38
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants