@typespec/http-specs 0.37.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -0
- package/LICENSE +21 -0
- package/README.md +36 -0
- package/assets/image.jpg +0 -0
- package/assets/image.png +0 -0
- package/dist/specs/authentication/api-key/mockapi.d.ts +3 -0
- package/dist/specs/authentication/api-key/mockapi.d.ts.map +1 -0
- package/dist/specs/authentication/api-key/mockapi.js +45 -0
- package/dist/specs/authentication/api-key/mockapi.js.map +1 -0
- package/dist/specs/authentication/commonapi.d.ts +9 -0
- package/dist/specs/authentication/commonapi.d.ts.map +1 -0
- package/dist/specs/authentication/commonapi.js +19 -0
- package/dist/specs/authentication/commonapi.js.map +1 -0
- package/dist/specs/authentication/http/custom/mockapi.d.ts +3 -0
- package/dist/specs/authentication/http/custom/mockapi.d.ts.map +1 -0
- package/dist/specs/authentication/http/custom/mockapi.js +45 -0
- package/dist/specs/authentication/http/custom/mockapi.js.map +1 -0
- package/dist/specs/authentication/oauth2/mockapi.d.ts +3 -0
- package/dist/specs/authentication/oauth2/mockapi.d.ts.map +1 -0
- package/dist/specs/authentication/oauth2/mockapi.js +42 -0
- package/dist/specs/authentication/oauth2/mockapi.js.map +1 -0
- package/dist/specs/authentication/union/mockapi.d.ts +3 -0
- package/dist/specs/authentication/union/mockapi.d.ts.map +1 -0
- package/dist/specs/authentication/union/mockapi.js +37 -0
- package/dist/specs/authentication/union/mockapi.js.map +1 -0
- package/dist/specs/encode/bytes/mockapi.d.ts +3 -0
- package/dist/specs/encode/bytes/mockapi.d.ts.map +1 -0
- package/dist/specs/encode/bytes/mockapi.js +179 -0
- package/dist/specs/encode/bytes/mockapi.js.map +1 -0
- package/dist/specs/encode/datetime/mockapi.d.ts +3 -0
- package/dist/specs/encode/datetime/mockapi.d.ts.map +1 -0
- package/dist/specs/encode/datetime/mockapi.js +160 -0
- package/dist/specs/encode/datetime/mockapi.js.map +1 -0
- package/dist/specs/encode/duration/mockapi.d.ts +3 -0
- package/dist/specs/encode/duration/mockapi.d.ts.map +1 -0
- package/dist/specs/encode/duration/mockapi.js +116 -0
- package/dist/specs/encode/duration/mockapi.js.map +1 -0
- package/dist/specs/encode/numeric/mockapi.d.ts +3 -0
- package/dist/specs/encode/numeric/mockapi.d.ts.map +1 -0
- package/dist/specs/encode/numeric/mockapi.js +29 -0
- package/dist/specs/encode/numeric/mockapi.js.map +1 -0
- package/dist/specs/helper.d.ts +3 -0
- package/dist/specs/helper.d.ts.map +1 -0
- package/dist/specs/helper.js +7 -0
- package/dist/specs/helper.js.map +1 -0
- package/dist/specs/parameters/basic/mockapi.d.ts +3 -0
- package/dist/specs/parameters/basic/mockapi.d.ts.map +1 -0
- package/dist/specs/parameters/basic/mockapi.js +24 -0
- package/dist/specs/parameters/basic/mockapi.js.map +1 -0
- package/dist/specs/parameters/body-optionality/mockapi.d.ts +3 -0
- package/dist/specs/parameters/body-optionality/mockapi.d.ts.map +1 -0
- package/dist/specs/parameters/body-optionality/mockapi.js +62 -0
- package/dist/specs/parameters/body-optionality/mockapi.js.map +1 -0
- package/dist/specs/parameters/collection-format/mockapi.d.ts +3 -0
- package/dist/specs/parameters/collection-format/mockapi.d.ts.map +1 -0
- package/dist/specs/parameters/collection-format/mockapi.js +106 -0
- package/dist/specs/parameters/collection-format/mockapi.js.map +1 -0
- package/dist/specs/parameters/spread/mockapi.d.ts +3 -0
- package/dist/specs/parameters/spread/mockapi.d.ts.map +1 -0
- package/dist/specs/parameters/spread/mockapi.js +206 -0
- package/dist/specs/parameters/spread/mockapi.js.map +1 -0
- package/dist/specs/payload/json-merge-patch/mockapi.d.ts +40 -0
- package/dist/specs/payload/json-merge-patch/mockapi.d.ts.map +1 -0
- package/dist/specs/payload/json-merge-patch/mockapi.js +141 -0
- package/dist/specs/payload/json-merge-patch/mockapi.js.map +1 -0
- package/dist/specs/payload/media-type/mockapi.d.ts +3 -0
- package/dist/specs/payload/media-type/mockapi.d.ts.map +1 -0
- package/dist/specs/payload/media-type/mockapi.js +84 -0
- package/dist/specs/payload/media-type/mockapi.js.map +1 -0
- package/dist/specs/payload/multipart/mockapi.d.ts +3 -0
- package/dist/specs/payload/multipart/mockapi.d.ts.map +1 -0
- package/dist/specs/payload/multipart/mockapi.js +153 -0
- package/dist/specs/payload/multipart/mockapi.js.map +1 -0
- package/dist/specs/payload/xml/mockapi.d.ts +15 -0
- package/dist/specs/payload/xml/mockapi.d.ts.map +1 -0
- package/dist/specs/payload/xml/mockapi.js +189 -0
- package/dist/specs/payload/xml/mockapi.js.map +1 -0
- package/dist/specs/routes/mockapi.d.ts +3 -0
- package/dist/specs/routes/mockapi.d.ts.map +1 -0
- package/dist/specs/routes/mockapi.js +63 -0
- package/dist/specs/routes/mockapi.js.map +1 -0
- package/dist/specs/serialization/encoded-name/json/mockapi.d.ts +3 -0
- package/dist/specs/serialization/encoded-name/json/mockapi.d.ts.map +1 -0
- package/dist/specs/serialization/encoded-name/json/mockapi.js +32 -0
- package/dist/specs/serialization/encoded-name/json/mockapi.js.map +1 -0
- package/dist/specs/server/endpoint/not-defined/mockapi.d.ts +3 -0
- package/dist/specs/server/endpoint/not-defined/mockapi.d.ts.map +1 -0
- package/dist/specs/server/endpoint/not-defined/mockapi.js +15 -0
- package/dist/specs/server/endpoint/not-defined/mockapi.js.map +1 -0
- package/dist/specs/server/path/multiple/mockapi.d.ts +3 -0
- package/dist/specs/server/path/multiple/mockapi.d.ts.map +1 -0
- package/dist/specs/server/path/multiple/mockapi.js +27 -0
- package/dist/specs/server/path/multiple/mockapi.js.map +1 -0
- package/dist/specs/server/path/single/mockapi.d.ts +3 -0
- package/dist/specs/server/path/single/mockapi.d.ts.map +1 -0
- package/dist/specs/server/path/single/mockapi.js +15 -0
- package/dist/specs/server/path/single/mockapi.js.map +1 -0
- package/dist/specs/server/versions/not-versioned/mockapi.d.ts +3 -0
- package/dist/specs/server/versions/not-versioned/mockapi.d.ts.map +1 -0
- package/dist/specs/server/versions/not-versioned/mockapi.js +46 -0
- package/dist/specs/server/versions/not-versioned/mockapi.js.map +1 -0
- package/dist/specs/server/versions/versioned/mockapi.d.ts +3 -0
- package/dist/specs/server/versions/versioned/mockapi.d.ts.map +1 -0
- package/dist/specs/server/versions/versioned/mockapi.js +47 -0
- package/dist/specs/server/versions/versioned/mockapi.js.map +1 -0
- package/dist/specs/special-headers/conditional-request/mockapi.d.ts +3 -0
- package/dist/specs/special-headers/conditional-request/mockapi.d.ts.map +1 -0
- package/dist/specs/special-headers/conditional-request/mockapi.js +79 -0
- package/dist/specs/special-headers/conditional-request/mockapi.js.map +1 -0
- package/dist/specs/special-headers/repeatability/mockapi.d.ts +3 -0
- package/dist/specs/special-headers/repeatability/mockapi.d.ts.map +1 -0
- package/dist/specs/special-headers/repeatability/mockapi.js +36 -0
- package/dist/specs/special-headers/repeatability/mockapi.js.map +1 -0
- package/dist/specs/special-words/dec.d.ts +22 -0
- package/dist/specs/special-words/dec.d.ts.map +1 -0
- package/dist/specs/special-words/dec.js +37 -0
- package/dist/specs/special-words/dec.js.map +1 -0
- package/dist/specs/special-words/mockapi.d.ts +3 -0
- package/dist/specs/special-words/mockapi.d.ts.map +1 -0
- package/dist/specs/special-words/mockapi.js +246 -0
- package/dist/specs/special-words/mockapi.js.map +1 -0
- package/dist/specs/type/array/mockapi.d.ts +3 -0
- package/dist/specs/type/array/mockapi.d.ts.map +1 -0
- package/dist/specs/type/array/mockapi.js +104 -0
- package/dist/specs/type/array/mockapi.js.map +1 -0
- package/dist/specs/type/dictionary/mockapi.d.ts +3 -0
- package/dist/specs/type/dictionary/mockapi.d.ts.map +1 -0
- package/dist/specs/type/dictionary/mockapi.js +103 -0
- package/dist/specs/type/dictionary/mockapi.js.map +1 -0
- package/dist/specs/type/enum/extensible/mockapi.d.ts +3 -0
- package/dist/specs/type/enum/extensible/mockapi.d.ts.map +1 -0
- package/dist/specs/type/enum/extensible/mockapi.js +46 -0
- package/dist/specs/type/enum/extensible/mockapi.js.map +1 -0
- package/dist/specs/type/enum/fixed/mockapi.d.ts +3 -0
- package/dist/specs/type/enum/fixed/mockapi.d.ts.map +1 -0
- package/dist/specs/type/enum/fixed/mockapi.js +53 -0
- package/dist/specs/type/enum/fixed/mockapi.js.map +1 -0
- package/dist/specs/type/model/empty/mockapi.d.ts +3 -0
- package/dist/specs/type/model/empty/mockapi.d.ts.map +1 -0
- package/dist/specs/type/model/empty/mockapi.js +48 -0
- package/dist/specs/type/model/empty/mockapi.js.map +1 -0
- package/dist/specs/type/model/inheritance/enum-discriminator/mockapi.d.ts +3 -0
- package/dist/specs/type/model/inheritance/enum-discriminator/mockapi.d.ts.map +1 -0
- package/dist/specs/type/model/inheritance/enum-discriminator/mockapi.js +79 -0
- package/dist/specs/type/model/inheritance/enum-discriminator/mockapi.js.map +1 -0
- package/dist/specs/type/model/inheritance/nested-discriminator/mockapi.d.ts +3 -0
- package/dist/specs/type/model/inheritance/nested-discriminator/mockapi.d.ts.map +1 -0
- package/dist/specs/type/model/inheritance/nested-discriminator/mockapi.js +147 -0
- package/dist/specs/type/model/inheritance/nested-discriminator/mockapi.js.map +1 -0
- package/dist/specs/type/model/inheritance/not-discriminated/mockapi.d.ts +3 -0
- package/dist/specs/type/model/inheritance/not-discriminated/mockapi.d.ts.map +1 -0
- package/dist/specs/type/model/inheritance/not-discriminated/mockapi.js +47 -0
- package/dist/specs/type/model/inheritance/not-discriminated/mockapi.js.map +1 -0
- package/dist/specs/type/model/inheritance/recursive/mockapi.d.ts +3 -0
- package/dist/specs/type/model/inheritance/recursive/mockapi.d.ts.map +1 -0
- package/dist/specs/type/model/inheritance/recursive/mockapi.js +47 -0
- package/dist/specs/type/model/inheritance/recursive/mockapi.js.map +1 -0
- package/dist/specs/type/model/inheritance/single-discriminator/mockapi.d.ts +3 -0
- package/dist/specs/type/model/inheritance/single-discriminator/mockapi.d.ts.map +1 -0
- package/dist/specs/type/model/inheritance/single-discriminator/mockapi.js +122 -0
- package/dist/specs/type/model/inheritance/single-discriminator/mockapi.js.map +1 -0
- package/dist/specs/type/model/templated/mockapi.d.ts +3 -0
- package/dist/specs/type/model/templated/mockapi.d.ts.map +1 -0
- package/dist/specs/type/model/templated/mockapi.js +99 -0
- package/dist/specs/type/model/templated/mockapi.js.map +1 -0
- package/dist/specs/type/model/usage/mockapi.d.ts +3 -0
- package/dist/specs/type/model/usage/mockapi.d.ts.map +1 -0
- package/dist/specs/type/model/usage/mockapi.js +52 -0
- package/dist/specs/type/model/usage/mockapi.js.map +1 -0
- package/dist/specs/type/model/visibility/mockapi.d.ts +3 -0
- package/dist/specs/type/model/visibility/mockapi.d.ts.map +1 -0
- package/dist/specs/type/model/visibility/mockapi.js +138 -0
- package/dist/specs/type/model/visibility/mockapi.js.map +1 -0
- package/dist/specs/type/property/additional-properties/mockapi.d.ts +3 -0
- package/dist/specs/type/property/additional-properties/mockapi.d.ts.map +1 -0
- package/dist/specs/type/property/additional-properties/mockapi.js +346 -0
- package/dist/specs/type/property/additional-properties/mockapi.js.map +1 -0
- package/dist/specs/type/property/nullable/mockapi.d.ts +3 -0
- package/dist/specs/type/property/nullable/mockapi.d.ts.map +1 -0
- package/dist/specs/type/property/nullable/mockapi.js +147 -0
- package/dist/specs/type/property/nullable/mockapi.js.map +1 -0
- package/dist/specs/type/property/optionality/mockapi.d.ts +3 -0
- package/dist/specs/type/property/optionality/mockapi.d.ts.map +1 -0
- package/dist/specs/type/property/optionality/mockapi.js +197 -0
- package/dist/specs/type/property/optionality/mockapi.js.map +1 -0
- package/dist/specs/type/property/value-types/mockapi.d.ts +3 -0
- package/dist/specs/type/property/value-types/mockapi.d.ts.map +1 -0
- package/dist/specs/type/property/value-types/mockapi.js +213 -0
- package/dist/specs/type/property/value-types/mockapi.js.map +1 -0
- package/dist/specs/type/scalar/mockapi.d.ts +3 -0
- package/dist/specs/type/scalar/mockapi.d.ts.map +1 -0
- package/dist/specs/type/scalar/mockapi.js +274 -0
- package/dist/specs/type/scalar/mockapi.js.map +1 -0
- package/dist/specs/type/union/mockapi.d.ts +3 -0
- package/dist/specs/type/union/mockapi.d.ts.map +1 -0
- package/dist/specs/type/union/mockapi.js +113 -0
- package/dist/specs/type/union/mockapi.js.map +1 -0
- package/dist/specs/versioning/added/mockapi.d.ts +3 -0
- package/dist/specs/versioning/added/mockapi.d.ts.map +1 -0
- package/dist/specs/versioning/added/mockapi.js +76 -0
- package/dist/specs/versioning/added/mockapi.js.map +1 -0
- package/dist/specs/versioning/madeOptional/mockapi.d.ts +3 -0
- package/dist/specs/versioning/madeOptional/mockapi.d.ts.map +1 -0
- package/dist/specs/versioning/madeOptional/mockapi.js +24 -0
- package/dist/specs/versioning/madeOptional/mockapi.js.map +1 -0
- package/dist/specs/versioning/removed/mockapi.d.ts +3 -0
- package/dist/specs/versioning/removed/mockapi.d.ts.map +1 -0
- package/dist/specs/versioning/removed/mockapi.js +26 -0
- package/dist/specs/versioning/removed/mockapi.js.map +1 -0
- package/dist/specs/versioning/renamedFrom/mockapi.d.ts +3 -0
- package/dist/specs/versioning/renamedFrom/mockapi.d.ts.map +1 -0
- package/dist/specs/versioning/renamedFrom/mockapi.js +53 -0
- package/dist/specs/versioning/renamedFrom/mockapi.js.map +1 -0
- package/dist/specs/versioning/returnTypeChangedFrom/mockapi.d.ts +3 -0
- package/dist/specs/versioning/returnTypeChangedFrom/mockapi.d.ts.map +1 -0
- package/dist/specs/versioning/returnTypeChangedFrom/mockapi.js +25 -0
- package/dist/specs/versioning/returnTypeChangedFrom/mockapi.js.map +1 -0
- package/dist/specs/versioning/typeChangedFrom/mockapi.d.ts +3 -0
- package/dist/specs/versioning/typeChangedFrom/mockapi.d.ts.map +1 -0
- package/dist/specs/versioning/typeChangedFrom/mockapi.js +29 -0
- package/dist/specs/versioning/typeChangedFrom/mockapi.js.map +1 -0
- package/package.json +53 -0
- package/specs/README.md +3 -0
- package/specs/authentication/api-key/main.tsp +39 -0
- package/specs/authentication/api-key/mockapi.ts +47 -0
- package/specs/authentication/commonapi.ts +43 -0
- package/specs/authentication/http/custom/main.tsp +39 -0
- package/specs/authentication/http/custom/mockapi.ts +47 -0
- package/specs/authentication/oauth2/main.tsp +44 -0
- package/specs/authentication/oauth2/mockapi.ts +44 -0
- package/specs/authentication/union/main.tsp +29 -0
- package/specs/authentication/union/mockapi.ts +39 -0
- package/specs/encode/bytes/main.tsp +369 -0
- package/specs/encode/bytes/mockapi.ts +309 -0
- package/specs/encode/datetime/main.tsp +344 -0
- package/specs/encode/datetime/mockapi.ts +274 -0
- package/specs/encode/duration/main.tsp +322 -0
- package/specs/encode/duration/mockapi.ts +204 -0
- package/specs/encode/numeric/main.tsp +71 -0
- package/specs/encode/numeric/mockapi.ts +39 -0
- package/specs/helper.ts +8 -0
- package/specs/parameters/basic/main.tsp +61 -0
- package/specs/parameters/basic/mockapi.ts +29 -0
- package/specs/parameters/body-optionality/main.tsp +63 -0
- package/specs/parameters/body-optionality/mockapi.ts +71 -0
- package/specs/parameters/collection-format/main.tsp +95 -0
- package/specs/parameters/collection-format/mockapi.ts +113 -0
- package/specs/parameters/spread/main.tsp +340 -0
- package/specs/parameters/spread/mockapi.ts +216 -0
- package/specs/payload/json-merge-patch/main.tsp +183 -0
- package/specs/payload/json-merge-patch/mockapi.ts +146 -0
- package/specs/payload/media-type/main.tsp +54 -0
- package/specs/payload/media-type/mockapi.ts +88 -0
- package/specs/payload/multipart/main.tsp +499 -0
- package/specs/payload/multipart/mockapi.ts +226 -0
- package/specs/payload/xml/main.tsp +312 -0
- package/specs/payload/xml/mockapi.ts +244 -0
- package/specs/routes/main.tsp +476 -0
- package/specs/routes/mockapi.ts +158 -0
- package/specs/scratch/.gitignore +3 -0
- package/specs/serialization/encoded-name/json/main.tsp +45 -0
- package/specs/serialization/encoded-name/json/mockapi.ts +34 -0
- package/specs/server/endpoint/not-defined/main.tsp +19 -0
- package/specs/server/endpoint/not-defined/mockapi.ts +16 -0
- package/specs/server/path/multiple/main.tsp +46 -0
- package/specs/server/path/multiple/mockapi.ts +29 -0
- package/specs/server/path/single/main.tsp +23 -0
- package/specs/server/path/single/mockapi.ts +16 -0
- package/specs/server/versions/not-versioned/main.tsp +39 -0
- package/specs/server/versions/not-versioned/mockapi.ts +55 -0
- package/specs/server/versions/versioned/main.tsp +65 -0
- package/specs/server/versions/versioned/mockapi.ts +68 -0
- package/specs/special-headers/conditional-request/main.tsp +89 -0
- package/specs/special-headers/conditional-request/mockapi.ts +83 -0
- package/specs/special-headers/repeatability/main.tsp +39 -0
- package/specs/special-headers/repeatability/mockapi.ts +47 -0
- package/specs/special-words/dec.js +52 -0
- package/specs/special-words/main.tsp +238 -0
- package/specs/special-words/mockapi.ts +407 -0
- package/specs/type/array/main.tsp +132 -0
- package/specs/type/array/mockapi.ts +119 -0
- package/specs/type/dictionary/main.tsp +122 -0
- package/specs/type/dictionary/mockapi.ts +115 -0
- package/specs/type/enum/extensible/main.tsp +64 -0
- package/specs/type/enum/extensible/mockapi.ts +55 -0
- package/specs/type/enum/fixed/main.tsp +60 -0
- package/specs/type/enum/fixed/mockapi.ts +55 -0
- package/specs/type/model/empty/main.tsp +39 -0
- package/specs/type/model/empty/mockapi.ts +51 -0
- package/specs/type/model/inheritance/enum-discriminator/main.tsp +169 -0
- package/specs/type/model/inheritance/enum-discriminator/mockapi.ts +99 -0
- package/specs/type/model/inheritance/nested-discriminator/main.tsp +223 -0
- package/specs/type/model/inheritance/nested-discriminator/mockapi.ts +150 -0
- package/specs/type/model/inheritance/not-discriminated/main.tsp +53 -0
- package/specs/type/model/inheritance/not-discriminated/mockapi.ts +49 -0
- package/specs/type/model/inheritance/recursive/main.tsp +70 -0
- package/specs/type/model/inheritance/recursive/mockapi.ts +48 -0
- package/specs/type/model/inheritance/single-discriminator/main.tsp +171 -0
- package/specs/type/model/inheritance/single-discriminator/mockapi.ts +126 -0
- package/specs/type/model/templated/main.tsp +130 -0
- package/specs/type/model/templated/mockapi.ts +102 -0
- package/specs/type/model/usage/main.tsp +48 -0
- package/specs/type/model/usage/mockapi.ts +56 -0
- package/specs/type/model/visibility/main.tsp +152 -0
- package/specs/type/model/visibility/mockapi.ts +139 -0
- package/specs/type/property/additional-properties/main.tsp +591 -0
- package/specs/type/property/additional-properties/mockapi.ts +477 -0
- package/specs/type/property/nullable/client.tsp +21 -0
- package/specs/type/property/nullable/main.tsp +162 -0
- package/specs/type/property/nullable/mockapi.ts +202 -0
- package/specs/type/property/optionality/main.tsp +258 -0
- package/specs/type/property/optionality/mockapi.ts +308 -0
- package/specs/type/property/value-types/main.tsp +285 -0
- package/specs/type/property/value-types/mockapi.ts +297 -0
- package/specs/type/scalar/main.tsp +164 -0
- package/specs/type/scalar/mockapi.ts +280 -0
- package/specs/type/union/main.tsp +262 -0
- package/specs/type/union/mockapi.ts +137 -0
- package/specs/versioning/added/main.tsp +135 -0
- package/specs/versioning/added/mockapi.ts +79 -0
- package/specs/versioning/madeOptional/main.tsp +64 -0
- package/specs/versioning/madeOptional/mockapi.ts +25 -0
- package/specs/versioning/removed/main.tsp +125 -0
- package/specs/versioning/removed/mockapi.ts +27 -0
- package/specs/versioning/renamedFrom/main.tsp +111 -0
- package/specs/versioning/renamedFrom/mockapi.ts +55 -0
- package/specs/versioning/returnTypeChangedFrom/main.tsp +56 -0
- package/specs/versioning/returnTypeChangedFrom/mockapi.ts +26 -0
- package/specs/versioning/typeChangedFrom/main.tsp +70 -0
- package/specs/versioning/typeChangedFrom/mockapi.ts +30 -0
- package/temp/.tsbuildinfo +1 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.json +11 -0
- package/tspconfig.yaml +2 -0
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
import "@typespec/http";
|
|
2
|
+
import "@typespec/spec-lib";
|
|
3
|
+
|
|
4
|
+
using TypeSpec.Http;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Define scenario in building the http route/uri
|
|
8
|
+
*/
|
|
9
|
+
@scenarioService("/routes")
|
|
10
|
+
namespace Routes;
|
|
11
|
+
|
|
12
|
+
@scenario
|
|
13
|
+
@scenarioDoc("""
|
|
14
|
+
Simple operation at a fixed in an interface
|
|
15
|
+
Expected path: /routes/fixed
|
|
16
|
+
""")
|
|
17
|
+
@route("fixed")
|
|
18
|
+
op fixed(): void;
|
|
19
|
+
|
|
20
|
+
@scenario
|
|
21
|
+
@scenarioDoc("""
|
|
22
|
+
Simple operation at a fixed in an interface
|
|
23
|
+
Expected path: /routes/in-interface/fixed
|
|
24
|
+
""")
|
|
25
|
+
@route("in-interface")
|
|
26
|
+
interface InInterface {
|
|
27
|
+
@route("fixed")
|
|
28
|
+
fixed(): void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@route("path")
|
|
32
|
+
namespace PathParameters {
|
|
33
|
+
@scenario
|
|
34
|
+
@scenarioDoc("""
|
|
35
|
+
Path parameter defined implicitly
|
|
36
|
+
Value: "a"
|
|
37
|
+
Expected path: /routes/path/template-only/a
|
|
38
|
+
""")
|
|
39
|
+
@route("template-only/{param}")
|
|
40
|
+
op templateOnly(param: string): void;
|
|
41
|
+
|
|
42
|
+
@scenario
|
|
43
|
+
@scenarioDoc("""
|
|
44
|
+
Path parameter defined explicitly
|
|
45
|
+
Value: "a"
|
|
46
|
+
Expected path: /routes/path/explicit/a
|
|
47
|
+
""")
|
|
48
|
+
@route("explicit/{param}")
|
|
49
|
+
op explicit(@path param: string): void;
|
|
50
|
+
|
|
51
|
+
@scenario
|
|
52
|
+
@scenarioDoc("""
|
|
53
|
+
Path parameter annotated with @path but not defined explicitly in the route
|
|
54
|
+
Value: "a"
|
|
55
|
+
Expected path: /routes/path/annotation-only/a
|
|
56
|
+
""")
|
|
57
|
+
@route("annotation-only")
|
|
58
|
+
op annotationOnly(@path param: string): void;
|
|
59
|
+
|
|
60
|
+
@route("reserved-expansion")
|
|
61
|
+
namespace ReservedExpansion {
|
|
62
|
+
@scenario
|
|
63
|
+
@scenarioDoc("""
|
|
64
|
+
Defines a path parameter that shouldn't encode reserved characters. It should however still encode the other url characters.
|
|
65
|
+
Param value: "foo/bar baz"
|
|
66
|
+
Expected path: "/routes/path/reserved-expansion/template/foo/bar%20baz"
|
|
67
|
+
""")
|
|
68
|
+
@route("template/{+param}")
|
|
69
|
+
op template(param: string): void;
|
|
70
|
+
|
|
71
|
+
@scenario
|
|
72
|
+
@scenarioDoc("""
|
|
73
|
+
Defines a path parameter that shouldn't encode reserved characters. It should however still encode the other url characters.
|
|
74
|
+
Param value: "foo/bar baz"
|
|
75
|
+
Expected path: "/routes/path/reserved-expansion/annotation/foo/bar%20baz"
|
|
76
|
+
""")
|
|
77
|
+
@route("annotation")
|
|
78
|
+
op annotation(@path(#{ allowReserved: true }) param: string): void;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@route("simple")
|
|
82
|
+
namespace SimpleExpansion {
|
|
83
|
+
@route("standard")
|
|
84
|
+
namespace Standard {
|
|
85
|
+
@scenario
|
|
86
|
+
@scenarioDoc("""
|
|
87
|
+
Test simple expansion with explode: false when passed a primitive value.
|
|
88
|
+
Param value: "a"
|
|
89
|
+
Expected path: /routes/simple/standard/primitivea
|
|
90
|
+
""")
|
|
91
|
+
@route("primitive{param}")
|
|
92
|
+
op primitive(param: string): void;
|
|
93
|
+
|
|
94
|
+
@scenario
|
|
95
|
+
@scenarioDoc("""
|
|
96
|
+
Test simple expansion with explode: false when passed an array value.
|
|
97
|
+
Param value: ["a","b"]
|
|
98
|
+
Expected path: /routes/simple/standard/arraya,b
|
|
99
|
+
""")
|
|
100
|
+
@route("array{param}")
|
|
101
|
+
op array(param: string[]): void;
|
|
102
|
+
|
|
103
|
+
@scenario
|
|
104
|
+
@scenarioDoc("""
|
|
105
|
+
Test simple expansion with explode: false when passed a record value.
|
|
106
|
+
Param value: {a: 1, b: 2}
|
|
107
|
+
Expected path: /routes/simple/standard/recorda,1,b,2
|
|
108
|
+
""")
|
|
109
|
+
@route("record{param}")
|
|
110
|
+
op record(param: Record<int32>): void;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@route("explode")
|
|
114
|
+
namespace Explode {
|
|
115
|
+
@scenario
|
|
116
|
+
@scenarioDoc("""
|
|
117
|
+
Test simple expansion with explode: true when passed a primitive value.
|
|
118
|
+
Param value: "a"
|
|
119
|
+
Expected path: /routes/simple/explode/primitivea
|
|
120
|
+
""")
|
|
121
|
+
@route("primitive{param*}")
|
|
122
|
+
op primitive(param: string): void;
|
|
123
|
+
|
|
124
|
+
@scenario
|
|
125
|
+
@scenarioDoc("""
|
|
126
|
+
Test simple expansion with explode: true when passed an array value.
|
|
127
|
+
Param value: ["a","b"]
|
|
128
|
+
Expected path: /routes/simple/explode/arraya.b
|
|
129
|
+
""")
|
|
130
|
+
@route("array{param*}")
|
|
131
|
+
op array(param: string[]): void;
|
|
132
|
+
|
|
133
|
+
@scenario
|
|
134
|
+
@scenarioDoc("""
|
|
135
|
+
Test simple expansion with explode: true when passed a record value.
|
|
136
|
+
Param value: {a: 1, b: 2}
|
|
137
|
+
Expected path: /routes/simple/explode/recorda=1,b=2
|
|
138
|
+
""")
|
|
139
|
+
@route("record{param*}")
|
|
140
|
+
op record(param: Record<int32>): void;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
@route("path")
|
|
145
|
+
namespace PathExpansion {
|
|
146
|
+
@route("standard")
|
|
147
|
+
namespace Standard {
|
|
148
|
+
@scenario
|
|
149
|
+
@scenarioDoc("""
|
|
150
|
+
Test path expansion with explode: false when passed a primitive value.
|
|
151
|
+
Param value: "a"
|
|
152
|
+
Expected path: /routes/path/standard/primitive/a
|
|
153
|
+
""")
|
|
154
|
+
@route("primitive{/param}")
|
|
155
|
+
op primitive(param: string): void;
|
|
156
|
+
|
|
157
|
+
@scenario
|
|
158
|
+
@scenarioDoc("""
|
|
159
|
+
Test path expansion with explode: false when passed an array value.
|
|
160
|
+
Param value: ["a","b"]
|
|
161
|
+
Expected path: /routes/path/standard/array/a,b
|
|
162
|
+
""")
|
|
163
|
+
@route("array{/param}")
|
|
164
|
+
op array(param: string[]): void;
|
|
165
|
+
|
|
166
|
+
@scenario
|
|
167
|
+
@scenarioDoc("""
|
|
168
|
+
Test path expansion with explode: false when passed a record value.
|
|
169
|
+
Param value: {a: 1, b: 2}
|
|
170
|
+
Expected path: /routes/path/standard/record/a,1,b,2
|
|
171
|
+
""")
|
|
172
|
+
@route("record{/param}")
|
|
173
|
+
op record(param: Record<int32>): void;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
@route("explode")
|
|
177
|
+
namespace Explode {
|
|
178
|
+
@scenario
|
|
179
|
+
@scenarioDoc("""
|
|
180
|
+
Test path expansion with explode: true when passed a primitive value.
|
|
181
|
+
Param value: "a"
|
|
182
|
+
Expected path: /routes/path/explode/primitive/a
|
|
183
|
+
""")
|
|
184
|
+
@route("primitive{/param*}")
|
|
185
|
+
op primitive(param: string): void;
|
|
186
|
+
|
|
187
|
+
@scenario
|
|
188
|
+
@scenarioDoc("""
|
|
189
|
+
Test path expansion with explode: true when passed an array value.
|
|
190
|
+
Param value: ["a","b"]
|
|
191
|
+
Expected path: /routes/path/explode/array/a/b
|
|
192
|
+
""")
|
|
193
|
+
@route("array{/param*}")
|
|
194
|
+
op array(param: string[]): void;
|
|
195
|
+
|
|
196
|
+
@scenario
|
|
197
|
+
@scenarioDoc("""
|
|
198
|
+
Test path expansion with explode: true when passed a record value.
|
|
199
|
+
Param value: {a: 1, b: 2}
|
|
200
|
+
Expected path: /routes/path/explode/record/a=1/b=2
|
|
201
|
+
""")
|
|
202
|
+
@route("record{/param*}")
|
|
203
|
+
op record(param: Record<int32>): void;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
@route("label")
|
|
208
|
+
namespace LabelExpansion {
|
|
209
|
+
@route("standard")
|
|
210
|
+
namespace Standard {
|
|
211
|
+
@scenario
|
|
212
|
+
@scenarioDoc("""
|
|
213
|
+
Test label expansion with explode: false when passed a primitive value.
|
|
214
|
+
Param value: "a"
|
|
215
|
+
Expected path: /routes/label/standard/primitive.a
|
|
216
|
+
""")
|
|
217
|
+
@route("primitive{.param}")
|
|
218
|
+
op primitive(param: string): void;
|
|
219
|
+
|
|
220
|
+
@scenario
|
|
221
|
+
@scenarioDoc("""
|
|
222
|
+
Test label expansion with explode: false when passed an array value.
|
|
223
|
+
Param value: ["a","b"]
|
|
224
|
+
Expected path: /routes/label/standard/array.a,b
|
|
225
|
+
""")
|
|
226
|
+
@route("array{.param}")
|
|
227
|
+
op array(param: string[]): void;
|
|
228
|
+
|
|
229
|
+
@scenario
|
|
230
|
+
@scenarioDoc("""
|
|
231
|
+
Test label expansion with explode: false when passed a record value.
|
|
232
|
+
Param value: {a: 1, b: 2}
|
|
233
|
+
Expected path: /routes/label/standard/record.a,1,b,2
|
|
234
|
+
""")
|
|
235
|
+
@route("record{.param}")
|
|
236
|
+
op record(param: Record<int32>): void;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
@route("explode")
|
|
240
|
+
namespace Explode {
|
|
241
|
+
@scenario
|
|
242
|
+
@scenarioDoc("""
|
|
243
|
+
Test label expansion with explode: true when passed a primitive value.
|
|
244
|
+
Param value: "a"
|
|
245
|
+
Expected path: /routes/label/explode/primitive.a
|
|
246
|
+
""")
|
|
247
|
+
@route("primitive{.param*}")
|
|
248
|
+
op primitive(param: string): void;
|
|
249
|
+
|
|
250
|
+
@scenario
|
|
251
|
+
@scenarioDoc("""
|
|
252
|
+
Test label expansion with explode: true when passed an array value.
|
|
253
|
+
Param value: ["a","b"]
|
|
254
|
+
Expected path: /routes/label/explode/array.a.b
|
|
255
|
+
""")
|
|
256
|
+
@route("array{.param*}")
|
|
257
|
+
op array(param: string[]): void;
|
|
258
|
+
|
|
259
|
+
@scenario
|
|
260
|
+
@scenarioDoc("""
|
|
261
|
+
Test label expansion with explode: true when passed a record value.
|
|
262
|
+
Param value: {a: 1, b: 2}
|
|
263
|
+
Expected path: /routes/label/explode/record.a=1.b=2
|
|
264
|
+
""")
|
|
265
|
+
@route("record{.param*}")
|
|
266
|
+
op record(param: Record<int32>): void;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
@route("matrix")
|
|
271
|
+
namespace MatrixExpansion {
|
|
272
|
+
@route("standard")
|
|
273
|
+
namespace Standard {
|
|
274
|
+
@scenario
|
|
275
|
+
@scenarioDoc("""
|
|
276
|
+
Test matrix expansion with explode: false when passed a primitive value.
|
|
277
|
+
Param value: "a"
|
|
278
|
+
Expected path: /routes/matrix/standard/primitive;a
|
|
279
|
+
""")
|
|
280
|
+
@route("primitive{;param}")
|
|
281
|
+
op primitive(param: string): void;
|
|
282
|
+
|
|
283
|
+
@scenario
|
|
284
|
+
@scenarioDoc("""
|
|
285
|
+
Test matrix expansion with explode: false when passed an array value.
|
|
286
|
+
Param value: ["a","b"]
|
|
287
|
+
Expected path: /routes/matrix/standard/array;a,b
|
|
288
|
+
""")
|
|
289
|
+
@route("array{;param}")
|
|
290
|
+
op array(param: string[]): void;
|
|
291
|
+
|
|
292
|
+
@scenario
|
|
293
|
+
@scenarioDoc("""
|
|
294
|
+
Test matrix expansion with explode: false when passed a record value.
|
|
295
|
+
Param value: {a: 1, b: 2}
|
|
296
|
+
Expected path: /routes/matrix/standard/record;a,1,b,2
|
|
297
|
+
""")
|
|
298
|
+
@route("record{;param}")
|
|
299
|
+
op record(param: Record<int32>): void;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
@route("explode")
|
|
303
|
+
namespace Explode {
|
|
304
|
+
@scenario
|
|
305
|
+
@scenarioDoc("""
|
|
306
|
+
Test matrix expansion with explode: true when passed a primitive value.
|
|
307
|
+
Param value: "a"
|
|
308
|
+
Expected path: /routes/matrix/explode/primitive;a
|
|
309
|
+
""")
|
|
310
|
+
@route("primitive{;param*}")
|
|
311
|
+
op primitive(param: string): void;
|
|
312
|
+
|
|
313
|
+
@scenario
|
|
314
|
+
@scenarioDoc("""
|
|
315
|
+
Test matrix expansion with explode: true when passed an array value.
|
|
316
|
+
Param value: ["a","b"]
|
|
317
|
+
Expected path: /routes/matrix/explode/array;a.b
|
|
318
|
+
""")
|
|
319
|
+
@route("array{;param*}")
|
|
320
|
+
op array(param: string[]): void;
|
|
321
|
+
|
|
322
|
+
@scenario
|
|
323
|
+
@scenarioDoc("""
|
|
324
|
+
Test matrix expansion with explode: true when passed a record value.
|
|
325
|
+
Param value: {a: 1, b: 2}
|
|
326
|
+
Expected path: /routes/matrix/explode/record;a=1;b=2
|
|
327
|
+
""")
|
|
328
|
+
@route("record{;param*}")
|
|
329
|
+
op record(param: Record<int32>): void;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
@route("query")
|
|
335
|
+
namespace QueryParameters {
|
|
336
|
+
@scenario
|
|
337
|
+
@scenarioDoc("Query parameter defined implicitly")
|
|
338
|
+
@route("template-only{?param}")
|
|
339
|
+
op templateOnly(param: string): void;
|
|
340
|
+
|
|
341
|
+
@scenario
|
|
342
|
+
@scenarioDoc("Query parameter marked with explicit @query")
|
|
343
|
+
@route("explicit{?param}")
|
|
344
|
+
op explicit(@query param: string): void;
|
|
345
|
+
|
|
346
|
+
@scenario
|
|
347
|
+
@scenarioDoc("Query parameter annotated with @query but not defined explicitly in the route")
|
|
348
|
+
@route("annotation-only")
|
|
349
|
+
op annotationOnly(@query param: string): void;
|
|
350
|
+
|
|
351
|
+
@route("query-expansion")
|
|
352
|
+
namespace QueryExpansion {
|
|
353
|
+
@route("standard")
|
|
354
|
+
namespace Standard {
|
|
355
|
+
@scenario
|
|
356
|
+
@scenarioDoc("""
|
|
357
|
+
Test query expansion with explode: false when passed a primitive value.
|
|
358
|
+
Param value: "a"
|
|
359
|
+
Expected path: /routes/query/query-expansion/standard/primitive?param=a
|
|
360
|
+
""")
|
|
361
|
+
@route("primitive{?param}")
|
|
362
|
+
op primitive(param: string): void;
|
|
363
|
+
|
|
364
|
+
@scenario
|
|
365
|
+
@scenarioDoc("""
|
|
366
|
+
Test query expansion with explode: false when passed an array value.
|
|
367
|
+
Param value: ["a","b"]
|
|
368
|
+
Expected path: /routes/query/query-expansion/standard/array?param=a,b
|
|
369
|
+
""")
|
|
370
|
+
@route("array{?param}")
|
|
371
|
+
op array(param: string[]): void;
|
|
372
|
+
|
|
373
|
+
@scenario
|
|
374
|
+
@scenarioDoc("""
|
|
375
|
+
Test query expansion with explode: false when passed a record value.
|
|
376
|
+
Param value: {a: 1, b: 2}
|
|
377
|
+
Expected path: /routes/query/query-expansion/standard/record?param=a,1,b,2
|
|
378
|
+
""")
|
|
379
|
+
@route("record{?param}")
|
|
380
|
+
op record(param: Record<int32>): void;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
@route("explode")
|
|
384
|
+
namespace Explode {
|
|
385
|
+
@scenario
|
|
386
|
+
@scenarioDoc("""
|
|
387
|
+
Test query expansion with explode: true when passed a primitive value.
|
|
388
|
+
Param value: "a"
|
|
389
|
+
Expected path: /routes/query/query-expansion/explode/primitive?param=a
|
|
390
|
+
""")
|
|
391
|
+
@route("primitive{?param*}")
|
|
392
|
+
op primitive(param: string): void;
|
|
393
|
+
|
|
394
|
+
@scenario
|
|
395
|
+
@scenarioDoc("""
|
|
396
|
+
Test query expansion with explode: true when passed an array value.
|
|
397
|
+
Param value: ["a","b"]
|
|
398
|
+
Expected path: /routes/query/query-expansion/explode/array?param=a¶m=b
|
|
399
|
+
""")
|
|
400
|
+
@route("array{?param*}")
|
|
401
|
+
op array(param: string[]): void;
|
|
402
|
+
|
|
403
|
+
@scenario
|
|
404
|
+
@scenarioDoc("""
|
|
405
|
+
Test query expansion with explode: true when passed a record value.
|
|
406
|
+
Param value: {a: 1, b: 2}
|
|
407
|
+
Expected path: /routes/query/query-expansion/explode/record?a=1&b=2
|
|
408
|
+
""")
|
|
409
|
+
@route("record{?param*}")
|
|
410
|
+
op record(param: Record<int32>): void;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
@route("query-continuation")
|
|
415
|
+
namespace QueryContinuation {
|
|
416
|
+
@route("standard")
|
|
417
|
+
namespace Standard {
|
|
418
|
+
@scenario
|
|
419
|
+
@scenarioDoc("""
|
|
420
|
+
Test query continuation expansion with explode: false when passed a primitive value.
|
|
421
|
+
Param value: "a"
|
|
422
|
+
Expected path: /routes/query/query-continuation/standard/primitive?fixed=true¶m=a
|
|
423
|
+
""")
|
|
424
|
+
@route("primitive?fixed=true{¶m}")
|
|
425
|
+
op primitive(param: string): void;
|
|
426
|
+
|
|
427
|
+
@scenario
|
|
428
|
+
@scenarioDoc("""
|
|
429
|
+
Test query continuation expansion with explode: false when passed an array value.
|
|
430
|
+
Param value: ["a","b"]
|
|
431
|
+
Expected path: /routes/query/query-continuation/standard/array?fixed=true¶m=a,b
|
|
432
|
+
""")
|
|
433
|
+
@route("array?fixed=true{¶m}")
|
|
434
|
+
op array(param: string[]): void;
|
|
435
|
+
|
|
436
|
+
@scenario
|
|
437
|
+
@scenarioDoc("""
|
|
438
|
+
Test query continuation expansion with explode: false when passed a record value.
|
|
439
|
+
Param value: {a: 1, b: 2}
|
|
440
|
+
Expected path: /routes/query/query-continuation/standard/record?fixed=true¶m=a,1,b,2
|
|
441
|
+
""")
|
|
442
|
+
@route("record?fixed=true{¶m}")
|
|
443
|
+
op record(param: Record<int32>): void;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
@route("explode")
|
|
447
|
+
namespace Explode {
|
|
448
|
+
@scenario
|
|
449
|
+
@scenarioDoc("""
|
|
450
|
+
Test query continuation expansion with explode: true when passed a primitive value.
|
|
451
|
+
Param value: "a"
|
|
452
|
+
Expected path: /routes/query/query-continuation/explode/primitive?fixed=true¶m=a
|
|
453
|
+
""")
|
|
454
|
+
@route("primitive?fixed=true{¶m*}")
|
|
455
|
+
op primitive(param: string): void;
|
|
456
|
+
|
|
457
|
+
@scenario
|
|
458
|
+
@scenarioDoc("""
|
|
459
|
+
Test query continuation expansion with explode: true when passed an array value.
|
|
460
|
+
Param value: ["a","b"]
|
|
461
|
+
Expected path: /routes/query/query-continuation/explode/array?fixed=true¶m=a¶m=b
|
|
462
|
+
""")
|
|
463
|
+
@route("array?fixed=true{¶m*}")
|
|
464
|
+
op array(param: string[]): void;
|
|
465
|
+
|
|
466
|
+
@scenario
|
|
467
|
+
@scenarioDoc("""
|
|
468
|
+
Test query continuation expansion with explode: true when passed a record value.
|
|
469
|
+
Param value: {a: 1, b: 2}
|
|
470
|
+
Expected path: /routes/query/query-continuation/explode/record?fixed=true&a=1&b=2
|
|
471
|
+
""")
|
|
472
|
+
@route("record?fixed=true{¶m*}")
|
|
473
|
+
op record(param: Record<int32>): void;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { mockapi, passOnSuccess, ScenarioMockApi, ValidationError } from "@typespec/spec-api";
|
|
2
|
+
|
|
3
|
+
export const Scenarios: Record<string, ScenarioMockApi> = {};
|
|
4
|
+
|
|
5
|
+
function defineUri(uri: string) {
|
|
6
|
+
const url = new URL("http://example.com" + uri);
|
|
7
|
+
return passOnSuccess(
|
|
8
|
+
mockapi.get(url.pathname, (req) => {
|
|
9
|
+
for (const [key, value] of url.searchParams.entries()) {
|
|
10
|
+
req.expect.containsQueryParam(key, value);
|
|
11
|
+
}
|
|
12
|
+
for (const param of Object.keys(req.query)) {
|
|
13
|
+
if (!url.searchParams.has(param)) {
|
|
14
|
+
throw new ValidationError(
|
|
15
|
+
`Unexpected query parameter ${param}`,
|
|
16
|
+
undefined,
|
|
17
|
+
req.query[param],
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return { status: 204 };
|
|
22
|
+
}),
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
Scenarios.Routes_InInterface = defineUri("/routes/fixed");
|
|
27
|
+
Scenarios.Routes_fixed = defineUri("/routes/in-interface/fixed");
|
|
28
|
+
|
|
29
|
+
Scenarios.Routes_PathParameters_templateOnly = defineUri("/routes/path/template-only/a");
|
|
30
|
+
Scenarios.Routes_PathParameters_explicit = defineUri("/routes/path/explicit/a");
|
|
31
|
+
Scenarios.Routes_PathParameters_annotationOnly = defineUri("/routes/path/annotation-only/a");
|
|
32
|
+
|
|
33
|
+
Scenarios.Routes_PathParameters_ReservedExpansion_template = defineUri(
|
|
34
|
+
"/routes/path/reserved-expansion/template/foo/bar%20baz",
|
|
35
|
+
);
|
|
36
|
+
Scenarios.Routes_PathParameters_ReservedExpansion_annotation = defineUri(
|
|
37
|
+
"/routes/path/reserved-expansion/annotation/foo/bar%20baz",
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
Scenarios.Routes_PathParameters_SimpleExpansion_Standard_primitive = defineUri(
|
|
41
|
+
"/routes/simple/standard/primitivea",
|
|
42
|
+
);
|
|
43
|
+
Scenarios.Routes_PathParameters_SimpleExpansion_Standard_array = defineUri(
|
|
44
|
+
"/routes/simple/standard/arraya,b",
|
|
45
|
+
);
|
|
46
|
+
Scenarios.Routes_PathParameters_SimpleExpansion_Standard_record = defineUri(
|
|
47
|
+
"/routes/simple/standard/recorda,1,b,2",
|
|
48
|
+
);
|
|
49
|
+
Scenarios.Routes_PathParameters_SimpleExpansion_Explode_primitive = defineUri(
|
|
50
|
+
"/routes/simple/standard/primitivea",
|
|
51
|
+
);
|
|
52
|
+
Scenarios.Routes_PathParameters_SimpleExpansion_Explode_array = defineUri(
|
|
53
|
+
"/routes/simple/standard/arraya,b",
|
|
54
|
+
);
|
|
55
|
+
Scenarios.Routes_PathParameters_SimpleExpansion_Explode_record = defineUri(
|
|
56
|
+
"/routes/simple/standard/recorda=1,b=2",
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
Scenarios.Routes_PathParameters_PathExpansion_Standard_primitive = defineUri(
|
|
60
|
+
"/routes/path/standard/primitive/a",
|
|
61
|
+
);
|
|
62
|
+
Scenarios.Routes_PathParameters_PathExpansion_Standard_array = defineUri(
|
|
63
|
+
"/routes/path/standard/array/a,b",
|
|
64
|
+
);
|
|
65
|
+
Scenarios.Routes_PathParameters_PathExpansion_Standard_record = defineUri(
|
|
66
|
+
"/routes/path/standard/record/a,1,b,2",
|
|
67
|
+
);
|
|
68
|
+
Scenarios.Routes_PathParameters_PathExpansion_Explode_primitive = defineUri(
|
|
69
|
+
"/routes/path/standard/primitive/a",
|
|
70
|
+
);
|
|
71
|
+
Scenarios.Routes_PathParameters_PathExpansion_Explode_array = defineUri(
|
|
72
|
+
"/routes/path/standard/array/a/b",
|
|
73
|
+
);
|
|
74
|
+
Scenarios.Routes_PathParameters_PathExpansion_Explode_record = defineUri(
|
|
75
|
+
"/routes/path/standard/record/a=1/b=2",
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
Scenarios.Routes_PathParameters_LabelExpansion_Standard_primitive = defineUri(
|
|
79
|
+
"/routes/label/standard/primitive.a",
|
|
80
|
+
);
|
|
81
|
+
Scenarios.Routes_PathParameters_LabelExpansion_Standard_array = defineUri(
|
|
82
|
+
"/routes/label/standard/array.a,b",
|
|
83
|
+
);
|
|
84
|
+
Scenarios.Routes_PathParameters_LabelExpansion_Standard_record = defineUri(
|
|
85
|
+
"/routes/label/standard/record.a,1,b,2",
|
|
86
|
+
);
|
|
87
|
+
Scenarios.Routes_PathParameters_LabelExpansion_Explode_primitive = defineUri(
|
|
88
|
+
"/routes/label/standard/primitive.a",
|
|
89
|
+
);
|
|
90
|
+
Scenarios.Routes_PathParameters_LabelExpansion_Explode_array = defineUri(
|
|
91
|
+
"/routes/label/standard/array.a.b",
|
|
92
|
+
);
|
|
93
|
+
Scenarios.Routes_PathParameters_LabelExpansion_Explode_record = defineUri(
|
|
94
|
+
"/routes/label/standard/record.a=1.b=2",
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
Scenarios.Routes_PathParameters_MatrixExpansion_Standard_primitive = defineUri(
|
|
98
|
+
"/routes/matrix/standard/primitive;a",
|
|
99
|
+
);
|
|
100
|
+
Scenarios.Routes_PathParameters_MatrixExpansion_Standard_array = defineUri(
|
|
101
|
+
"/routes/matrix/standard/array;a,b",
|
|
102
|
+
);
|
|
103
|
+
Scenarios.Routes_PathParameters_MatrixExpansion_Standard_record = defineUri(
|
|
104
|
+
"/routes/matrix/standard/record;a,1,b,2",
|
|
105
|
+
);
|
|
106
|
+
Scenarios.Routes_PathParameters_MatrixExpansion_Explode_primitive = defineUri(
|
|
107
|
+
"/routes/matrix/standard/primitive;a",
|
|
108
|
+
);
|
|
109
|
+
Scenarios.Routes_PathParameters_MatrixExpansion_Explode_array = defineUri(
|
|
110
|
+
"/routes/matrix/standard/array;a;b",
|
|
111
|
+
);
|
|
112
|
+
Scenarios.Routes_PathParameters_MatrixExpansion_Explode_record = defineUri(
|
|
113
|
+
"/routes/matrix/standard/record;a=1;b=2",
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
Scenarios.Routes_QueryParameters_templateOnly = defineUri("/routes/query/template-only?param=a");
|
|
117
|
+
Scenarios.Routes_QueryParameters_explicit = defineUri("/routes/query/explicit?param=a");
|
|
118
|
+
Scenarios.Routes_QueryParameters_annotationOnly = defineUri(
|
|
119
|
+
"/routes/query/annotation-only?param=a",
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
Scenarios.Routes_QueryParameters_QueryExpansion_Standard_primitive = defineUri(
|
|
123
|
+
"/routes/query/query-expansion/standard/primitive?param=a",
|
|
124
|
+
);
|
|
125
|
+
Scenarios.Routes_QueryParameters_QueryExpansion_Standard_array = defineUri(
|
|
126
|
+
"/routes/query/query-expansion/standard/array?param=a,b",
|
|
127
|
+
);
|
|
128
|
+
Scenarios.Routes_QueryParameters_QueryExpansion_Standard_record = defineUri(
|
|
129
|
+
"/routes/query/query-expansion/standard/record?param=a,1,b,2",
|
|
130
|
+
);
|
|
131
|
+
Scenarios.Routes_QueryParameters_QueryExpansion_Explode_primitive = defineUri(
|
|
132
|
+
"/routes/query/query-expansion/explode/primitive?param=a",
|
|
133
|
+
);
|
|
134
|
+
Scenarios.Routes_QueryParameters_QueryExpansion_Explode_array = defineUri(
|
|
135
|
+
"/routes/query/query-expansion/explode/array?param=a¶m=b",
|
|
136
|
+
);
|
|
137
|
+
Scenarios.Routes_QueryParameters_QueryExpansion_Explode_record = defineUri(
|
|
138
|
+
"/routes/query/query-expansion/explode/record?a=1&b=2",
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
Scenarios.Routes_QueryParameters_QueryContinuation_Standard_primitive = defineUri(
|
|
142
|
+
"/routes/query/query-continuation/standard/primitive?fixed=true¶m=a",
|
|
143
|
+
);
|
|
144
|
+
Scenarios.Routes_QueryParameters_QueryContinuation_Standard_array = defineUri(
|
|
145
|
+
"/routes/query/query-continuation/standard/array?fixed=true¶m=a,b",
|
|
146
|
+
);
|
|
147
|
+
Scenarios.Routes_QueryParameters_QueryContinuation_Standard_record = defineUri(
|
|
148
|
+
"/routes/query/query-continuation/standard/record?fixed=true¶m=a,1,b,2",
|
|
149
|
+
);
|
|
150
|
+
Scenarios.Routes_QueryParameters_QueryContinuation_Explode_primitive = defineUri(
|
|
151
|
+
"/routes/query/query-continuation/explode/primitive?fixed=true¶m=a",
|
|
152
|
+
);
|
|
153
|
+
Scenarios.Routes_QueryParameters_QueryContinuation_Explode_array = defineUri(
|
|
154
|
+
"/routes/query/query-continuation/explode/array?fixed=true¶m=a¶m=b",
|
|
155
|
+
);
|
|
156
|
+
Scenarios.Routes_QueryParameters_QueryContinuation_Explode_record = defineUri(
|
|
157
|
+
"/routes/query/query-continuation/explode/record?fixed=true&a=1&b=2",
|
|
158
|
+
);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import "@typespec/http";
|
|
2
|
+
import "@typespec/spec-lib";
|
|
3
|
+
|
|
4
|
+
using TypeSpec.Http;
|
|
5
|
+
|
|
6
|
+
@doc("Projection")
|
|
7
|
+
@supportedBy("dpg")
|
|
8
|
+
@scenarioService("/serialization/encoded-name/json")
|
|
9
|
+
namespace Serialization.EncodedName.Json;
|
|
10
|
+
|
|
11
|
+
@route("/property")
|
|
12
|
+
namespace Property {
|
|
13
|
+
model JsonEncodedNameModel {
|
|
14
|
+
/** Pass in true */
|
|
15
|
+
@encodedName("application/json", "wireName")
|
|
16
|
+
defaultName: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@scenario
|
|
20
|
+
@scenarioDoc("""
|
|
21
|
+
Testing that you send the right JSON name on the wire.
|
|
22
|
+
Your generated SDK should generate JsonEncodedNameModel with one property `defaultName` with wire name `wireName`.
|
|
23
|
+
|
|
24
|
+
Expected request body:
|
|
25
|
+
```json
|
|
26
|
+
{"wireName": true}
|
|
27
|
+
```
|
|
28
|
+
""")
|
|
29
|
+
@post
|
|
30
|
+
op send(@bodyRoot body: JsonEncodedNameModel): NoContentResponse;
|
|
31
|
+
|
|
32
|
+
@scenario
|
|
33
|
+
@scenarioDoc("""
|
|
34
|
+
Testing that you deserialize the right json name over the wire.
|
|
35
|
+
|
|
36
|
+
Your generated SDK should generate JsonEncodedNameModel with one property `defaultName` with wire name `wireName`.
|
|
37
|
+
|
|
38
|
+
Expected response body:
|
|
39
|
+
```json
|
|
40
|
+
{"wireName": true}
|
|
41
|
+
```
|
|
42
|
+
""")
|
|
43
|
+
@get
|
|
44
|
+
op get(): JsonEncodedNameModel;
|
|
45
|
+
}
|