@azure-tools/typespec-azure-core 0.34.0-dev.0 → 0.34.0-dev.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.
@@ -20,16 +20,18 @@ using Azure.Core.Traits.Private;
20
20
  * @template TResponse Object describing the response of the operation.
21
21
  * @template Traits Object describing the traits of the operation.
22
22
  * @template TErrorResponse Error response of the operation. If not specified, the default error response is used.
23
+ * @template TraitContexts Trait contexts applicable to the operation. Defaults to `TraitContext.Undefined` which means that only traits that always apply will appear. Can specify multiple using the | operator.
23
24
  */
24
25
  @Foundations.Private.needsRoute
25
26
  op RpcOperation<
26
27
  TParams extends TypeSpec.Reflection.Model,
27
28
  TResponse extends TypeSpec.Reflection.Model,
28
29
  Traits extends TypeSpec.Reflection.Model = {},
29
- TErrorResponse = Azure.Core.Foundations.ErrorResponse
30
+ TErrorResponse = Azure.Core.Foundations.ErrorResponse,
31
+ TraitContexts extends TraitContext = TraitContext.Undefined
30
32
  > is Foundations.Operation<
31
33
  TParams & TraitProperties<Traits, TraitLocation.Parameters>,
32
- TResponse & TraitProperties<Traits, TraitLocation.Response>,
34
+ TResponse & TraitProperties<Traits, TraitLocation.Response, TraitContexts>,
33
35
  Traits,
34
36
  TErrorResponse
35
37
  >;
@@ -42,6 +44,7 @@ op RpcOperation<
42
44
  * @template TStatusError Error response of the status operation. If not specified, the default error response is used.
43
45
  * @template Traits Object describing the traits of the operation.
44
46
  * @template TErrorResponse Error response of the operation. If not specified, the default error response is used.
47
+ * @template TraitContexts Trait contexts applicable to the operation. Defaults to `TraitContext.Undefined` which means that only traits that always apply will appear. Can specify multiple using the | operator.
45
48
  */
46
49
  @Foundations.Private.needsRoute
47
50
  @post
@@ -51,13 +54,14 @@ op LongRunningRpcOperation<
51
54
  TStatusResult extends TypeSpec.Reflection.Model,
52
55
  TStatusError = Foundations.Error,
53
56
  Traits extends TypeSpec.Reflection.Model = {},
54
- TErrorResponse = Azure.Core.Foundations.ErrorResponse
57
+ TErrorResponse = Azure.Core.Foundations.ErrorResponse,
58
+ TraitContexts extends TraitContext = TraitContext.Undefined
55
59
  > is Foundations.Operation<
56
60
  TParams & TraitProperties<Traits, TraitLocation.Parameters>,
57
61
  AcceptedResponse &
58
62
  ResourceOperationStatus<TResponse, TStatusResult, TStatusError> &
59
63
  Foundations.LongRunningStatusLocation<TStatusResult> &
60
- TraitProperties<Traits, TraitLocation.Response>,
64
+ TraitProperties<Traits, TraitLocation.Response, TraitContexts>,
61
65
  Traits,
62
66
  TErrorResponse
63
67
  >;
package/lib/traits.tsp CHANGED
@@ -44,6 +44,9 @@ enum TraitContext {
44
44
 
45
45
  @doc("Trait is applicable for resource actions.")
46
46
  Action,
47
+
48
+ @doc("Only traits that did not specify a trait context (and therefore always apply) will be exposed.")
49
+ Undefined,
47
50
  }
48
51
 
49
52
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-tools/typespec-azure-core",
3
- "version": "0.34.0-dev.0",
3
+ "version": "0.34.0-dev.2",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec Azure Core library",
6
6
  "homepage": "https://azure.github.io/typespec-azure",
@@ -42,7 +42,7 @@
42
42
  "!dist/test/**"
43
43
  ],
44
44
  "peerDependencies": {
45
- "@typespec/compiler": "~0.47.0 || >=0.48.0-dev <0.48.0",
45
+ "@typespec/compiler": "~0.47.1 || >=0.48.0-dev <0.48.0",
46
46
  "@typespec/http": "~0.47.0 || >=0.48.0-dev <0.48.0",
47
47
  "@typespec/rest": "~0.47.0 || >=0.48.0-dev <0.48.0"
48
48
  },
@@ -50,7 +50,7 @@
50
50
  "@typespec/lint": "~0.47.0 || >=0.48.0-dev <0.48.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@typespec/compiler": "~0.47.0 || >=0.48.0-dev <0.48.0",
53
+ "@typespec/compiler": "~0.47.1 || >=0.48.0-dev <0.48.0",
54
54
  "@typespec/http": "~0.47.0 || >=0.48.0-dev <0.48.0",
55
55
  "@typespec/rest": "~0.47.0 || >=0.48.0-dev <0.48.0",
56
56
  "@typespec/eslint-config-typespec": "~0.47.0 || >=0.48.0-dev <0.48.0",