Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
7 changes: 7 additions & 0 deletions packages/http-specs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @typespec/http-specs

## 0.1.0-alpha.34

### Bug Fixes

- [#9953](https://github.com/microsoft/typespec/pull/9953) Fix response type of putExtensibleStringValue to include explicit content-type header


## 0.1.0-alpha.33

### Features
Expand Down
2 changes: 1 addition & 1 deletion packages/http-specs/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@typespec/http-specs",
"displayName": "Http Specs",
"version": "0.1.0-alpha.33",
"version": "0.1.0-alpha.34",
"description": "Spec scenarios and mock apis",
"main": "dist/index.js",
"type": "module",
Expand Down
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): {
Comment thread
msyyc marked this conversation as resolved.
Outdated
@header contentType: "application/json";
@body body: ExtensibleString;
};
}
Loading