Skip to content

Enums with duplicate values droppedΒ #2782

@njlynch

Description

@njlynch

πŸ› Bug Report

Affected Languages

  • [ ] TypeScript or Javascript
  • [βœ… ] Python
  • [βœ… ] Java
  • [βœ… ] .NET (C#, F#, ...)
  • [❓ ] Go

General Information

  • JSII Version: 1.27.0
  • Platform: OSX

What is the problem?

Originally reported in aws/aws-cdk#14059.

It appears that repeated values (not names) in enums are ignored, leading to dropped names. The example above is for SecretsManager.AttachmentTargetType:

https://github.com/aws/aws-cdk/blob/ad326da3ae392b78dcfc349f246acdf3a389f283/packages/@aws-cdk/aws-secretsmanager/lib/secret.ts#L483-L527

Note that INSTANCE = 'AWS::RDS::DBInstance', and RDS_DB_INSTANCE = 'AWS::RDS::DBInstance', have different names, but the same values.

In the .jsii manifest generated for this module, the newer (non-deprecated) enums are not present:

Manifest:

    "@aws-cdk/aws-secretsmanager.AttachmentTargetType": {
      "assembly": "@aws-cdk/aws-secretsmanager",
      "docs": {
        "stability": "stable",
        "summary": "The type of service or database that's being associated with the secret."
      },
      "fqn": "@aws-cdk/aws-secretsmanager.AttachmentTargetType",
      "kind": "enum",
      "locationInModule": {
        "filename": "lib/secret.ts",
        "line": 483
      },
      "members": [
        {
          "docs": {
            "deprecated": "use RDS_DB_INSTANCE instead",
            "stability": "deprecated",
            "summary": "A database instance."
          },
          "name": "INSTANCE"
        },
        {
          "docs": {
            "deprecated": "use RDS_DB_CLUSTER instead",
            "stability": "deprecated",
            "summary": "A database cluster."
          },
          "name": "CLUSTER"
        },
        {
          "docs": {
            "stability": "stable",
            "summary": "AWS::RDS::DBProxy."
          },
          "name": "RDS_DB_PROXY"
        },
        {
          "docs": {
            "stability": "stable",
            "summary": "AWS::Redshift::Cluster."
          },
          "name": "REDSHIFT_CLUSTER"
        },
        {
          "docs": {
            "stability": "stable",
            "summary": "AWS::DocDB::DBInstance."
          },
          "name": "DOCDB_DB_INSTANCE"
        },
        {
          "docs": {
            "stability": "stable",
            "summary": "AWS::DocDB::DBCluster."
          },
          "name": "DOCDB_DB_CLUSTER"
        }
      ],
      "name": "AttachmentTargetType"
    },

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.effort/mediumMedium work item – a couple days of effortmodule/compilerIssues affecting the JSII compilerp1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions