You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(typespec-client-generator-core): support per-service api-version map for multi-service packages
The `api-version` emitter option now accepts either a string or a map from each service namespace's full name to its desired version. Services not listed in the map default to their latest version. Multi-service packages do not support the `all` value (in either form); it is ignored and treated as latest.
Resolves#4009
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Support a per-service `api-version` map for multi-service packages. The `api-version` emitter option now accepts either a string (applied to single service packages, or the `latest`/`all` keywords) or a map from each service namespace's full name to its desired version. Services not listed in the map default to their latest version.
Copy file name to clipboardExpand all lines: packages/typespec-client-generator-core/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,7 +64,7 @@ When set to `true`, the emitter will generate convenience methods for each servi
64
64
65
65
**Type:** `string`
66
66
67
-
Use this flag if you would like to generate the sdk only for a specific version. Default value is the latest version. Also accepts values `latest` and `all`.
67
+
Use this flag if you would like to generate the sdk only for a specific version. Default value is the latest version. Also accepts values `latest` and `all`. For multi-service packages, provide a map from each service namespace's full name to its desired version; services not listed default to their latest version.
Copy file name to clipboardExpand all lines: packages/typespec-client-generator-core/src/lib.ts
+22-6Lines changed: 22 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,27 @@ import {
5
5
UnbrandedSdkEmitterOptionsInterface,
6
6
}from"./internal-utils.js";
7
7
8
+
// `api-version` accepts either a string (single service / `latest` / `all`) or a
9
+
// map from service namespace full name to version (multi-service). ajv rejects a
10
+
// top-level `nullable` next to `anyOf`, so it is declared on each branch and the
11
+
// schema is cast to satisfy the strongly-typed options schema.
12
+
constapiVersionSchema={
13
+
anyOf: [
14
+
{
15
+
type: "string",
16
+
nullable: true,
17
+
},
18
+
{
19
+
type: "object",
20
+
additionalProperties: {type: "string"},
21
+
required: [],
22
+
nullable: true,
23
+
},
24
+
],
25
+
description:
26
+
"Use this flag if you would like to generate the sdk only for a specific version. Default value is the latest version. Also accepts values `latest` and `all`. For multi-service packages, provide a map from each service namespace's full name to its desired version; services not listed default to their latest version.",
"Use this flag if you would like to generate the sdk only for a specific version. Default value is the latest version. Also accepts values `latest` and `all`.",
0 commit comments