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

add option for smithy codegen attribution comment in generated files #535

Closed
wants to merge 1 commit into from

Conversation

kuhe
Copy link
Contributor

@kuhe kuhe commented Apr 25, 2022

This is a proposed new codegen option.

  • add withAttribution: boolean default false.
    "plugins": {
        "typescript-codegen": {
            "service": "example.weather#Weather",
            "targetNamespace": "Weather",
            "package": "weather",
            "packageVersion": "0.0.1",
            "withAttribution": true,
            "packageJson": {
                "license": "Apache-2.0"
            }
        }
    }
  • when true, calls to TypeScriptWriter::write will note down the caller class and allow a comment to be added at the head of generated files.

Top of Weather.ts:

// smithy-codegen: ServiceAggregatedClientGenerator
import ...

Top of WeatherClient.ts:

// smithy-codegen: AddDefaultsModeDependency, AddEventStreamDependency, ServiceBareBonesClientGenerator
import ...
  • The comment has two proposed uses:
    • prevent editing of the file by hand
    • point developers reading the source file back to the responsible generator(s)

@kuhe kuhe added the enhancement New feature or request label Apr 25, 2022
@kuhe kuhe requested review from adamthom-amzn, gosar, JordonPhillips and a team as code owners April 25, 2022 02:36
@kuhe
Copy link
Contributor Author

kuhe commented Apr 25, 2022

line level debugging has been added to the base CodeWriter: smithy-lang/smithy#1198

@kuhe kuhe closed this Apr 27, 2022
@kuhe kuhe deleted the attribution branch April 27, 2022 18:46
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

Successfully merging this pull request may close these issues.

1 participant