diff --git a/packages/http/CHANGELOG.json b/packages/http/CHANGELOG.json index b244f1b5280..b4c6c5418d5 100644 --- a/packages/http/CHANGELOG.json +++ b/packages/http/CHANGELOG.json @@ -1,6 +1,18 @@ { "name": "@typespec/http", "entries": [ + { + "version": "0.43.1", + "tag": "@typespec/http_v0.43.1", + "date": "Fri, 14 Apr 2023 15:09:01 GMT", + "comments": { + "patch": [ + { + "comment": "**Fix** query format not accepting anything other than `csv` and `multi`" + } + ] + } + }, { "version": "0.43.0", "tag": "@typespec/http_v0.43.0", diff --git a/packages/http/CHANGELOG.md b/packages/http/CHANGELOG.md index 7269fe28f41..81b45449866 100644 --- a/packages/http/CHANGELOG.md +++ b/packages/http/CHANGELOG.md @@ -1,6 +1,13 @@ # Change Log - @typespec/http -This log was last generated on Tue, 11 Apr 2023 18:49:17 GMT and should not be manually modified. +This log was last generated on Fri, 14 Apr 2023 15:09:01 GMT and should not be manually modified. + +## 0.43.1 +Fri, 14 Apr 2023 15:09:01 GMT + +### Patches + +- **Fix** query format not accepting anything other than `csv` and `multi` ## 0.43.0 Tue, 11 Apr 2023 18:49:17 GMT diff --git a/packages/http/package.json b/packages/http/package.json index 09afd8a08dc..76846deac35 100644 --- a/packages/http/package.json +++ b/packages/http/package.json @@ -1,6 +1,6 @@ { "name": "@typespec/http", - "version": "0.43.0", + "version": "0.43.1", "author": "Microsoft Corporation", "description": "TypeSpec HTTP protocol binding", "homepage": "https://github.com/Microsoft/typespec", diff --git a/packages/http/src/decorators.ts b/packages/http/src/decorators.ts index c7e5506ceaf..bfc5d4523a5 100644 --- a/packages/http/src/decorators.ts +++ b/packages/http/src/decorators.ts @@ -104,9 +104,7 @@ export function $query( } const format = queryNameOrOptions.properties.get("format")?.type; if (format?.kind === "String") { - if (format.value === "multi" || format.value === "csv") { - options.format = format.value; - } + options.format = format.value as any; // That value should have already been validated by the TypeSpec dec } } } diff --git a/packages/http/test/http-decorators.test.ts b/packages/http/test/http-decorators.test.ts index 129c9dc60a3..c43eae583ef 100644 --- a/packages/http/test/http-decorators.test.ts +++ b/packages/http/test/http-decorators.test.ts @@ -210,16 +210,19 @@ describe("http: decorators", () => { strictEqual(getQueryParamName(runner.program, select), "$select"); }); - it("override query with QueryOptions", async () => { - const { selects } = await runner.compile(` - @put op test(@test @query({name: "$select", format: "csv"}) selects: string[]): string; - `); - deepStrictEqual(getQueryParamOptions(runner.program, selects), { - type: "query", - name: "$select", - format: "csv", + describe("change format for array value", () => { + ["csv", "tsv", "ssv", "pipes"].forEach((format) => { + it(`set query format to "${format}"`, async () => { + const { selects } = await runner.compile(` + op test(@test @query({name: "$select", format: "${format}"}) selects: string[]): string; + `); + deepStrictEqual(getQueryParamOptions(runner.program, selects), { + type: "query", + name: "$select", + format, + }); + }); }); - strictEqual(getQueryParamName(runner.program, selects), "$select"); }); }); diff --git a/packages/openapi/package.json b/packages/openapi/package.json index 1567bd52dd7..d5aac2fa8a1 100644 --- a/packages/openapi/package.json +++ b/packages/openapi/package.json @@ -53,14 +53,14 @@ ], "peerDependencies": { "@typespec/compiler": "~0.43.0", - "@typespec/http": "~0.43.0", + "@typespec/http": "~0.43.1", "@typespec/rest": "~0.43.0" }, "devDependencies": { "@types/mocha": "~10.0.0", "@types/node": "~18.11.9", "@typespec/compiler": "~0.43.0", - "@typespec/http": "~0.43.0", + "@typespec/http": "~0.43.1", "@typespec/rest": "~0.43.0", "@typespec/eslint-config-typespec": "~0.6.0", "@typespec/library-linter": "~0.43.0", diff --git a/packages/openapi3/package.json b/packages/openapi3/package.json index 6d3ea160114..caa5abc47c6 100644 --- a/packages/openapi3/package.json +++ b/packages/openapi3/package.json @@ -57,7 +57,7 @@ "peerDependencies": { "@typespec/versioning": "~0.43.0", "@typespec/compiler": "~0.43.0", - "@typespec/http": "~0.43.0", + "@typespec/http": "~0.43.1", "@typespec/rest": "~0.43.0", "@typespec/openapi": "~0.43.0" }, @@ -66,7 +66,7 @@ "@types/node": "~18.11.9", "@types/js-yaml": "~4.0.1", "@typespec/compiler": "~0.43.0", - "@typespec/http": "~0.43.0", + "@typespec/http": "~0.43.1", "@typespec/rest": "~0.43.0", "@typespec/openapi": "~0.43.0", "@typespec/versioning": "~0.43.0", diff --git a/packages/playground/package.json b/packages/playground/package.json index 6e105e429e0..acf9b459764 100644 --- a/packages/playground/package.json +++ b/packages/playground/package.json @@ -43,7 +43,7 @@ "dependencies": { "@typespec/versioning": "~0.43.0", "@typespec/compiler": "~0.43.0", - "@typespec/http": "~0.43.0", + "@typespec/http": "~0.43.1", "@typespec/rest": "~0.43.0", "@typespec/openapi3": "~0.43.0", "@typespec/openapi": "~0.43.0", diff --git a/packages/rest/package.json b/packages/rest/package.json index 066a7b79393..3dbe9667a72 100644 --- a/packages/rest/package.json +++ b/packages/rest/package.json @@ -58,7 +58,7 @@ "@types/mocha": "~10.0.0", "@types/node": "~18.11.9", "@typespec/compiler": "~0.43.0", - "@typespec/http": "~0.43.0", + "@typespec/http": "~0.43.1", "@typespec/eslint-config-typespec": "~0.6.0", "@typespec/library-linter": "~0.43.0", "@typespec/eslint-plugin": "~0.43.0", diff --git a/packages/samples/package.json b/packages/samples/package.json index 5015a88f616..b8f0b5bc59d 100644 --- a/packages/samples/package.json +++ b/packages/samples/package.json @@ -36,7 +36,7 @@ "dependencies": { "@typespec/versioning": "~0.43.0", "@typespec/compiler": "~0.43.0", - "@typespec/http": "~0.43.0", + "@typespec/http": "~0.43.1", "@typespec/rest": "~0.43.0", "@typespec/openapi": "~0.43.0", "@typespec/openapi3": "~0.43.0", diff --git a/packages/website/package.json b/packages/website/package.json index 0ec6d1c8d79..34c15914441 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -33,7 +33,7 @@ "devDependencies": { "@typespec/ref-doc": "~0.1.0", "@typespec/spec": "0.1.0", - "@typespec/http": "~0.43.0", + "@typespec/http": "~0.43.1", "@typespec/rest": "~0.43.0", "@typespec/openapi": "~0.43.0", "@typespec/versioning": "~0.43.0",