Skip to content

Support @resourceIdentifier tag in HttpLabelTraitValidator #2900

@MintuJ

Description

@MintuJ

cross posting from an internal chat

Hi team,

We are encountering an API Gateway deployment error with our Smithy model:

A sibling ({clusterIdentifier}) of this resource already has a 
variable path part -- only one is allowed

Issue: Our Smithy model has inconsistent path parameter names:

  • Existing operations: /cluster/{identifier}/policy
  • Newly added operations: /cluster/{clusterIdentifier}/stream

We want to maintain clusterIdentifier in our Stream operations for semantic clarity, but Smithy's @httpLabel trait requires input field names to exactly match URI path parameters. This means we can't use:

@http(uri: "/cluster/{identifier}/stream")
input {
    @httpLabel
    @resourceIdentifier("identifier")
    clusterIdentifier: ClusterId  // Incorrect
}

Is there a Smithy pattern or workaround that allows us to to be flexible with field names (clusterIdentifier) while satisfying API Gateway's path parameter consistency requirement?

Thanks in advance!


Models:

Parent Resource:

@arn(template: "cluster/{identifier}")
resource Cluster {
    identifiers: {
        identifier: ClusterId
    }
    properties: {
      // properties
    }
    read: GetCluster
    // operations
    resources: [
        Stream
    ]
}


@readonly
@http(code: 200, method: "GET", uri: "/cluster/{identifier}")
operation GetCluster {
    input := for Cluster {
        @required
        @httpLabel
        $identifier
    }
    output := with [ClusterOutputMixin] {
     // ...
   }
}

Child Resource:

@arn(template: "cluster/{identifier}/stream/{streamIdentifier}")
resource Stream {
    identifiers: {
        identifier: ClusterId
        streamIdentifier: StreamId
    }
    properties: {
     // properties
    }
    read: GetStream
}

@readonly
@http(code: 200, method: "GET", uri: "/cluster/{identifier}/stream/{streamIdentifier}")
operation GetStream {
    input := for Stream {
        @httpLabel
        @required
        @resourceIdentifier("identifier")
        clusterIdentifier: ClusterId

        @httpLabel
        @required
        $streamIdentifier
    }
    output := with [StreamOutputMixin] {
        // ...
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions