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

chore(codegen): include default value comment for service id #4147

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

eduardomourar
Copy link
Contributor

@eduardomourar eduardomourar commented Nov 7, 2022

Issue

N/A

Description

This will include the default value as comments for the service identifier.

Testing

Yes, just locally

Additional context

Related to PR #4139. It will allow us to use that value during the documentation generation as shown here:

private onCreateDeclaration = (_context: Context, reflection: Reflection) => {
const defaultCommentTag = reflection.comment?.getTag("@default") || reflection.comment?.getTag("@defaultValue");
if (isClientModel(reflection) && reflection.name === "serviceId" && defaultCommentTag) {
const defaultValue = defaultCommentTag.content[0]?.text?.replace(/"/g, "");
if (defaultValue && !this.projectName) {
this.projectName = `${defaultValue} Client - ${this.defaultServiceSuffix}`;
}
}
};


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@eduardomourar eduardomourar requested a review from a team as a code owner November 7, 2022 10:50
@eduardomourar eduardomourar force-pushed the chore/include-service-id-default-value branch from affaec6 to 5c72a86 Compare November 7, 2022 10:57
ServiceShape service = settings.getService(model);
String sdkId = service.getTrait(ServiceTrait.class).map(ServiceTrait::getSdkId)
.orElse("");
writer.writeDocs(String.format("Unique service identifier.%n@internal%n@default \"%s\"", sdkId))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you run the codegen (yarn generate-clients) for this and commit it, or want us to do it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that was done in a separate process.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran the generate-clients script now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i reverted the clients update in order to get this merged

@eduardomourar eduardomourar force-pushed the chore/include-service-id-default-value branch from 489c08a to 7b06531 Compare January 31, 2023 20:42
@eduardomourar eduardomourar force-pushed the chore/include-service-id-default-value branch from 7b06531 to 226403b Compare January 31, 2023 20:47
@eduardomourar eduardomourar force-pushed the chore/include-service-id-default-value branch from 226403b to 51a6964 Compare March 6, 2023 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants