@azure-tools/typespec-azure-core 0.71.0-dev.4 → 0.71.0-dev.7
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/README.md +1 -0
- package/dist/src/linter.d.ts.map +1 -1
- package/dist/src/linter.js +2 -0
- package/dist/src/linter.js.map +1 -1
- package/dist/src/rules/no-openapi-client-extensions.d.ts +4 -0
- package/dist/src/rules/no-openapi-client-extensions.d.ts.map +1 -0
- package/dist/src/rules/no-openapi-client-extensions.js +69 -0
- package/dist/src/rules/no-openapi-client-extensions.js.map +1 -0
- package/dist/src/rules/no-openapi.d.ts.map +1 -1
- package/dist/src/rules/no-openapi.js +5 -0
- package/dist/src/rules/no-openapi.js.map +1 -1
- package/lib/auth.tsp +7 -0
- package/lib/foundations.tsp +2 -2
- package/lib/legacy.tsp +2 -0
- package/lib/models.tsp +4 -1
- package/lib/traits.tsp +10 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -70,6 +70,7 @@ Available ruleSets:
|
|
|
70
70
|
| [`@azure-tools/typespec-azure-core/no-legacy-usage`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/no-legacy-usage) | Linter warning against using elements from the Legacy namespace |
|
|
71
71
|
| [`@azure-tools/typespec-azure-core/no-query-explode`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/no-query-explode) | It is recommended to serialize query parameter without explode: true |
|
|
72
72
|
| [`@azure-tools/typespec-azure-core/no-route-parameter-name-mismatch`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/no-route-parameter-name-mismatch) | Ensure that operations with the same path use consistent path parameter names. |
|
|
73
|
+
| [`@azure-tools/typespec-azure-core/no-openapi-client-extensions`](https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/no-openapi-client-extensions) | Azure specs should not use @typespec/openapi @extension to emit client-altering x-ms-* extensions |
|
|
73
74
|
|
|
74
75
|
## Decorators
|
|
75
76
|
|
package/dist/src/linter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AAyFA,eAAO,MAAM,OAAO,+CASlB,CAAC"}
|
package/dist/src/linter.js
CHANGED
|
@@ -18,6 +18,7 @@ import { noLegacyUsage } from "./rules/no-legacy-usage.js";
|
|
|
18
18
|
import { noMultipleDiscriminatorRule } from "./rules/no-multiple-discriminator.js";
|
|
19
19
|
import { noNullableRule } from "./rules/no-nullable.js";
|
|
20
20
|
import { noOffsetDateTimeRule } from "./rules/no-offsetdatetime.js";
|
|
21
|
+
import { noOpenapiClientExtensionsRule } from "./rules/no-openapi-client-extensions.js";
|
|
21
22
|
import { noOpenAPIRule } from "./rules/no-openapi.js";
|
|
22
23
|
import { noPrivateUsage } from "./rules/no-private-usage.js";
|
|
23
24
|
import { noQueryExplodeRule } from "./rules/no-query-explode.js";
|
|
@@ -82,6 +83,7 @@ const rules = [
|
|
|
82
83
|
noLegacyUsage,
|
|
83
84
|
noQueryExplodeRule,
|
|
84
85
|
noRouteParameterNameMismatchRule,
|
|
86
|
+
noOpenapiClientExtensionsRule,
|
|
85
87
|
];
|
|
86
88
|
export const $linter = defineLinter({
|
|
87
89
|
rules,
|
package/dist/src/linter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linter.js","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,C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G;IACZ,cAAc;IACd,gBAAgB;IAChB,aAAa;IACb,QAAQ;IACR,UAAU;IACV,8BAA8B;IAC9B,iBAAiB;IACjB,4CAA4C;IAC5C,kBAAkB;IAClB,wBAAwB;IACxB,UAAU;IACV,sBAAsB;IACtB,2BAA2B;IAC3B,yBAAyB;IACzB,oBAAoB;IACpB,cAAc;IACd,oBAAoB;IACpB,kBAAkB;IAClB,mBAAmB;IACnB,aAAa;IACb,kBAAkB;IAClB,mBAAmB;IACnB,iBAAiB;IACjB,2BAA2B;IAC3B,4BAA4B;IAC5B,kBAAkB;IAClB,iBAAiB;IACjB,oBAAoB;IACpB,oBAAoB;IACpB,iCAAiC;IACjC,2BAA2B;IAC3B,4BAA4B;IAC5B,gBAAgB;IAChB,qBAAqB;IACrB,yBAAyB;IACzB,oBAAoB;IACpB,gBAAgB;IAChB,cAAc;IACd,aAAa;IACb,kBAAkB;IAClB,gCAAgC;IAChC,6BAA6B;CAC9B,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,YAAY,CAAC;IAClC,KAAK;IACL,QAAQ,EAAE;QACR,sBAAsB,EAAE;YACtB,MAAM,EAAE;gBACN,CAAC,oCAAoC,yBAAyB,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI;aAC7E;SACF;KACF;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const noOpenapiClientExtensionsRule: import("@typespec/compiler").LinterRuleDefinition<"no-openapi-client-extensions", {
|
|
2
|
+
readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
3
|
+
}, Record<string, never>>;
|
|
4
|
+
//# sourceMappingURL=no-openapi-client-extensions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-openapi-client-extensions.d.ts","sourceRoot":"","sources":["../../../src/rules/no-openapi-client-extensions.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,6BAA6B;;yBAyCxC,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { createRule, fileRef, getTypeName, paramMessage, } from "@typespec/compiler";
|
|
2
|
+
/**
|
|
3
|
+
* OpenAPI (`x-ms-*` / `x-*`) extensions that alter how clients, SDKs, or the ARM
|
|
4
|
+
* platform interpret an API. Emitting them through the raw `@typespec/openapi`
|
|
5
|
+
* `@extension` decorator only affects the OpenAPI output, so non-OpenAPI emitters
|
|
6
|
+
* (client SDKs, service code, etc.) never see them and produce an incorrect
|
|
7
|
+
* representation of the API. Each of these has a first-class TypeSpec construct
|
|
8
|
+
* that should be used instead.
|
|
9
|
+
*/
|
|
10
|
+
const clientAlteringExtensions = new Set([
|
|
11
|
+
"x-ms-skip-url-encoding",
|
|
12
|
+
"x-ms-enum",
|
|
13
|
+
"x-ms-parameter-grouping",
|
|
14
|
+
"x-ms-parameter-location",
|
|
15
|
+
"x-ms-client-name",
|
|
16
|
+
"x-ms-discriminator-value",
|
|
17
|
+
"x-ms-client-flatten",
|
|
18
|
+
"x-ms-parameterized-host",
|
|
19
|
+
"x-ms-pageable",
|
|
20
|
+
"x-ms-long-running-operation",
|
|
21
|
+
"x-ms-long-running-operation-options",
|
|
22
|
+
"x-nullable",
|
|
23
|
+
"x-ms-internal",
|
|
24
|
+
"x-ms-azure-resource",
|
|
25
|
+
"x-ms-arm-id-details",
|
|
26
|
+
"x-ms-secret",
|
|
27
|
+
]);
|
|
28
|
+
export const noOpenapiClientExtensionsRule = createRule({
|
|
29
|
+
name: "no-openapi-client-extensions",
|
|
30
|
+
description: "Azure specs should not use @typespec/openapi @extension to emit client-altering x-ms-* extensions",
|
|
31
|
+
severity: "warning",
|
|
32
|
+
url: "https://azure.github.io/typespec-azure/docs/libraries/azure-core/rules/no-openapi-client-extensions",
|
|
33
|
+
docs: fileRef.fromPackageRoot("src/rules/no-openapi-client-extensions.md"),
|
|
34
|
+
messages: {
|
|
35
|
+
default: paramMessage `Do not use the @typespec/openapi @extension decorator to emit the client-altering "${"name"}" extension. It only affects the OpenAPI output, so client SDKs and other emitters will produce an incorrect representation of the API. Use the corresponding TypeSpec construct instead.`,
|
|
36
|
+
},
|
|
37
|
+
create(context) {
|
|
38
|
+
function checkDecorators(type) {
|
|
39
|
+
for (const dec of type.decorators) {
|
|
40
|
+
if (dec.definition?.name !== "@extension") {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const namespace = getTypeName(dec.definition.namespace);
|
|
44
|
+
if (namespace !== "TypeSpec.OpenAPI") {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
const key = dec.args?.[0]?.jsValue;
|
|
48
|
+
if (typeof key === "string" && clientAlteringExtensions.has(key)) {
|
|
49
|
+
context.reportDiagnostic({
|
|
50
|
+
target: dec.node ?? type,
|
|
51
|
+
format: { name: key },
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
model: checkDecorators,
|
|
58
|
+
modelProperty: checkDecorators,
|
|
59
|
+
enum: checkDecorators,
|
|
60
|
+
enumMember: checkDecorators,
|
|
61
|
+
union: checkDecorators,
|
|
62
|
+
unionVariant: checkDecorators,
|
|
63
|
+
operation: checkDecorators,
|
|
64
|
+
interface: checkDecorators,
|
|
65
|
+
namespace: checkDecorators,
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=no-openapi-client-extensions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-openapi-client-extensions.js","sourceRoot":"","sources":["../../../src/rules/no-openapi-client-extensions.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EACV,OAAO,EACP,WAAW,EACX,YAAY,GACb,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;GAOG;AACH,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAS;IAC/C,wBAAwB;IACxB,WAAW;IACX,yBAAyB;IACzB,yBAAyB;IACzB,kBAAkB;IAClB,0BAA0B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AAI,EAAE,eAAe;YACrB,UAAU,EAAE,eAAe;YAC3B,KAAK,EAAE,eAAe;YACtB,YAAY,EAAE,eAAe;YAC7B,SAAS,EAAE,eAAe;YAC1B,SAAS,EAAE,eAAe;YAC1B,SAAS,EAAE,eAAe;SAC3B,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-openapi.d.ts","sourceRoot":"","sources":["../../../src/rules/no-openapi.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,aAAa;;;;;
|
|
1
|
+
{"version":3,"file":"no-openapi.d.ts","sourceRoot":"","sources":["../../../src/rules/no-openapi.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,aAAa;;;;;yBA+CxB,CAAC"}
|
|
@@ -15,6 +15,11 @@ export const noOpenAPIRule = createRule({
|
|
|
15
15
|
function checkDecorators(type) {
|
|
16
16
|
for (const dec of type.decorators) {
|
|
17
17
|
if (dec.definition) {
|
|
18
|
+
// `@extension` is allowed by this rule. Client-altering extensions are
|
|
19
|
+
// handled by the `no-openapi-client-extensions` rule instead.
|
|
20
|
+
if (dec.definition.name === "@extension") {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
18
23
|
const id = getTypeName(dec.definition.namespace);
|
|
19
24
|
if (id === "TypeSpec.OpenAPI" || id === "Autorest") {
|
|
20
25
|
context.reportDiagnostic({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-openapi.js","sourceRoot":"","sources":["../../../src/rules/no-openapi.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,EACV,OAAO,EACP,WAAW,EACX,YAAY,GACb,MAAM,oBAAoB,CAAC;AAE5B,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC;IACtC,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,yBAAyB,CAAC;IACxD,WAAW,EACT,qGAAqG;IACvG,QAAQ,EAAE,S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AU,CAAC;yBACxC,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO;YACL,KAAK,EAAE,eAAe;YACtB,aAAa,EAAE,eAAe;YAC9B,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,eAAe;YACtB,SAAS,EAAE,eAAe;YAC1B,UAAU,EAAE,eAAe;YAC3B,YAAY,EAAE,eAAe;YAC7B,SAAS,EAAE,eAAe;YAC1B,SAAS,EAAE,eAAe;SAC3B,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,SAAS,YAAY,CAAC,GAAc;IAClC,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;QACjB,KAAK,cAAc;YACjB,OAAO,aAAa,CAAC;QACvB,KAAK,SAAS;YACZ,OAAO,QAAQ,CAAC;QAClB,KAAK,UAAU;YACb,OAAO,SAAS,CAAC;QACnB;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC"}
|
package/lib/auth.tsp
CHANGED
|
@@ -19,9 +19,16 @@ namespace Azure.Core;
|
|
|
19
19
|
*/
|
|
20
20
|
model AadTokenAuthFlow<Scopes extends string[], AuthUrl extends string, TokenUrl extends string>
|
|
21
21
|
extends TypeSpec.Http.AuthorizationCodeFlow {
|
|
22
|
+
/** The OAuth2 flow type, always the authorization code flow. */
|
|
22
23
|
type: OAuth2FlowType.authorizationCode;
|
|
24
|
+
|
|
25
|
+
/** The authorization URL used to obtain an authorization code. */
|
|
23
26
|
authorizationUrl: AuthUrl;
|
|
27
|
+
|
|
28
|
+
/** The token URL used to exchange the authorization code for a token. */
|
|
24
29
|
tokenUrl: TokenUrl;
|
|
30
|
+
|
|
31
|
+
/** The list of scopes the token applies to. */
|
|
25
32
|
scopes: Scopes;
|
|
26
33
|
}
|
|
27
34
|
|
package/lib/foundations.tsp
CHANGED
|
@@ -80,7 +80,7 @@ alias ResourceCreatedOrOkResponse<Resource extends TypeSpec.Reflection.Model> =
|
|
|
80
80
|
|
|
81
81
|
/**
|
|
82
82
|
* Response describing the location of a created resource.
|
|
83
|
-
* @template
|
|
83
|
+
* @template Resource The type of the created resource.
|
|
84
84
|
*/
|
|
85
85
|
model LocationOfCreatedResourceResponse<Resource extends TypeSpec.Reflection.Model>
|
|
86
86
|
is TypeSpec.Http.CreatedResponse {
|
|
@@ -91,7 +91,7 @@ model LocationOfCreatedResourceResponse<Resource extends TypeSpec.Reflection.Mod
|
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
93
|
* Response describing the location of a resource created with a service-provided name.
|
|
94
|
-
* @template
|
|
94
|
+
* @template Resource The type of the created resource.
|
|
95
95
|
*/
|
|
96
96
|
model LocationOfCreatedResourceWithServiceProvidedNameResponse<Resource extends TypeSpec.Reflection.Model>
|
|
97
97
|
is TypeSpec.Http.AcceptedResponse {
|
package/lib/legacy.tsp
CHANGED
|
@@ -18,6 +18,8 @@ namespace Azure.Core.Legacy;
|
|
|
18
18
|
* @nextLink nextLink: Azure.Core.Legacy.parameterizedNextLink<[ListCertificateOptions.includePending]>;
|
|
19
19
|
* }
|
|
20
20
|
* ```
|
|
21
|
+
*
|
|
22
|
+
* @template ParameterizedParams The model properties whose values must be reapplied to the next link.
|
|
21
23
|
*/
|
|
22
24
|
@Azure.Core.Foundations.Private.parameterizedNextLinkConfig(ParameterizedParams)
|
|
23
25
|
scalar parameterizedNextLink<ParameterizedParams extends TypeSpec.Reflection.ModelProperty[]>
|
package/lib/models.tsp
CHANGED
|
@@ -38,11 +38,12 @@ model RequestParameter<Name extends valueof string> {}
|
|
|
38
38
|
model ResponseProperty<Name extends valueof string> {}
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* Provides the status of a resource operation.
|
|
42
42
|
* @template Resource The resource type.
|
|
43
43
|
* @template StatusResult Model describing the status result object. If not specified, the default is the resource type.
|
|
44
44
|
* @template StatusError Model describing the status error object. If not specified, the default is the Foundations.Error.
|
|
45
45
|
*/
|
|
46
|
+
@doc("Provides status details for long running operations.")
|
|
46
47
|
@resource("operations")
|
|
47
48
|
@parentResource(Resource)
|
|
48
49
|
model ResourceOperationStatus<
|
|
@@ -383,6 +384,7 @@ scalar armResourceIdentifier<AllowedResourceTypes extends ArmResourceIdentifierA
|
|
|
383
384
|
extends string;
|
|
384
385
|
|
|
385
386
|
// Consider replacing `*`
|
|
387
|
+
/** The deployment scopes in which an Azure Resource Manager resource identifier may be used. */
|
|
386
388
|
union ArmResourceDeploymentScope {
|
|
387
389
|
"Tenant",
|
|
388
390
|
"Subscription",
|
|
@@ -401,6 +403,7 @@ alias AllArmResourceDeploymentScopes = [
|
|
|
401
403
|
"Extension"
|
|
402
404
|
];
|
|
403
405
|
|
|
406
|
+
/** Describes a resource type, and the scopes it applies to, that an `armResourceIdentifier` is allowed to refer to. */
|
|
404
407
|
model ArmResourceIdentifierAllowedResource {
|
|
405
408
|
/** The type of resource that is being referred to. For example Microsoft.Network/virtualNetworks or Microsoft.Network/virtualNetworks/subnets. See Example Types for more examples. */
|
|
406
409
|
type: armResourceType;
|
package/lib/traits.tsp
CHANGED
|
@@ -62,6 +62,7 @@ model TraitOverride<Trait extends Model> {}
|
|
|
62
62
|
@trait
|
|
63
63
|
@Private.ensureAllQueryParams(Parameters)
|
|
64
64
|
model QueryParametersTrait<Parameters extends Model, Contexts = unknown> {
|
|
65
|
+
/** The query parameters contributed by this trait. */
|
|
65
66
|
@traitContext(Contexts)
|
|
66
67
|
queryParams: {
|
|
67
68
|
@traitLocation(TraitLocation.Parameters)
|
|
@@ -87,6 +88,7 @@ model ListQueryParametersTrait<Parameters extends Model> is QueryParametersTrait
|
|
|
87
88
|
@trait
|
|
88
89
|
@Private.ensureAllHeaderParams(Headers)
|
|
89
90
|
model RequestHeadersTrait<Headers extends Model, Contexts = unknown> {
|
|
91
|
+
/** The request headers contributed by this trait. */
|
|
90
92
|
@traitContext(Contexts)
|
|
91
93
|
requestHeaders: {
|
|
92
94
|
@traitLocation(TraitLocation.Parameters)
|
|
@@ -102,6 +104,7 @@ model RequestHeadersTrait<Headers extends Model, Contexts = unknown> {
|
|
|
102
104
|
@trait
|
|
103
105
|
@Private.ensureAllHeaderParams(Headers)
|
|
104
106
|
model ResponseHeadersTrait<Headers extends Model, Contexts = unknown> {
|
|
107
|
+
/** The response headers contributed by this trait. */
|
|
105
108
|
@traitContext(Contexts)
|
|
106
109
|
responseHeaders: {
|
|
107
110
|
@traitLocation(TraitLocation.Response)
|
|
@@ -115,6 +118,7 @@ model ResponseHeadersTrait<Headers extends Model, Contexts = unknown> {
|
|
|
115
118
|
*/
|
|
116
119
|
@trait("VersionParameter")
|
|
117
120
|
model VersionParameterTrait<VersionParameter> {
|
|
121
|
+
/** The API version parameter contributed by this trait. */
|
|
118
122
|
versionParameter: {
|
|
119
123
|
@traitLocation(TraitLocation.ApiVersionParameter)
|
|
120
124
|
apiVersionParam: VersionParameter;
|
|
@@ -129,6 +133,7 @@ model VersionParameterTrait<VersionParameter> {
|
|
|
129
133
|
@trait("ClientRequestId")
|
|
130
134
|
@traitAdded(VersionAdded)
|
|
131
135
|
model SupportsClientRequestId<VersionAdded extends EnumMember | null = null> {
|
|
136
|
+
/** The client request id headers contributed by this trait. */
|
|
132
137
|
#suppress "@azure-tools/typespec-providerhub/no-inline-model" "This inline model is never used directly in operations."
|
|
133
138
|
clientRequestId: {
|
|
134
139
|
@traitLocation(TraitLocation.Parameters)
|
|
@@ -144,6 +149,7 @@ model SupportsClientRequestId<VersionAdded extends EnumMember | null = null> {
|
|
|
144
149
|
*/
|
|
145
150
|
@trait("ClientRequestId")
|
|
146
151
|
model NoClientRequestId {
|
|
152
|
+
/** Empty, indicating that client request id headers are not supported. */
|
|
147
153
|
clientRequestId: {};
|
|
148
154
|
}
|
|
149
155
|
|
|
@@ -155,6 +161,7 @@ model NoClientRequestId {
|
|
|
155
161
|
@trait("ConditionalRequests")
|
|
156
162
|
@traitAdded(VersionAdded)
|
|
157
163
|
model SupportsConditionalRequests<VersionAdded extends EnumMember | null = null> {
|
|
164
|
+
/** The conditional request headers and ETag headers contributed by this trait. */
|
|
158
165
|
#suppress "@azure-tools/typespec-providerhub/no-inline-model" "This inline model is never used directly in operations."
|
|
159
166
|
conditionalRequests: {
|
|
160
167
|
@traitContext(
|
|
@@ -174,6 +181,7 @@ model SupportsConditionalRequests<VersionAdded extends EnumMember | null = null>
|
|
|
174
181
|
*/
|
|
175
182
|
@trait("ConditionalRequests")
|
|
176
183
|
model NoConditionalRequests {
|
|
184
|
+
/** Empty, indicating that conditional requests are not supported. */
|
|
177
185
|
conditionalRequests: {};
|
|
178
186
|
}
|
|
179
187
|
|
|
@@ -185,6 +193,7 @@ model NoConditionalRequests {
|
|
|
185
193
|
@trait("RepeatableRequests")
|
|
186
194
|
@traitAdded(VersionAdded)
|
|
187
195
|
model SupportsRepeatableRequests<VersionAdded extends EnumMember | null = null> {
|
|
196
|
+
/** The repeatable request headers contributed by this trait. */
|
|
188
197
|
#suppress "@azure-tools/typespec-providerhub/no-inline-model" "This inline model is never used directly in operations."
|
|
189
198
|
@traitContext(
|
|
190
199
|
TraitContext.Create | TraitContext.Update | TraitContext.Delete | TraitContext.Action
|
|
@@ -203,6 +212,7 @@ model SupportsRepeatableRequests<VersionAdded extends EnumMember | null = null>
|
|
|
203
212
|
*/
|
|
204
213
|
@trait("RepeatableRequests")
|
|
205
214
|
model NoRepeatableRequests {
|
|
215
|
+
/** Empty, indicating that repeatable requests are not supported. */
|
|
206
216
|
repeatableRequests: {};
|
|
207
217
|
}
|
|
208
218
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure-tools/typespec-azure-core",
|
|
3
|
-
"version": "0.71.0-dev.
|
|
3
|
+
"version": "0.71.0-dev.7",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec Azure Core library",
|
|
6
6
|
"homepage": "https://azure.github.io/typespec-azure",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"!dist/test/**"
|
|
48
48
|
],
|
|
49
49
|
"peerDependencies": {
|
|
50
|
+
"@typespec/http": "^1.14.0",
|
|
50
51
|
"@typespec/compiler": "^1.14.0",
|
|
51
|
-
"@typespec/rest": "^0.84.0"
|
|
52
|
-
"@typespec/http": "^1.14.0"
|
|
52
|
+
"@typespec/rest": "^0.84.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/node": "^26.0.0",
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
"vitest": "^4.1.3",
|
|
61
61
|
"@typespec/compiler": "^1.14.0",
|
|
62
62
|
"@typespec/http": "^1.14.0",
|
|
63
|
-
"@typespec/openapi": "^1.14.0",
|
|
64
63
|
"@typespec/library-linter": "^0.84.0",
|
|
65
|
-
"@typespec/
|
|
64
|
+
"@typespec/openapi": "^1.14.0",
|
|
66
65
|
"@typespec/rest": "^0.84.0",
|
|
66
|
+
"@typespec/tspd": "^0.76.0",
|
|
67
67
|
"@typespec/versioning": "^0.84.0"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|