Skip to content

[http-specs] Add test cases for additional special words #7431

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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 @@
---
kind: feature
packages:
- "@typespec/http-specs"
---

Add test cases for additional special words in http-specs
250 changes: 250 additions & 0 deletions packages/http-specs/specs/special-words/main.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,85 @@ using Spector;
* Current list of special words
* ```txt
* and
* any
* apiVersion
* arguments
* as
* assert
* async
* await
* boolean
* break
* case
* catch
* class
* client
* const
* constructor
* continue
* date
* debugger
* declare
* def
* default
* del
* delete
* do
* elif
* else
* endpoint
* enum
* error
* except
* exec
* export
* extends
* false
* finally
* for
* from
* function
* get
* global
* if
* implements
* import
* in
* instanceof
* interface
* is
* lambda
* let
* module
* new
* not
* null
* number
* of
* or
* package
* pass
* private
* protected
* public
* raise
* requestoptions
* require
* return
* set
* static
* string
* super
* switch
* symbol
* this
* throw
* true
* try
* type
* typeof
* var
* void
* while
* with
* yield
Expand Down Expand Up @@ -77,15 +127,65 @@ interface Operations {
@opNameScenario("in") in(): void;
@opNameScenario("is") `is`(): void;
@opNameScenario("lambda") lambda(): void;
@opNameScenario("let") `let`(): void;
@opNameScenario("module") `module`(): void;
@opNameScenario("new") `new`(): void;
@opNameScenario("not") not(): void;
@opNameScenario("null") `null`(): void;
@opNameScenario("number") number(): void;
@opNameScenario("of") of(): void;
@opNameScenario("or") or(): void;
@opNameScenario("package") `package`(): void;
@opNameScenario("pass") pass(): void;
@opNameScenario("private") `private`(): void;
@opNameScenario("protected") `protected`(): void;
@opNameScenario("public") `public`(): void;
@opNameScenario("raise") raise(): void;
@opNameScenario("requestoptions") requestoptions(): void;
@opNameScenario("require") require(): void;
@opNameScenario("return") `return`(): void;
@opNameScenario("set") set(): void;
@opNameScenario("static") `static`(): void;
@opNameScenario("string") string(): void;
@opNameScenario("super") `super`(): void;
@opNameScenario("switch") `switch`(): void;
@opNameScenario("symbol") symbol(): void;
@opNameScenario("this") `this`(): void;
@opNameScenario("throw") `throw`(): void;
@opNameScenario("true") `true`(): void;
@opNameScenario("try") try(): void;
@opNameScenario("type") `type`(): void;
@opNameScenario("typeof") `typeof`(): void;
@opNameScenario("var") `var`(): void;
@opNameScenario("void") `void`(): void;
@opNameScenario("while") while(): void;
@opNameScenario("with") `with`(): void;
@opNameScenario("yield") yield(): void;
@opNameScenario("any") `any`(): void;
@opNameScenario("apiVersion") apiVersion(): void;
@opNameScenario("arguments") `arguments`(): void;
@opNameScenario("boolean") boolean(): void;
@opNameScenario("case") `case`(): void;
@opNameScenario("catch") `catch`(): void;
@opNameScenario("client") client(): void;
@opNameScenario("const") `const`(): void;
@opNameScenario("date") date(): void;
@opNameScenario("debugger") `debugger`(): void;
@opNameScenario("declare") `declare`(): void;
@opNameScenario("default") `default`(): void;
@opNameScenario("delete") `delete`(): void;
@opNameScenario("do") `do`(): void;
@opNameScenario("endpoint") endpoint(): void;
@opNameScenario("enum") `enum`(): void;
@opNameScenario("error") error(): void;
@opNameScenario("export") `export`(): void;
@opNameScenario("extends") `extends`(): void;
@opNameScenario("false") `false`(): void;
@opNameScenario("function") `function`(): void;
@opNameScenario("get") get(): void;
@opNameScenario("implements") `implements`(): void;
@opNameScenario("instanceof") `instanceof`(): void;
@opNameScenario("interface") `interface`(): void;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the ci failure for pnpm validate-scenarios.

}

/**
Expand Down Expand Up @@ -126,6 +226,56 @@ interface Parameters {
@paramNameScenario("while") withWhile(@query while: string): void;
@paramNameScenario("with") withWith(@query with: string): void;
@paramNameScenario("yield") withYield(@query yield: string): void;
@paramNameScenario("any") withAny(@query `any`: string): void;
@paramNameScenario("apiVersion") withApiVersion(@query apiVersion: string): void;
@paramNameScenario("arguments") withArguments(@query `arguments`: string): void;
@paramNameScenario("boolean") withBoolean(@query boolean: string): void;
@paramNameScenario("case") withCase(@query `case`: string): void;
@paramNameScenario("catch") withCatch(@query `catch`: string): void;
@paramNameScenario("client") withClient(@query client: string): void;
@paramNameScenario("const") withConst(@query `const`: string): void;
@paramNameScenario("date") withDate(@query date: string): void;
@paramNameScenario("debugger") withDebugger(@query `debugger`: string): void;
@paramNameScenario("declare") withDeclare(@query `declare`: string): void;
@paramNameScenario("default") withDefault(@query `default`: string): void;
@paramNameScenario("delete") withDelete(@query `delete`: string): void;
@paramNameScenario("do") withDo(@query `do`: string): void;
@paramNameScenario("endpoint") withEndpoint(@query endpoint: string): void;
@paramNameScenario("enum") withEnum(@query `enum`: string): void;
@paramNameScenario("error") withError(@query error: string): void;
@paramNameScenario("export") withExport(@query `export`: string): void;
@paramNameScenario("extends") withExtends(@query `extends`: string): void;
@paramNameScenario("false") withFalse(@query `false`: string): void;
@paramNameScenario("function") withFunction(@query `function`: string): void;
@paramNameScenario("get") withGet(@query get: string): void;
@paramNameScenario("implements") withImplements(@query `implements`: string): void;
@paramNameScenario("instanceof") withInstanceof(@query `instanceof`: string): void;
@paramNameScenario("interface") withInterface(@query `interface`: string): void;
@paramNameScenario("let") withLet(@query `let`: string): void;
@paramNameScenario("module") withModule(@query `module`: string): void;
@paramNameScenario("new") withNew(@query `new`: string): void;
@paramNameScenario("null") withNull(@query `null`: string): void;
@paramNameScenario("number") withNumber(@query number: string): void;
@paramNameScenario("of") withOf(@query of: string): void;
@paramNameScenario("package") withPackage(@query `package`: string): void;
@paramNameScenario("private") withPrivate(@query `private`: string): void;
@paramNameScenario("protected") withProtected(@query `protected`: string): void;
@paramNameScenario("public") withPublic(@query `public`: string): void;
@paramNameScenario("requestoptions") withRequestOptions(@query requestoptions: string): void;
@paramNameScenario("require") withRequire(@query require: string): void;
@paramNameScenario("set") withSet(@query set: string): void;
@paramNameScenario("static") withStatic(@query `static`: string): void;
@paramNameScenario("string") withString(@query string: string): void;
@paramNameScenario("super") withSuper(@query `super`: string): void;
@paramNameScenario("switch") withSwitch(@query `switch`: string): void;
@paramNameScenario("symbol") withSymbol(@query symbol: string): void;
@paramNameScenario("this") withThis(@query `this`: string): void;
@paramNameScenario("throw") withThrow(@query `throw`: string): void;
@paramNameScenario("true") withTrue(@query `true`: string): void;
@paramNameScenario("type") withType(@query `type`: string): void;
@paramNameScenario("typeof") withTypeof(@query `typeof`: string): void;
@paramNameScenario("var") withVar(@query `var`: string): void;
@paramNameScenario("void") withVoid(@query `void`: string): void;

// Non keywords but parameters name that could cause conflict with some language standards
@paramNameScenario("cancellationToken") withCancellationToken(
Expand Down Expand Up @@ -174,6 +324,56 @@ namespace Models {
model while is Base;
model `with` is Base;
model yield is Base;
model `any` is Base;
model apiVersion is Base;
model `arguments` is Base;
model boolean is Base;
model `case` is Base;
model `catch` is Base;
model client is Base;
model `const` is Base;
model date is Base;
model `debugger` is Base;
model `declare` is Base;
model `default` is Base;
model `delete` is Base;
model `do` is Base;
model endpoint is Base;
model `enum` is Base;
model error is Base;
model `export` is Base;
model `extends` is Base;
model `false` is Base;
model `function` is Base;
model get is Base;
model `implements` is Base;
model `instanceof` is Base;
model `interface` is Base;
model `let` is Base;
model `module` is Base;
model `new` is Base;
model `null` is Base;
model number is Base;
model of is Base;
model `package` is Base;
model `private` is Base;
model `protected` is Base;
model `public` is Base;
model requestoptions is Base;
model require is Base;
model set is Base;
model `static` is Base;
model string is Base;
model `super` is Base;
model `switch` is Base;
model symbol is Base;
model `this` is Base;
model `throw` is Base;
model `true` is Base;
model `type` is Base;
model `typeof` is Base;
model `var` is Base;
model `void` is Base;

@modelNameScenario("and") op withAnd(@body body: and): void;
@modelNameScenario("as") op withAs(@body body: as): void;
Expand Down Expand Up @@ -208,6 +408,56 @@ namespace Models {
@modelNameScenario("while") op withWhile(@body body: while): void;
@modelNameScenario("with") op withWith(@body body: `with`): void;
@modelNameScenario("yield") op withYield(@body body: yield): void;
@modelNameScenario("any") op withAny(@body body: `any`): void;
@modelNameScenario("apiVersion") op withApiVersion(@body body: apiVersion): void;
@modelNameScenario("arguments") op withArguments(@body body: `arguments`): void;
@modelNameScenario("boolean") op withBoolean(@body body: boolean): void;
@modelNameScenario("case") op withCase(@body body: `case`): void;
@modelNameScenario("catch") op withCatch(@body body: `catch`): void;
@modelNameScenario("client") op withClient(@body body: client): void;
@modelNameScenario("const") op withConst(@body body: `const`): void;
@modelNameScenario("date") op withDate(@body body: date): void;
@modelNameScenario("debugger") op withDebugger(@body body: `debugger`): void;
@modelNameScenario("declare") op withDeclare(@body body: `declare`): void;
@modelNameScenario("default") op withDefault(@body body: `default`): void;
@modelNameScenario("delete") op withDelete(@body body: `delete`): void;
@modelNameScenario("do") op withDo(@body body: `do`): void;
@modelNameScenario("endpoint") op withEndpoint(@body body: endpoint): void;
@modelNameScenario("enum") op withEnum(@body body: `enum`): void;
@modelNameScenario("error") op withError(@body body: error): void;
@modelNameScenario("export") op withExport(@body body: `export`): void;
@modelNameScenario("extends") op withExtends(@body body: `extends`): void;
@modelNameScenario("false") op withFalse(@body body: `false`): void;
@modelNameScenario("function") op withFunction(@body body: `function`): void;
@modelNameScenario("get") op withGet(@body body: get): void;
@modelNameScenario("implements") op withImplements(@body body: `implements`): void;
@modelNameScenario("instanceof") op withInstanceof(@body body: `instanceof`): void;
@modelNameScenario("interface") op withInterface(@body body: `interface`): void;
@modelNameScenario("let") op withLet(@body body: `let`): void;
@modelNameScenario("module") op withModule(@body body: `module`): void;
@modelNameScenario("new") op withNew(@body body: `new`): void;
@modelNameScenario("null") op withNull(@body body: `null`): void;
@modelNameScenario("number") op withNumber(@body body: number): void;
@modelNameScenario("of") op withOf(@body body: of): void;
@modelNameScenario("package") op withPackage(@body body: `package`): void;
@modelNameScenario("private") op withPrivate(@body body: `private`): void;
@modelNameScenario("protected") op withProtected(@body body: `protected`): void;
@modelNameScenario("public") op withPublic(@body body: `public`): void;
@modelNameScenario("requestoptions") op withRequestOptions(@body body: requestoptions): void;
@modelNameScenario("require") op withRequire(@body body: require): void;
@modelNameScenario("set") op withSet(@body body: set): void;
@modelNameScenario("static") op withStatic(@body body: `static`): void;
@modelNameScenario("string") op withString(@body body: string): void;
@modelNameScenario("super") op withSuper(@body body: `super`): void;
@modelNameScenario("switch") op withSwitch(@body body: `switch`): void;
@modelNameScenario("symbol") op withSymbol(@body body: symbol): void;
@modelNameScenario("this") op withThis(@body body: `this`): void;
@modelNameScenario("throw") op withThrow(@body body: `throw`): void;
@modelNameScenario("true") op withTrue(@body body: `true`): void;
@modelNameScenario("type") op withType(@body body: `type`): void;
@modelNameScenario("typeof") op withTypeof(@body body: `typeof`): void;
@modelNameScenario("var") op withVar(@body body: `var`): void;
@modelNameScenario("void") op withVoid(@body body: `void`): void;
}

/**
Expand Down
Loading
Loading