Skip to content

Commit fa5d3cb

Browse files
Add greedy label info to http trait section
1 parent e0e5d47 commit fa5d3cb

File tree

1 file changed

+7
-2
lines changed
  • smithy-docgen-core/src/main/java/software/amazon/smithy/docgen/core/interceptors

1 file changed

+7
-2
lines changed

smithy-docgen-core/src/main/java/software/amazon/smithy/docgen/core/interceptors/HttpInterceptor.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import software.amazon.smithy.docgen.core.sections.ProtocolSection;
99
import software.amazon.smithy.docgen.core.writers.DocWriter;
10+
import software.amazon.smithy.model.pattern.SmithyPattern.Segment;
1011
import software.amazon.smithy.model.shapes.ShapeId;
1112
import software.amazon.smithy.model.traits.HttpTrait;
1213
import software.amazon.smithy.utils.SmithyInternalApi;
@@ -31,16 +32,20 @@ protected ShapeId getTraitId() {
3132
@Override
3233
void write(DocWriter writer, String previousText, ProtocolSection section, HttpTrait trait) {
3334
writer.putContext("hasLabels", !trait.getUri().getLabels().isEmpty());
35+
writer.putContext("greedyLabel",
36+
trait.getUri().getGreedyLabel().map(Segment::getContent));
3437
writer.write("""
3538
$B $`
3639
3740
$B $`
3841
${?hasLabels}
3942
4043
To resolve the path segment of the URI, replace any segments surrounded with
41-
brackets with the URI-escaped value of the corresponding member.
44+
brackets with the URI-escaped value of the corresponding member.${?greedyLabel} \
45+
When escaping the value of the ${greedyLabel:`} segment, do not escape any \
46+
backslashes ($`).${/greedyLabel}
4247
${/hasLabels}
4348
44-
$L""", "HTTP Method:", trait.getMethod(), "URI:", trait.getUri(), previousText);
49+
$L""", "HTTP Method:", trait.getMethod(), "URI:", trait.getUri(), "/", previousText);
4550
}
4651
}

0 commit comments

Comments
 (0)