aws-sdk-js-v3 icon indicating copy to clipboard operation
aws-sdk-js-v3 copied to clipboard

Generated TypeDoc docs have no name when not using the `aws.api#service` trait with Smithy

Open MasterPtato opened this issue 2 years ago • 1 comments

Describe the bug

This line of code attempts to destructure name from metadataDir (if it exists), but metadataDir is a string.

https://github.com/aws/aws-sdk-js-v3/blob/5ff951f9528249cf0c8883e85455d3273a72f790/packages/service-client-documentation-generator/src/sdk-client-rename-project.ts#L25

Expected Behavior

The service-client-documentation-generator package should fetch the package name correctly.

Current Behavior

The service-client-documentation-generator package sets event.project.name to undefined, resulting in generated documentation that has no title. https://github.com/aws/aws-sdk-js-v3/blob/5ff951f9528249cf0c8883e85455d3273a72f790/packages/service-client-documentation-generator/src/sdk-client-rename-project.ts#L33

Reproduction Steps

I don't believe one is needed, you can clearly tell that destructuring a string isn't correct. I am happy to provide a reproducible repo if requested.

Possible Solution

Replace https://github.com/aws/aws-sdk-js-v3/blob/5ff951f9528249cf0c8883e85455d3273a72f790/packages/service-client-documentation-generator/src/sdk-client-rename-project.ts#L25 With

 const { name } = metadataDir ? JSON.parse(readFileSync(metadataDir).toString()) : {}; 

Additional Information/Context

This occurs when generating a Smithy project (using smithy-typescript-codegen) with a service shape that has no aws.api#service trait.

SDK version used

@aws-sdk/service-client-documentation-generator 3.58.0

Environment details (OS name and version, etc.)

node v16.15.1

MasterPtato avatar Jul 07 '22 18:07 MasterPtato

Hey @MasterPtato thanks for opening this issue, I'll discuss it with the team and open a PR if needed.

ajredniwja avatar Aug 08 '22 15:08 ajredniwja

Hi @MasterPtato,

I wanted to follow up to better understand the issue. service-client-documentation-generator is an internal package meant for use only with AWS SDK for JavaScript v3.

Are you using it directly or proposing a change to our generated docs?

MYoung25 avatar May 03 '23 19:05 MYoung25

@MYoung25

Apologies, it's been a while since I've used Smithy so I may get things wrong.

When using Smithy 1.0 and the typescript-codegen projection, the codegen would include the typedoc package as well as a build:docs command for generating documentation for your generated TypeScript client. The TypeScript codegen also included a typedoc.json config file which configured typedoc to use @aws-sdk/service-client-documentation-generator as a plugin, which is where this issue comes into play. Because I wasn't using aws.api#service for my service shape, @aws-sdk/service-client-documentation-generator wouldn't generate a title for my docs.

MasterPtato avatar May 03 '23 19:05 MasterPtato

I think I'm starting to understand, could you please provide the reproducible repo you mentioned above?

There may be a few things that are causing the root problem, and the repo could help me track down where to start

MYoung25 avatar May 04 '23 19:05 MYoung25

Hi @MasterPtato, I was able to track down some information and will share everything I can with you.

@aws-sdk/service-client-documentation-generator is an internal package and not meant for use outside of AWS SDK for JavaScript v3.

smithy-typescript is moving away from TypeDoc and AWS SDK for JavaScript v3 is moving towards our new documentation. Both are expected to remove @aws-sdk/service-client-documentation-generator and other associated TypeDoc-specific internal packages.

Unfortunately, I don't have a timeline for when these changes will happen. I will leave this issue open under the documentation tag until our new documentation hits General Availability

MYoung25 avatar May 09 '23 21:05 MYoung25

https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/

ajredniwja avatar Sep 29 '23 20:09 ajredniwja

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[bot] avatar Oct 14 '23 00:10 github-actions[bot]