Skip to content

Commit 848ec83

Browse files
Add base httpQueryParams trait support
1 parent 48015b0 commit 848ec83

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

smithy-docgen-core/src/main/java/software/amazon/smithy/docgen/core/integrations/BuiltinsIntegration.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import software.amazon.smithy.docgen.core.interceptors.HttpInterceptor;
1919
import software.amazon.smithy.docgen.core.interceptors.HttpLabelInterceptor;
2020
import software.amazon.smithy.docgen.core.interceptors.HttpQueryInterceptor;
21+
import software.amazon.smithy.docgen.core.interceptors.HttpQueryParamsInterceptor;
2122
import software.amazon.smithy.docgen.core.interceptors.IdempotencyInterceptor;
2223
import software.amazon.smithy.docgen.core.interceptors.InternalInterceptor;
2324
import software.amazon.smithy.docgen.core.interceptors.JsonNameInterceptor;
@@ -90,6 +91,7 @@ public List<? extends CodeInterceptor<? extends CodeSection, DocWriter>> interce
9091
new XmlAttributeInterceptor(),
9192
new XmlNameInterceptor(),
9293
new XmlFlattenedInterceptor(),
94+
new HttpQueryParamsInterceptor(),
9395
new HttpQueryInterceptor(),
9496
new HttpLabelInterceptor(),
9597
new HttpInterceptor(),
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package software.amazon.smithy.docgen.core.interceptors;
7+
8+
import software.amazon.smithy.docgen.core.sections.ProtocolSection;
9+
import software.amazon.smithy.docgen.core.writers.DocWriter;
10+
import software.amazon.smithy.model.shapes.ShapeId;
11+
import software.amazon.smithy.model.traits.HttpQueryParamsTrait;
12+
import software.amazon.smithy.utils.SmithyInternalApi;
13+
14+
/**
15+
* Adds information about query bindings from the
16+
* <a href="https://smithy.io/2.0/spec/http-bindings.html#httpqueryparams-trait">
17+
* httpQueryParams trait</a> if the protocol supports it.
18+
*/
19+
@SmithyInternalApi
20+
public final class HttpQueryParamsInterceptor extends ProtocolTraitInterceptor<HttpQueryParamsTrait> {
21+
@Override
22+
protected Class<HttpQueryParamsTrait> getTraitClass() {
23+
return HttpQueryParamsTrait.class;
24+
}
25+
26+
@Override
27+
protected ShapeId getTraitId() {
28+
return HttpQueryParamsTrait.ID;
29+
}
30+
31+
@Override
32+
void write(DocWriter writer, String previousText, ProtocolSection section, HttpQueryParamsTrait trait) {
33+
writer.write("""
34+
Each pair in this map represents an HTTP query parameter.
35+
36+
$L""", previousText);
37+
}
38+
}

0 commit comments

Comments
 (0)