@typespec/http-specs 0.1.0-alpha.0

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.
Files changed (335) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/LICENSE +21 -0
  3. package/README.md +36 -0
  4. package/assets/image.jpg +0 -0
  5. package/assets/image.png +0 -0
  6. package/dist/specs/authentication/api-key/mockapi.d.ts +3 -0
  7. package/dist/specs/authentication/api-key/mockapi.d.ts.map +1 -0
  8. package/dist/specs/authentication/api-key/mockapi.js +33 -0
  9. package/dist/specs/authentication/api-key/mockapi.js.map +1 -0
  10. package/dist/specs/authentication/http/custom/mockapi.d.ts +3 -0
  11. package/dist/specs/authentication/http/custom/mockapi.d.ts.map +1 -0
  12. package/dist/specs/authentication/http/custom/mockapi.js +33 -0
  13. package/dist/specs/authentication/http/custom/mockapi.js.map +1 -0
  14. package/dist/specs/authentication/oauth2/mockapi.d.ts +3 -0
  15. package/dist/specs/authentication/oauth2/mockapi.d.ts.map +1 -0
  16. package/dist/specs/authentication/oauth2/mockapi.js +30 -0
  17. package/dist/specs/authentication/oauth2/mockapi.js.map +1 -0
  18. package/dist/specs/authentication/union/mockapi.d.ts +3 -0
  19. package/dist/specs/authentication/union/mockapi.d.ts.map +1 -0
  20. package/dist/specs/authentication/union/mockapi.js +29 -0
  21. package/dist/specs/authentication/union/mockapi.js.map +1 -0
  22. package/dist/specs/encode/bytes/mockapi.d.ts +3 -0
  23. package/dist/specs/encode/bytes/mockapi.d.ts.map +1 -0
  24. package/dist/specs/encode/bytes/mockapi.js +167 -0
  25. package/dist/specs/encode/bytes/mockapi.js.map +1 -0
  26. package/dist/specs/encode/datetime/mockapi.d.ts +3 -0
  27. package/dist/specs/encode/datetime/mockapi.d.ts.map +1 -0
  28. package/dist/specs/encode/datetime/mockapi.js +160 -0
  29. package/dist/specs/encode/datetime/mockapi.js.map +1 -0
  30. package/dist/specs/encode/duration/mockapi.d.ts +3 -0
  31. package/dist/specs/encode/duration/mockapi.d.ts.map +1 -0
  32. package/dist/specs/encode/duration/mockapi.js +103 -0
  33. package/dist/specs/encode/duration/mockapi.js.map +1 -0
  34. package/dist/specs/encode/numeric/mockapi.d.ts +3 -0
  35. package/dist/specs/encode/numeric/mockapi.d.ts.map +1 -0
  36. package/dist/specs/encode/numeric/mockapi.js +22 -0
  37. package/dist/specs/encode/numeric/mockapi.js.map +1 -0
  38. package/dist/specs/helper.d.ts +3 -0
  39. package/dist/specs/helper.d.ts.map +1 -0
  40. package/dist/specs/helper.js +7 -0
  41. package/dist/specs/helper.js.map +1 -0
  42. package/dist/specs/parameters/basic/mockapi.d.ts +3 -0
  43. package/dist/specs/parameters/basic/mockapi.d.ts.map +1 -0
  44. package/dist/specs/parameters/basic/mockapi.js +20 -0
  45. package/dist/specs/parameters/basic/mockapi.js.map +1 -0
  46. package/dist/specs/parameters/body-optionality/mockapi.d.ts +3 -0
  47. package/dist/specs/parameters/body-optionality/mockapi.d.ts.map +1 -0
  48. package/dist/specs/parameters/body-optionality/mockapi.js +50 -0
  49. package/dist/specs/parameters/body-optionality/mockapi.js.map +1 -0
  50. package/dist/specs/parameters/collection-format/mockapi.d.ts +3 -0
  51. package/dist/specs/parameters/collection-format/mockapi.d.ts.map +1 -0
  52. package/dist/specs/parameters/collection-format/mockapi.js +76 -0
  53. package/dist/specs/parameters/collection-format/mockapi.js.map +1 -0
  54. package/dist/specs/parameters/spread/mockapi.d.ts +3 -0
  55. package/dist/specs/parameters/spread/mockapi.d.ts.map +1 -0
  56. package/dist/specs/parameters/spread/mockapi.js +155 -0
  57. package/dist/specs/parameters/spread/mockapi.js.map +1 -0
  58. package/dist/specs/payload/content-negotiation/mockapi.d.ts +3 -0
  59. package/dist/specs/payload/content-negotiation/mockapi.d.ts.map +1 -0
  60. package/dist/specs/payload/content-negotiation/mockapi.js +169 -0
  61. package/dist/specs/payload/content-negotiation/mockapi.js.map +1 -0
  62. package/dist/specs/payload/json-merge-patch/mockapi.d.ts +38 -0
  63. package/dist/specs/payload/json-merge-patch/mockapi.d.ts.map +1 -0
  64. package/dist/specs/payload/json-merge-patch/mockapi.js +90 -0
  65. package/dist/specs/payload/json-merge-patch/mockapi.js.map +1 -0
  66. package/dist/specs/payload/media-type/mockapi.d.ts +3 -0
  67. package/dist/specs/payload/media-type/mockapi.d.ts.map +1 -0
  68. package/dist/specs/payload/media-type/mockapi.js +59 -0
  69. package/dist/specs/payload/media-type/mockapi.js.map +1 -0
  70. package/dist/specs/payload/multipart/mockapi.d.ts +3 -0
  71. package/dist/specs/payload/multipart/mockapi.d.ts.map +1 -0
  72. package/dist/specs/payload/multipart/mockapi.js +323 -0
  73. package/dist/specs/payload/multipart/mockapi.js.map +1 -0
  74. package/dist/specs/payload/xml/mockapi.d.ts +15 -0
  75. package/dist/specs/payload/xml/mockapi.d.ts.map +1 -0
  76. package/dist/specs/payload/xml/mockapi.js +183 -0
  77. package/dist/specs/payload/xml/mockapi.js.map +1 -0
  78. package/dist/specs/routes/mockapi.d.ts +3 -0
  79. package/dist/specs/routes/mockapi.d.ts.map +1 -0
  80. package/dist/specs/routes/mockapi.js +94 -0
  81. package/dist/specs/routes/mockapi.js.map +1 -0
  82. package/dist/specs/serialization/encoded-name/json/mockapi.d.ts +3 -0
  83. package/dist/specs/serialization/encoded-name/json/mockapi.d.ts.map +1 -0
  84. package/dist/specs/serialization/encoded-name/json/mockapi.js +20 -0
  85. package/dist/specs/serialization/encoded-name/json/mockapi.js.map +1 -0
  86. package/dist/specs/server/endpoint/not-defined/mockapi.d.ts +3 -0
  87. package/dist/specs/server/endpoint/not-defined/mockapi.d.ts.map +1 -0
  88. package/dist/specs/server/endpoint/not-defined/mockapi.js +12 -0
  89. package/dist/specs/server/endpoint/not-defined/mockapi.js.map +1 -0
  90. package/dist/specs/server/path/multiple/mockapi.d.ts +3 -0
  91. package/dist/specs/server/path/multiple/mockapi.d.ts.map +1 -0
  92. package/dist/specs/server/path/multiple/mockapi.js +21 -0
  93. package/dist/specs/server/path/multiple/mockapi.js.map +1 -0
  94. package/dist/specs/server/path/single/mockapi.d.ts +3 -0
  95. package/dist/specs/server/path/single/mockapi.d.ts.map +1 -0
  96. package/dist/specs/server/path/single/mockapi.js +12 -0
  97. package/dist/specs/server/path/single/mockapi.js.map +1 -0
  98. package/dist/specs/server/versions/not-versioned/mockapi.d.ts +3 -0
  99. package/dist/specs/server/versions/not-versioned/mockapi.d.ts.map +1 -0
  100. package/dist/specs/server/versions/not-versioned/mockapi.js +42 -0
  101. package/dist/specs/server/versions/not-versioned/mockapi.js.map +1 -0
  102. package/dist/specs/server/versions/versioned/mockapi.d.ts +3 -0
  103. package/dist/specs/server/versions/versioned/mockapi.d.ts.map +1 -0
  104. package/dist/specs/server/versions/versioned/mockapi.js +43 -0
  105. package/dist/specs/server/versions/versioned/mockapi.js.map +1 -0
  106. package/dist/specs/special-headers/conditional-request/mockapi.d.ts +3 -0
  107. package/dist/specs/special-headers/conditional-request/mockapi.d.ts.map +1 -0
  108. package/dist/specs/special-headers/conditional-request/mockapi.js +55 -0
  109. package/dist/specs/special-headers/conditional-request/mockapi.js.map +1 -0
  110. package/dist/specs/special-headers/repeatability/mockapi.d.ts +3 -0
  111. package/dist/specs/special-headers/repeatability/mockapi.d.ts.map +1 -0
  112. package/dist/specs/special-headers/repeatability/mockapi.js +36 -0
  113. package/dist/specs/special-headers/repeatability/mockapi.js.map +1 -0
  114. package/dist/specs/special-words/dec.d.ts +22 -0
  115. package/dist/specs/special-words/dec.d.ts.map +1 -0
  116. package/dist/specs/special-words/dec.js +37 -0
  117. package/dist/specs/special-words/dec.js.map +1 -0
  118. package/dist/specs/special-words/mockapi.d.ts +3 -0
  119. package/dist/specs/special-words/mockapi.d.ts.map +1 -0
  120. package/dist/specs/special-words/mockapi.js +223 -0
  121. package/dist/specs/special-words/mockapi.js.map +1 -0
  122. package/dist/specs/type/array/mockapi.d.ts +3 -0
  123. package/dist/specs/type/array/mockapi.d.ts.map +1 -0
  124. package/dist/specs/type/array/mockapi.js +92 -0
  125. package/dist/specs/type/array/mockapi.js.map +1 -0
  126. package/dist/specs/type/dictionary/mockapi.d.ts +3 -0
  127. package/dist/specs/type/dictionary/mockapi.d.ts.map +1 -0
  128. package/dist/specs/type/dictionary/mockapi.js +91 -0
  129. package/dist/specs/type/dictionary/mockapi.js.map +1 -0
  130. package/dist/specs/type/enum/extensible/mockapi.d.ts +3 -0
  131. package/dist/specs/type/enum/extensible/mockapi.d.ts.map +1 -0
  132. package/dist/specs/type/enum/extensible/mockapi.js +39 -0
  133. package/dist/specs/type/enum/extensible/mockapi.js.map +1 -0
  134. package/dist/specs/type/enum/fixed/mockapi.d.ts +3 -0
  135. package/dist/specs/type/enum/fixed/mockapi.d.ts.map +1 -0
  136. package/dist/specs/type/enum/fixed/mockapi.js +42 -0
  137. package/dist/specs/type/enum/fixed/mockapi.js.map +1 -0
  138. package/dist/specs/type/model/empty/mockapi.d.ts +3 -0
  139. package/dist/specs/type/model/empty/mockapi.d.ts.map +1 -0
  140. package/dist/specs/type/model/empty/mockapi.js +37 -0
  141. package/dist/specs/type/model/empty/mockapi.js.map +1 -0
  142. package/dist/specs/type/model/inheritance/enum-discriminator/mockapi.d.ts +3 -0
  143. package/dist/specs/type/model/inheritance/enum-discriminator/mockapi.d.ts.map +1 -0
  144. package/dist/specs/type/model/inheritance/enum-discriminator/mockapi.js +69 -0
  145. package/dist/specs/type/model/inheritance/enum-discriminator/mockapi.js.map +1 -0
  146. package/dist/specs/type/model/inheritance/nested-discriminator/mockapi.d.ts +3 -0
  147. package/dist/specs/type/model/inheritance/nested-discriminator/mockapi.d.ts.map +1 -0
  148. package/dist/specs/type/model/inheritance/nested-discriminator/mockapi.js +127 -0
  149. package/dist/specs/type/model/inheritance/nested-discriminator/mockapi.js.map +1 -0
  150. package/dist/specs/type/model/inheritance/not-discriminated/mockapi.d.ts +3 -0
  151. package/dist/specs/type/model/inheritance/not-discriminated/mockapi.d.ts.map +1 -0
  152. package/dist/specs/type/model/inheritance/not-discriminated/mockapi.js +37 -0
  153. package/dist/specs/type/model/inheritance/not-discriminated/mockapi.js.map +1 -0
  154. package/dist/specs/type/model/inheritance/recursive/mockapi.d.ts +3 -0
  155. package/dist/specs/type/model/inheritance/recursive/mockapi.d.ts.map +1 -0
  156. package/dist/specs/type/model/inheritance/recursive/mockapi.js +40 -0
  157. package/dist/specs/type/model/inheritance/recursive/mockapi.js.map +1 -0
  158. package/dist/specs/type/model/inheritance/single-discriminator/mockapi.d.ts +3 -0
  159. package/dist/specs/type/model/inheritance/single-discriminator/mockapi.d.ts.map +1 -0
  160. package/dist/specs/type/model/inheritance/single-discriminator/mockapi.js +99 -0
  161. package/dist/specs/type/model/inheritance/single-discriminator/mockapi.js.map +1 -0
  162. package/dist/specs/type/model/templated/mockapi.d.ts +3 -0
  163. package/dist/specs/type/model/templated/mockapi.d.ts.map +1 -0
  164. package/dist/specs/type/model/templated/mockapi.js +63 -0
  165. package/dist/specs/type/model/templated/mockapi.js.map +1 -0
  166. package/dist/specs/type/model/usage/mockapi.d.ts +3 -0
  167. package/dist/specs/type/model/usage/mockapi.d.ts.map +1 -0
  168. package/dist/specs/type/model/usage/mockapi.js +41 -0
  169. package/dist/specs/type/model/usage/mockapi.js.map +1 -0
  170. package/dist/specs/type/model/visibility/mockapi.d.ts +3 -0
  171. package/dist/specs/type/model/visibility/mockapi.d.ts.map +1 -0
  172. package/dist/specs/type/model/visibility/mockapi.js +107 -0
  173. package/dist/specs/type/model/visibility/mockapi.js.map +1 -0
  174. package/dist/specs/type/property/additional-properties/mockapi.d.ts +3 -0
  175. package/dist/specs/type/property/additional-properties/mockapi.d.ts.map +1 -0
  176. package/dist/specs/type/property/additional-properties/mockapi.js +333 -0
  177. package/dist/specs/type/property/additional-properties/mockapi.js.map +1 -0
  178. package/dist/specs/type/property/nullable/mockapi.d.ts +3 -0
  179. package/dist/specs/type/property/nullable/mockapi.d.ts.map +1 -0
  180. package/dist/specs/type/property/nullable/mockapi.js +132 -0
  181. package/dist/specs/type/property/nullable/mockapi.js.map +1 -0
  182. package/dist/specs/type/property/optionality/mockapi.d.ts +3 -0
  183. package/dist/specs/type/property/optionality/mockapi.d.ts.map +1 -0
  184. package/dist/specs/type/property/optionality/mockapi.js +185 -0
  185. package/dist/specs/type/property/optionality/mockapi.js.map +1 -0
  186. package/dist/specs/type/property/value-types/mockapi.d.ts +3 -0
  187. package/dist/specs/type/property/value-types/mockapi.d.ts.map +1 -0
  188. package/dist/specs/type/property/value-types/mockapi.js +214 -0
  189. package/dist/specs/type/property/value-types/mockapi.js.map +1 -0
  190. package/dist/specs/type/scalar/mockapi.d.ts +3 -0
  191. package/dist/specs/type/scalar/mockapi.d.ts.map +1 -0
  192. package/dist/specs/type/scalar/mockapi.js +193 -0
  193. package/dist/specs/type/scalar/mockapi.js.map +1 -0
  194. package/dist/specs/type/union/mockapi.d.ts +3 -0
  195. package/dist/specs/type/union/mockapi.d.ts.map +1 -0
  196. package/dist/specs/type/union/mockapi.js +106 -0
  197. package/dist/specs/type/union/mockapi.js.map +1 -0
  198. package/dist/specs/versioning/added/mockapi.d.ts +3 -0
  199. package/dist/specs/versioning/added/mockapi.d.ts.map +1 -0
  200. package/dist/specs/versioning/added/mockapi.js +54 -0
  201. package/dist/specs/versioning/added/mockapi.js.map +1 -0
  202. package/dist/specs/versioning/madeOptional/mockapi.d.ts +3 -0
  203. package/dist/specs/versioning/madeOptional/mockapi.d.ts.map +1 -0
  204. package/dist/specs/versioning/madeOptional/mockapi.js +17 -0
  205. package/dist/specs/versioning/madeOptional/mockapi.js.map +1 -0
  206. package/dist/specs/versioning/removed/mockapi.d.ts +3 -0
  207. package/dist/specs/versioning/removed/mockapi.d.ts.map +1 -0
  208. package/dist/specs/versioning/removed/mockapi.js +19 -0
  209. package/dist/specs/versioning/removed/mockapi.js.map +1 -0
  210. package/dist/specs/versioning/renamedFrom/mockapi.d.ts +3 -0
  211. package/dist/specs/versioning/renamedFrom/mockapi.d.ts.map +1 -0
  212. package/dist/specs/versioning/renamedFrom/mockapi.js +38 -0
  213. package/dist/specs/versioning/renamedFrom/mockapi.js.map +1 -0
  214. package/dist/specs/versioning/returnTypeChangedFrom/mockapi.d.ts +3 -0
  215. package/dist/specs/versioning/returnTypeChangedFrom/mockapi.d.ts.map +1 -0
  216. package/dist/specs/versioning/returnTypeChangedFrom/mockapi.js +18 -0
  217. package/dist/specs/versioning/returnTypeChangedFrom/mockapi.js.map +1 -0
  218. package/dist/specs/versioning/typeChangedFrom/mockapi.d.ts +3 -0
  219. package/dist/specs/versioning/typeChangedFrom/mockapi.d.ts.map +1 -0
  220. package/dist/specs/versioning/typeChangedFrom/mockapi.js +21 -0
  221. package/dist/specs/versioning/typeChangedFrom/mockapi.js.map +1 -0
  222. package/package.json +55 -0
  223. package/spec-summary.md +7463 -0
  224. package/specs/README.md +3 -0
  225. package/specs/authentication/api-key/main.tsp +40 -0
  226. package/specs/authentication/api-key/mockapi.ts +35 -0
  227. package/specs/authentication/http/custom/main.tsp +40 -0
  228. package/specs/authentication/http/custom/mockapi.ts +35 -0
  229. package/specs/authentication/oauth2/main.tsp +45 -0
  230. package/specs/authentication/oauth2/mockapi.ts +32 -0
  231. package/specs/authentication/union/main.tsp +30 -0
  232. package/specs/authentication/union/mockapi.ts +31 -0
  233. package/specs/encode/bytes/main.tsp +363 -0
  234. package/specs/encode/bytes/mockapi.ts +297 -0
  235. package/specs/encode/datetime/main.tsp +339 -0
  236. package/specs/encode/datetime/mockapi.ts +274 -0
  237. package/specs/encode/duration/main.tsp +318 -0
  238. package/specs/encode/duration/mockapi.ts +191 -0
  239. package/specs/encode/numeric/main.tsp +69 -0
  240. package/specs/encode/numeric/mockapi.ts +32 -0
  241. package/specs/helper.ts +8 -0
  242. package/specs/parameters/basic/main.tsp +58 -0
  243. package/specs/parameters/basic/mockapi.ts +25 -0
  244. package/specs/parameters/body-optionality/main.tsp +61 -0
  245. package/specs/parameters/body-optionality/mockapi.ts +59 -0
  246. package/specs/parameters/collection-format/main.tsp +92 -0
  247. package/specs/parameters/collection-format/mockapi.ts +83 -0
  248. package/specs/parameters/spread/main.tsp +337 -0
  249. package/specs/parameters/spread/mockapi.ts +165 -0
  250. package/specs/payload/content-negotiation/main.tsp +61 -0
  251. package/specs/payload/content-negotiation/mockapi.ts +188 -0
  252. package/specs/payload/json-merge-patch/main.tsp +184 -0
  253. package/specs/payload/json-merge-patch/mockapi.ts +95 -0
  254. package/specs/payload/media-type/main.tsp +52 -0
  255. package/specs/payload/media-type/mockapi.ts +63 -0
  256. package/specs/payload/multipart/main.tsp +500 -0
  257. package/specs/payload/multipart/mockapi.ts +364 -0
  258. package/specs/payload/xml/main.tsp +302 -0
  259. package/specs/payload/xml/mockapi.ts +238 -0
  260. package/specs/routes/main.tsp +477 -0
  261. package/specs/routes/mockapi.ts +175 -0
  262. package/specs/scratch/.gitignore +3 -0
  263. package/specs/serialization/encoded-name/json/main.tsp +45 -0
  264. package/specs/serialization/encoded-name/json/mockapi.ts +22 -0
  265. package/specs/server/endpoint/not-defined/main.tsp +20 -0
  266. package/specs/server/endpoint/not-defined/mockapi.ts +13 -0
  267. package/specs/server/path/multiple/main.tsp +47 -0
  268. package/specs/server/path/multiple/mockapi.ts +23 -0
  269. package/specs/server/path/single/main.tsp +24 -0
  270. package/specs/server/path/single/mockapi.ts +13 -0
  271. package/specs/server/versions/not-versioned/main.tsp +40 -0
  272. package/specs/server/versions/not-versioned/mockapi.ts +51 -0
  273. package/specs/server/versions/versioned/main.tsp +64 -0
  274. package/specs/server/versions/versioned/mockapi.ts +64 -0
  275. package/specs/special-headers/conditional-request/main.tsp +89 -0
  276. package/specs/special-headers/conditional-request/mockapi.ts +59 -0
  277. package/specs/special-headers/repeatability/main.tsp +39 -0
  278. package/specs/special-headers/repeatability/mockapi.ts +47 -0
  279. package/specs/special-words/dec.js +52 -0
  280. package/specs/special-words/main.tsp +234 -0
  281. package/specs/special-words/mockapi.ts +384 -0
  282. package/specs/type/array/main.tsp +108 -0
  283. package/specs/type/array/mockapi.ts +107 -0
  284. package/specs/type/dictionary/main.tsp +101 -0
  285. package/specs/type/dictionary/mockapi.ts +103 -0
  286. package/specs/type/enum/extensible/main.tsp +65 -0
  287. package/specs/type/enum/extensible/mockapi.ts +48 -0
  288. package/specs/type/enum/fixed/main.tsp +60 -0
  289. package/specs/type/enum/fixed/mockapi.ts +44 -0
  290. package/specs/type/model/empty/main.tsp +40 -0
  291. package/specs/type/model/empty/mockapi.ts +40 -0
  292. package/specs/type/model/inheritance/enum-discriminator/main.tsp +169 -0
  293. package/specs/type/model/inheritance/enum-discriminator/mockapi.ts +89 -0
  294. package/specs/type/model/inheritance/nested-discriminator/main.tsp +224 -0
  295. package/specs/type/model/inheritance/nested-discriminator/mockapi.ts +130 -0
  296. package/specs/type/model/inheritance/not-discriminated/main.tsp +54 -0
  297. package/specs/type/model/inheritance/not-discriminated/mockapi.ts +39 -0
  298. package/specs/type/model/inheritance/recursive/main.tsp +71 -0
  299. package/specs/type/model/inheritance/recursive/mockapi.ts +41 -0
  300. package/specs/type/model/inheritance/single-discriminator/main.tsp +172 -0
  301. package/specs/type/model/inheritance/single-discriminator/mockapi.ts +103 -0
  302. package/specs/type/model/templated/main.tsp +130 -0
  303. package/specs/type/model/templated/mockapi.ts +66 -0
  304. package/specs/type/model/usage/main.tsp +49 -0
  305. package/specs/type/model/usage/mockapi.ts +45 -0
  306. package/specs/type/model/visibility/main.tsp +153 -0
  307. package/specs/type/model/visibility/mockapi.ts +108 -0
  308. package/specs/type/property/additional-properties/main.tsp +549 -0
  309. package/specs/type/property/additional-properties/mockapi.ts +464 -0
  310. package/specs/type/property/nullable/main.tsp +139 -0
  311. package/specs/type/property/nullable/mockapi.ts +187 -0
  312. package/specs/type/property/optionality/main.tsp +226 -0
  313. package/specs/type/property/optionality/mockapi.ts +296 -0
  314. package/specs/type/property/value-types/main.tsp +244 -0
  315. package/specs/type/property/value-types/mockapi.ts +300 -0
  316. package/specs/type/scalar/main.tsp +136 -0
  317. package/specs/type/scalar/mockapi.ts +199 -0
  318. package/specs/type/union/main.tsp +249 -0
  319. package/specs/type/union/mockapi.ts +130 -0
  320. package/specs/versioning/added/main.tsp +136 -0
  321. package/specs/versioning/added/mockapi.ts +57 -0
  322. package/specs/versioning/madeOptional/main.tsp +65 -0
  323. package/specs/versioning/madeOptional/mockapi.ts +18 -0
  324. package/specs/versioning/removed/main.tsp +126 -0
  325. package/specs/versioning/removed/mockapi.ts +20 -0
  326. package/specs/versioning/renamedFrom/main.tsp +112 -0
  327. package/specs/versioning/renamedFrom/mockapi.ts +40 -0
  328. package/specs/versioning/returnTypeChangedFrom/main.tsp +57 -0
  329. package/specs/versioning/returnTypeChangedFrom/mockapi.ts +19 -0
  330. package/specs/versioning/typeChangedFrom/main.tsp +71 -0
  331. package/specs/versioning/typeChangedFrom/mockapi.ts +22 -0
  332. package/temp/.tsbuildinfo +1 -0
  333. package/tsconfig.build.json +8 -0
  334. package/tsconfig.json +11 -0
  335. package/tspconfig.yaml +2 -0
@@ -0,0 +1,364 @@
1
+ import {
2
+ MockRequest,
3
+ passOnSuccess,
4
+ ScenarioMockApi,
5
+ ValidationError,
6
+ withServiceKeys,
7
+ } from "@typespec/spec-api";
8
+ import { jpgFile, pngFile } from "../../helper.js";
9
+
10
+ export const Scenarios: Record<string, ScenarioMockApi> = {};
11
+
12
+ function checkId(req: MockRequest) {
13
+ req.expect.deepEqual(req.body.id, "123");
14
+ }
15
+
16
+ function checkAddress(req: MockRequest) {
17
+ req.expect.deepEqual(JSON.parse(req.body.address), { city: "X" });
18
+ }
19
+
20
+ function checkPreviousAddresses(req: MockRequest) {
21
+ req.expect.deepEqual(JSON.parse(req.body.previousAddresses), [{ city: "Y" }, { city: "Z" }]);
22
+ }
23
+
24
+ function checkFile(
25
+ req: MockRequest,
26
+ file: Record<string, any>,
27
+ expected: Buffer,
28
+ contentType: string = "application/octet-stream",
29
+ fileName: string | undefined = undefined,
30
+ mustCheckContentType: boolean = true,
31
+ ) {
32
+ // cadl-ranch depends on multer, which sets the mimetype to "text/plain" if this part has no content-type header
33
+ if (mustCheckContentType || file.mimetype !== "text/plain") {
34
+ req.expect.deepEqual(file.mimetype, contentType);
35
+ }
36
+ req.expect.deepEqual(file.buffer, expected);
37
+ if (fileName) {
38
+ req.expect.deepEqual(file.originalname, fileName);
39
+ }
40
+ }
41
+
42
+ function checkJpgFile(
43
+ req: MockRequest,
44
+ file: Record<string, any>,
45
+ contentType: string = "application/octet-stream",
46
+ fileName: string | undefined = undefined,
47
+ mustCheckContentType: boolean = true,
48
+ ) {
49
+ req.expect.deepEqual(file.fieldname, "profileImage");
50
+ checkFile(req, file, jpgFile, contentType, fileName, mustCheckContentType);
51
+ }
52
+
53
+ function checkOptionalContentType(req: MockRequest) {
54
+ if (req.files instanceof Array && req.files?.length > 0) {
55
+ checkJpgFile(req, req.files[0], "application/octet-stream", undefined, false);
56
+ } else {
57
+ throw new ValidationError("No profileImage found", "jpg file is expected", req.body);
58
+ }
59
+ }
60
+
61
+ function checkPngFile(req: MockRequest, file: Record<string, any>, fieldName: string = "pictures") {
62
+ req.expect.deepEqual(file.fieldname, fieldName);
63
+ checkFile(req, file, pngFile);
64
+ }
65
+
66
+ function checkProfileImage(req: MockRequest) {
67
+ if (req.files instanceof Array && req.files?.length > 0) {
68
+ checkJpgFile(req, req.files[0]);
69
+ } else {
70
+ throw new ValidationError("No profileImage found", "jpg file is expected", req.body);
71
+ }
72
+ }
73
+
74
+ function checkFileNameAndContentType(req: MockRequest) {
75
+ if (req.files instanceof Array && req.files?.length > 0) {
76
+ checkJpgFile(req, req.files[0], "image/jpg", "hello.jpg");
77
+ } else {
78
+ throw new ValidationError("No profileImage found", "jpg file is expected", req.body);
79
+ }
80
+ }
81
+
82
+ function checkAllFiles(req: MockRequest) {
83
+ if (req.files instanceof Array && req.files?.length === 3) {
84
+ for (const file of req.files) {
85
+ if (file.fieldname === "profileImage") {
86
+ checkJpgFile(req, file);
87
+ } else if (file.fieldname === "pictures") {
88
+ checkPngFile(req, file);
89
+ } else {
90
+ throw new ValidationError(
91
+ "unexpected fieldname",
92
+ "profileImage or pictures",
93
+ file.fieldname,
94
+ );
95
+ }
96
+ }
97
+ } else {
98
+ throw new ValidationError(
99
+ "Can't parse files from request",
100
+ "jpg/png files are expected",
101
+ req.body,
102
+ );
103
+ }
104
+ }
105
+ function checkPictures(req: MockRequest) {
106
+ if (req.files instanceof Array && req.files?.length === 2) {
107
+ for (const file of req.files) {
108
+ checkPngFile(req, file);
109
+ }
110
+ } else {
111
+ throw new ValidationError("No pictures found", "png files are expected", req.body);
112
+ }
113
+ }
114
+ function checkFloat(req: MockRequest) {
115
+ req.expect.deepEqual(parseFloat(req.body.temperature), 0.5);
116
+ }
117
+ const files = [
118
+ {
119
+ fieldname: "profileImage",
120
+ originalname: "image.jpg",
121
+ buffer: jpgFile,
122
+ mimetype: "application/octet-stream",
123
+ },
124
+ {
125
+ fieldname: "pictures",
126
+ originalname: "image.png",
127
+ buffer: pngFile,
128
+ mimetype: "application/octet-stream",
129
+ },
130
+ ];
131
+ function createHandler(req: MockRequest, checkList: ((req: MockRequest) => void)[]) {
132
+ for (const callback of checkList) {
133
+ callback(req);
134
+ }
135
+ return { status: 204 };
136
+ }
137
+
138
+ function createMultiBinaryPartsHandler(req: MockRequest) {
139
+ if (req.files instanceof Array) {
140
+ switch (req.files.length) {
141
+ case 1:
142
+ checkJpgFile(req, req.files[0]);
143
+ return { pass: "profileImage", status: 204 } as const;
144
+ case 2:
145
+ let profileImage = false;
146
+ let picture = false;
147
+ for (const file of req.files) {
148
+ if (file.fieldname === "profileImage") {
149
+ checkJpgFile(req, file);
150
+ profileImage = true;
151
+ } else if (file.fieldname === "picture") {
152
+ checkPngFile(req, file, "picture");
153
+ picture = true;
154
+ } else {
155
+ throw new ValidationError(
156
+ "unexpected fieldname",
157
+ "profileImage or picture",
158
+ file.fieldname,
159
+ );
160
+ }
161
+ }
162
+ if (!profileImage) {
163
+ throw new ValidationError("No profileImage found", "jpg file is expected", req.body);
164
+ } else if (!picture) {
165
+ throw new ValidationError("No picture found", "png file are expected", req.body);
166
+ }
167
+ return { pass: "profileImage,picture", status: 204 } as const;
168
+ default:
169
+ throw new ValidationError(
170
+ "number of files is incorrect",
171
+ "1 or 2 files are expected",
172
+ req.body,
173
+ );
174
+ }
175
+ } else {
176
+ throw new ValidationError(
177
+ "Can't parse files from request",
178
+ "jpg/png files are expected",
179
+ req.body,
180
+ );
181
+ }
182
+ }
183
+
184
+ Scenarios.Payload_MultiPart_FormData_basic = passOnSuccess({
185
+ uri: "/multipart/form-data/mixed-parts",
186
+ method: "post",
187
+ request: {
188
+ headers: {
189
+ "Content-Type": "multipart/form-data",
190
+ },
191
+ body: { id: 123 },
192
+ files: [files[0]],
193
+ },
194
+ response: { status: 204 },
195
+ handler: (req: MockRequest) => createHandler(req, [checkId, checkProfileImage]),
196
+ kind: "MockApiDefinition",
197
+ });
198
+ Scenarios.Payload_MultiPart_FormData_fileArrayAndBasic = passOnSuccess({
199
+ uri: "/multipart/form-data/complex-parts",
200
+ method: "post",
201
+ request: {
202
+ headers: {
203
+ "Content-Type": "multipart/form-data",
204
+ },
205
+ body: { id: 123, address: { city: "X" } },
206
+ files: [files[0], files[1], files[1]],
207
+ },
208
+ response: { status: 204 },
209
+ handler: (req: MockRequest) => createHandler(req, [checkId, checkAddress, checkAllFiles]),
210
+ kind: "MockApiDefinition",
211
+ });
212
+ Scenarios.Payload_MultiPart_FormData_jsonPart = passOnSuccess({
213
+ uri: "/multipart/form-data/json-part",
214
+ method: "post",
215
+ request: {
216
+ headers: {
217
+ "Content-Type": "multipart/form-data",
218
+ },
219
+ body: { address: { city: "X" } },
220
+ files: [files[0]],
221
+ },
222
+ response: { status: 204 },
223
+ handler: (req: MockRequest) => createHandler(req, [checkAddress, checkProfileImage]),
224
+ kind: "MockApiDefinition",
225
+ });
226
+ Scenarios.Payload_MultiPart_FormData_binaryArrayParts = passOnSuccess({
227
+ uri: "/multipart/form-data/binary-array-parts",
228
+ method: "post",
229
+ request: {
230
+ headers: {
231
+ "Content-Type": "multipart/form-data",
232
+ },
233
+ body: { id: 123 },
234
+ files: [files[1], files[1]],
235
+ },
236
+ response: { status: 204 },
237
+ handler: (req: MockRequest) => createHandler(req, [checkId, checkPictures]),
238
+ kind: "MockApiDefinition",
239
+ });
240
+ Scenarios.Payload_MultiPart_FormData_multiBinaryParts = withServiceKeys([
241
+ "profileImage",
242
+ "profileImage,picture",
243
+ ]).pass([
244
+ {
245
+ uri: "/multipart/form-data/multi-binary-parts",
246
+ method: "post",
247
+ request: {
248
+ headers: {
249
+ "Content-Type": "multipart/form-data",
250
+ },
251
+ files: [files[0]],
252
+ },
253
+ response: { status: 204 },
254
+ handler: createMultiBinaryPartsHandler,
255
+ kind: "MockApiDefinition",
256
+ },
257
+ {
258
+ uri: "/multipart/form-data/multi-binary-parts",
259
+ method: "post",
260
+ request: {
261
+ headers: {
262
+ "Content-Type": "multipart/form-data",
263
+ },
264
+ files: [files[0], { ...files[1], fieldname: "picture" }],
265
+ },
266
+ response: { status: 204 },
267
+ handler: createMultiBinaryPartsHandler,
268
+ kind: "MockApiDefinition",
269
+ },
270
+ ]);
271
+ Scenarios.Payload_MultiPart_FormData_checkFileNameAndContentType = passOnSuccess({
272
+ uri: "/multipart/form-data/check-filename-and-content-type",
273
+ method: "post",
274
+ request: {
275
+ headers: {
276
+ "Content-Type": "multipart/form-data",
277
+ },
278
+ body: { id: 123 },
279
+ files: [{ ...files[0], mimetype: "image/jpg", originalname: "hello.jpg" }],
280
+ },
281
+ response: { status: 204 },
282
+ handler: (req: MockRequest) => createHandler(req, [checkId, checkFileNameAndContentType]),
283
+ kind: "MockApiDefinition",
284
+ });
285
+ Scenarios.Payload_MultiPart_FormData_anonymousModel = passOnSuccess({
286
+ uri: "/multipart/form-data/anonymous-model",
287
+ method: "post",
288
+ request: {
289
+ headers: {
290
+ "Content-Type": "multipart/form-data",
291
+ },
292
+ files: [files[0]],
293
+ },
294
+ response: { status: 204 },
295
+ handler: (req: MockRequest) => createHandler(req, [checkProfileImage]),
296
+ kind: "MockApiDefinition",
297
+ });
298
+ Scenarios.Payload_MultiPart_FormData_HttpParts_ContentType_imageJpegContentType = passOnSuccess({
299
+ uri: "/multipart/form-data/check-filename-and-specific-content-type-with-httppart",
300
+ method: "post",
301
+ request: {
302
+ headers: {
303
+ "Content-Type": "multipart/form-data",
304
+ },
305
+ files: [{ ...files[0], mimetype: "image/jpg", originalname: "hello.jpg" }],
306
+ },
307
+ response: { status: 204 },
308
+ handler: (req: MockRequest) => createHandler(req, [checkFileNameAndContentType]),
309
+ kind: "MockApiDefinition",
310
+ });
311
+ Scenarios.Payload_MultiPart_FormData_HttpParts_ContentType_requiredContentType = passOnSuccess({
312
+ uri: "/multipart/form-data/check-filename-and-required-content-type-with-httppart",
313
+ method: "post",
314
+ request: {
315
+ headers: {
316
+ "Content-Type": "multipart/form-data",
317
+ },
318
+ files: [files[0]],
319
+ },
320
+ response: { status: 204 },
321
+ handler: (req: MockRequest) => createHandler(req, [checkProfileImage]),
322
+ kind: "MockApiDefinition",
323
+ });
324
+ Scenarios.Payload_MultiPart_FormData_HttpParts_ContentType_optionalContentType = passOnSuccess({
325
+ uri: "/multipart/form-data/file-with-http-part-optional-content-type",
326
+ method: "post",
327
+ request: {
328
+ headers: {
329
+ "Content-Type": "multipart/form-data",
330
+ },
331
+ files: [files[0]],
332
+ },
333
+ response: { status: 204 },
334
+ handler: (req: MockRequest) => createHandler(req, [checkOptionalContentType]),
335
+ kind: "MockApiDefinition",
336
+ });
337
+ Scenarios.Payload_MultiPart_FormData_HttpParts_jsonArrayAndFileArray = passOnSuccess({
338
+ uri: "/multipart/form-data/complex-parts-with-httppart",
339
+ method: "post",
340
+ request: {
341
+ headers: {
342
+ "Content-Type": "multipart/form-data",
343
+ },
344
+ body: { id: 123, address: { city: "X" }, previousAddresses: [{ city: "Y" }, { city: "Z" }] },
345
+ files: [files[0], files[1], files[1]],
346
+ },
347
+ response: { status: 204 },
348
+ handler: (req: MockRequest) =>
349
+ createHandler(req, [checkId, checkAddress, checkPreviousAddresses, checkAllFiles]),
350
+ kind: "MockApiDefinition",
351
+ });
352
+ Scenarios.Payload_MultiPart_FormData_HttpParts_NonString_float = passOnSuccess({
353
+ uri: "/multipart/form-data/non-string-float",
354
+ method: "post",
355
+ request: {
356
+ body: { temperature: 0.5 },
357
+ headers: {
358
+ "Content-Type": "multipart/form-data",
359
+ },
360
+ },
361
+ response: { status: 204 },
362
+ handler: (req: MockRequest) => createHandler(req, [checkFloat]),
363
+ kind: "MockApiDefinition",
364
+ });
@@ -0,0 +1,302 @@
1
+ import "@typespec/http";
2
+ import "@typespec/xml";
3
+ import "@typespec/spector";
4
+
5
+ using Http;
6
+ using Spector;
7
+ using TypeSpec.Xml;
8
+
9
+ @doc("Sends and receives bodies in XML format.")
10
+ @scenarioService("/payload/xml")
11
+ namespace Payload.Xml;
12
+
13
+ @doc("Contains fields of primitive types.")
14
+ model SimpleModel {
15
+ name: string;
16
+ age: int32;
17
+ }
18
+
19
+ @doc("Contains fields of arrays of primitive types.")
20
+ model ModelWithSimpleArrays {
21
+ colors: string[];
22
+ counts: int32[];
23
+ }
24
+
25
+ @doc("Contains an array of models.")
26
+ model ModelWithArrayOfModel {
27
+ items: SimpleModel[];
28
+ }
29
+
30
+ @doc("Contains an optional field.")
31
+ model ModelWithOptionalField {
32
+ item: string;
33
+ value?: int32;
34
+ }
35
+
36
+ @doc("Contains fields that are XML attributes.")
37
+ model ModelWithAttributes {
38
+ @attribute id1: int32;
39
+ @attribute id2: string;
40
+ enabled: boolean;
41
+ }
42
+
43
+ @doc("Contains fields of wrapped and unwrapped arrays of primitive types.")
44
+ model ModelWithUnwrappedArray {
45
+ @unwrapped colors: string[];
46
+ counts: int32[];
47
+ }
48
+
49
+ @doc("Contains fields of wrapped and unwrapped arrays of primitive types that have different XML representations.")
50
+ model ModelWithRenamedArrays {
51
+ @name("Colors") @unwrapped colors: string[];
52
+ @name("Counts") counts: int32[];
53
+ }
54
+
55
+ @doc("Contains fields of the same type that have different XML representation.")
56
+ @name("ModelWithRenamedFieldsSrc")
57
+ model ModelWithRenamedFields {
58
+ @name("InputData") inputData: SimpleModel;
59
+ @name("OutputData") outputData: SimpleModel;
60
+ }
61
+
62
+ @doc("Contains an array of models that's supposed to be sent/received as an empty XML element.")
63
+ model ModelWithEmptyArray {
64
+ items: SimpleModel[];
65
+ }
66
+
67
+ @doc("Contains an attribute and text.")
68
+ model ModelWithText {
69
+ @attribute language: string;
70
+ @unwrapped content: string;
71
+ }
72
+
73
+ @doc("Contains a dictionary of key value pairs.")
74
+ model ModelWithDictionary {
75
+ metadata: Record<string>;
76
+ }
77
+
78
+ @doc("Uses encodedName instead of Xml.Name which is functionally equivalent.")
79
+ @encodedName("application/xml", "ModelWithEncodedNamesSrc")
80
+ model ModelWithEncodedNames {
81
+ @encodedName("application/xml", "SimpleModelData") modelData: SimpleModel;
82
+ @encodedName("application/xml", "PossibleColors") colors: string[];
83
+ }
84
+
85
+ @doc("Template for XML operations")
86
+ interface XmlOperations<TModel, TDoc extends valueof string> {
87
+ @scenario
88
+ @scenarioDoc("""
89
+ Expected response body:
90
+ ```xml
91
+ ${TDoc}
92
+ ```
93
+ """)
94
+ @get
95
+ get(): {
96
+ @header("content-type") contentType: "application/xml";
97
+ @body body: TModel;
98
+ };
99
+
100
+ @scenario
101
+ @scenarioDoc("""
102
+ Expected request body:
103
+ ```xml
104
+ ${TDoc}
105
+ ```
106
+ """)
107
+ @put
108
+ put(@header("content-type") contentType: "application/xml", @body input: TModel): void;
109
+ }
110
+
111
+ @doc("Operations for the SimpleModel type.")
112
+ @route("/simpleModel")
113
+ interface SimpleModelValue
114
+ extends XmlOperations<
115
+ SimpleModel,
116
+ """
117
+ <SimpleModel>
118
+ <name>foo</name>
119
+ <age>123</age>
120
+ </SimpleModel>
121
+ """
122
+ > {}
123
+
124
+ @doc("Operations for the ModelWithSimpleArrays type.")
125
+ @route("/modelWithSimpleArrays")
126
+ interface ModelWithSimpleArraysValue
127
+ extends XmlOperations<
128
+ ModelWithSimpleArrays,
129
+ """
130
+ <ModelWithSimpleArrays>
131
+ <colors>
132
+ <string>red</string>
133
+ <string>green</string>
134
+ <string>blue</string>
135
+ </colors>
136
+ <counts>
137
+ <int32>1</int32>
138
+ <int32>2</int32>
139
+ </counts>
140
+ </ModelWithSimpleArrays>
141
+ """
142
+ > {}
143
+
144
+ @doc("Operations for the ModelWithArrayOfModel type.")
145
+ @route("/modelWithArrayOfModel")
146
+ interface ModelWithArrayOfModelValue
147
+ extends XmlOperations<
148
+ ModelWithArrayOfModel,
149
+ """
150
+ <ModelWithArrayOfModel>
151
+ <items>
152
+ <SimpleModel>
153
+ <name>foo</name>
154
+ <age>123</age>
155
+ </SimpleModel>
156
+ <SimpleModel>
157
+ <name>bar</name>
158
+ <age>456</age>
159
+ </SimpleModel>
160
+ </items>
161
+ </ModelWithArrayOfModel>
162
+ """
163
+ > {}
164
+
165
+ @doc("Operations for the ModelWithOptionalField type.")
166
+ @route("/modelWithOptionalField")
167
+ interface ModelWithOptionalFieldValue
168
+ extends XmlOperations<
169
+ ModelWithOptionalField,
170
+ """
171
+ <ModelWithOptionalField>
172
+ <item>widget</item>
173
+ </ModelWithOptionalField>
174
+ """
175
+ > {}
176
+
177
+ @doc("Operations for the ModelWithAttributes type.")
178
+ @route("/modelWithAttributes")
179
+ interface ModelWithAttributesValue
180
+ extends XmlOperations<
181
+ ModelWithAttributes,
182
+ """
183
+ <ModelWithAttributes id1="123" id2="foo">
184
+ <enabled>true</enabled>
185
+ </ModelWithAttributes>
186
+ """
187
+ > {}
188
+
189
+ @doc("Operations for the ModelWithUnwrappedArray type.")
190
+ @route("/modelWithUnwrappedArray")
191
+ interface ModelWithUnwrappedArrayValue
192
+ extends XmlOperations<
193
+ ModelWithUnwrappedArray,
194
+ """
195
+ <ModelWithUnwrappedArray>
196
+ <colors>red</colors>
197
+ <colors>green</colors>
198
+ <colors>blue</colors>
199
+ <counts>
200
+ <int32>1</int32>
201
+ <int32>2</int32>
202
+ </counts>
203
+ </ModelWithUnwrappedArray>
204
+ """
205
+ > {}
206
+
207
+ @doc("Operations for the ModelWithRenamedArrays type.")
208
+ @route("/modelWithRenamedArrays")
209
+ interface ModelWithRenamedArraysValue
210
+ extends XmlOperations<
211
+ ModelWithRenamedArrays,
212
+ """
213
+ <ModelWithRenamedArrays>
214
+ <Colors>red</Colors>
215
+ <Colors>green</Colors>
216
+ <Colors>blue</Colors>
217
+ <Counts>
218
+ <int32>1</int32>
219
+ <int32>2</int32>
220
+ </Counts>
221
+ </ModelWithRenamedArrays>
222
+ """
223
+ > {}
224
+
225
+ @doc("Operations for the ModelWithRenamedFields type.")
226
+ @route("/modelWithRenamedFields")
227
+ interface ModelWithRenamedFieldsValue
228
+ extends XmlOperations<
229
+ ModelWithRenamedFields,
230
+ """
231
+ <ModelWithRenamedFieldsSrc>
232
+ <InputData>
233
+ <name>foo</name>
234
+ <age>123</age>
235
+ </InputData>
236
+ <OutputData>
237
+ <name>bar</name>
238
+ <age>456</age>
239
+ </OutputData>
240
+ </ModelWithRenamedFieldsSrc>
241
+ """
242
+ > {}
243
+
244
+ @doc("Operations for the ModelWithEmptyArray type.")
245
+ @route("/modelWithEmptyArray")
246
+ interface ModelWithEmptyArrayValue
247
+ extends XmlOperations<
248
+ ModelWithEmptyArray,
249
+ """
250
+ <ModelWithEmptyArray>
251
+ <items />
252
+ </ModelWithEmptyArray>
253
+ """
254
+ > {}
255
+
256
+ @doc("Operations for the ModelWithText type.")
257
+ @route("/modelWithText")
258
+ interface ModelWithTextValue
259
+ extends XmlOperations<
260
+ ModelWithText,
261
+ """
262
+ <ModelWithText language="foo">
263
+ This is some text.
264
+ </ModelWithText>
265
+ """
266
+ > {}
267
+
268
+ @doc("Operations for the ModelWithDictionary type.")
269
+ @route("/modelWithDictionary")
270
+ interface ModelWithDictionaryValue
271
+ extends XmlOperations<
272
+ ModelWithDictionary,
273
+ """
274
+ <ModelWithDictionary>
275
+ <metadata>
276
+ <Color>blue</Color>
277
+ <Count>123</Count>
278
+ <Enabled>false</Enabled>
279
+ </metadata>
280
+ </ModelWithDictionary>
281
+ """
282
+ > {}
283
+
284
+ @doc("Operations for the ModelWithEncodedNames type.")
285
+ @route("/modelWithEncodedNames")
286
+ interface ModelWithEncodedNamesValue
287
+ extends XmlOperations<
288
+ ModelWithEncodedNames,
289
+ """
290
+ <ModelWithEncodedNamesSrc>
291
+ <SimpleModelData>
292
+ <name>foo</name>
293
+ <age>123</age>
294
+ </SimpleModelData>
295
+ <PossibleColors>
296
+ <string>red</string>
297
+ <string>green</string>
298
+ <string>blue</string>
299
+ </PossibleColors>
300
+ </ModelWithEncodedNamesSrc>
301
+ """
302
+ > {}