Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Disallow sparse maps with httpPrefixHeaders #1268

Merged
merged 1 commit into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/source/1.0/spec/core/http-traits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -794,10 +794,11 @@ Trait selector
.. code-block:: none

structure > member
:test(> map > member[id|member=value] > string)
:test(> map :not([trait|sparse]) > member[id|member=value] > string)

The ``httpPrefixHeaders`` trait can be applied to ``structure`` members
that target a ``map`` of ``string``.
that target a ``map`` of ``string``. The targeted map MUST NOT be marked
with the :ref:`sparse-trait`.
Value type
``string`` value that defines the prefix to prepend to each header field
name stored in the targeted map member. For example, given a prefix value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ string httpHeader
@trait(
selector: """
structure > member
:test(> map > member[id|member=value] > string)""",
:test(> map :not([trait|sparse]) > member[id|member=value] > string)""",
structurallyExclusive: "member",
conflicts: [httpLabel, httpQuery, httpHeader, httpPayload, httpResponseCode, httpQueryParams],
breakingChanges: [{change: "any"}]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[ERROR] smithy.example#Foo$headers: Trait `httpPrefixHeaders` cannot be applied to `smithy.example#Foo$headers`. | TraitTarget
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
$version: "1.0"

namespace smithy.example

structure Foo {
@httpPrefixHeaders("")
headers: SparseMap
}

@sparse
map SparseMap {
key: String,
value: String
}