Skip to content
Closed
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: fix
packages:
- "@typespec/http-specs"
---

Fix response type of putExtensibleStringValue to include explicit content-type header
87 changes: 45 additions & 42 deletions packages/http-specs/specs/special-words/main.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -290,57 +290,60 @@ namespace ModelProperties {
op withList(@body body: ModelWithList): void;
}

/**
* Verify enum member names that are special words using extensible enum (union).
*/
union ExtensibleString {
string,
and: "and",
as: "as",
assert: "assert",
async: "async",
await: "await",
break: "break",
class: "class",
constructor: "constructor",
continue: "continue",
def: "def",
del: "del",
elif: "elif",
`else`: "else",
except: "except",
exec: "exec",
finally: "finally",
for: "for",
from: "from",
global: "global",
`if`: "if",
`import`: "import",
in: "in",
`is`: "is",
lambda: "lambda",
not: "not",
or: "or",
pass: "pass",
raise: "raise",
`return`: "return",
try: "try",
while: "while",
with: "with",
yield: "yield",
}

/**
* Verify enum member names that are special words.
*/
@route("/extensible-strings")
interface ExtensibleStrings {
namespace ExtensibleStrings {
/**
* Verify enum member names that are special words using extensible enum (union).
*/
union ExtensibleString {
string,
and: "and",
as: "as",
assert: "assert",
async: "async",
await: "await",
break: "break",
class: "class",
constructor: "constructor",
continue: "continue",
def: "def",
del: "del",
elif: "elif",
`else`: "else",
except: "except",
exec: "exec",
finally: "finally",
for: "for",
from: "from",
global: "global",
`if`: "if",
`import`: "import",
in: "in",
`is`: "is",
lambda: "lambda",
not: "not",
or: "or",
pass: "pass",
raise: "raise",
`return`: "return",
try: "try",
while: "while",
with: "with",
yield: "yield",
}

@scenario
@scenarioDoc("""
Verify that enum members with special word names can be sent and received properly.
Send 'class' and expect the same value back.
""")
@put
@route("/string")
putExtensibleStringValue(@body body: ExtensibleString): ExtensibleString;
op putExtensibleStringValue(@body body: ExtensibleString): {
@header contentType: "application/json";
@body body: ExtensibleString;
};
}
Loading