Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

doc: construct properties using protected getters not marked in the docs #26079

Open
plumdog opened this issue Jun 22, 2023 · 1 comment
Open
Labels
@aws-cdk/aws-secretsmanager Related to AWS Secrets Manager documentation This is a problem with documentation. effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Comments

@plumdog
Copy link
Contributor

plumdog commented Jun 22, 2023

Describe the issue

Some examples:

aws-cdk-lib.aws_secretsmanager.Secret, arnForPolicies

Docs: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager.Secret.html#properties (note that arnForPolicies is not marked as protected anywhere in the table)
Specific property (arnForPolicies): not noted in the docs for the property either https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager.Secret.html#arnforpolicies
Code: https://github.com/aws/aws-cdk/blob/v2.85.0/packages/aws-cdk-lib/aws-secretsmanager/lib/secret.ts#L452
Usage:

import * as cdk from 'aws-cdk-lib';
import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager';
const app = new cdk.App();
const stack = new cdk.Stack(app, 'MyStack');
const secret = new secretsmanager.Secret(stack, 'MySecret', {});
secret.arnForPolicies;

Running with npx ts-node gives:

error TS2445: Property 'arnForPolicies' is protected and only accessible within class 'SecretBase' and its subclasses.

6 secret.arnForPolicies;
         ~~~~~~~~~~~~~~

aws-cdk-lib.aws_dynamodb.Table, hasIndex

Docs: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.Table.html#properties (note that hasIndex is not marked as protected anywhere in the table)
Specific property: (hasIndex): not noted in the docs for the property either https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.Table.html#hasindex
Code: https://github.com/aws/aws-cdk/blob/v2.85.0/packages/aws-cdk-lib/aws-dynamodb/lib/table.ts#L1723
Usage:

import * as cdk from 'aws-cdk-lib';
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
const app = new cdk.App();
const stack = new cdk.Stack(app, 'MyStack');
const table = new dynamodb.Table(stack, 'MyTable', {
    partitionKey: {
        name: 'id',
        type: dynamodb.AttributeType.STRING,
    },
});
table.hasIndex;

Running with npx ts-node gives:

error TS2445: Property 'hasIndex' is protected and only accessible within class 'Table' and its subclasses.

11 table.hasIndex;
         ~~~~~~~~

Probably affects all (or many) of https://github.com/search?q=repo%3Aaws%2Faws-cdk+%22protected+get%22&type=code as the root cause appears to be something in the docs generation.

I think it does make sense for any protected properties (and methods) to be included in the docs, as I might rely on them in a subclass I write, but the docs should mark them as protected, or otherwise make it clear that they aren't public.

Links

And probably all of:

@plumdog plumdog added documentation This is a problem with documentation. needs-triage This issue or PR still needs to be triaged. labels Jun 22, 2023
@github-actions github-actions bot added the @aws-cdk/aws-secretsmanager Related to AWS Secrets Manager label Jun 22, 2023
@pahud
Copy link
Contributor

pahud commented Jun 22, 2023

protected get arnForPolicies() {

Yes I agree we should mark it as protected in the doc.

@pahud pahud added p2 feature-request A feature should be added or improved. effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Jun 22, 2023
@pahud pahud changed the title Various modules: construct properties using protected getters not marked in the docs doc: construct properties using protected getters not marked in the docs Jun 22, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
@aws-cdk/aws-secretsmanager Related to AWS Secrets Manager documentation This is a problem with documentation. effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

No branches or pull requests

2 participants