@azure-tools/typespec-azure-core 0.31.0-dev.14 → 0.31.0-dev.15
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/dist/src/linter.d.ts.map +1 -1
- package/dist/src/linter.js +0 -2
- package/dist/src/linter.js.map +1 -1
- package/lib/decorators.tsp +10 -14
- package/lib/foundations.tsp +2 -2
- package/lib/traits.tsp +4 -4
- package/package.json +1 -1
- package/dist/src/rules/no-object.d.ts +0 -2
- package/dist/src/rules/no-object.d.ts.map +0 -1
- package/dist/src/rules/no-object.js +0 -42
- package/dist/src/rules/no-object.js.map +0 -1
package/dist/src/linter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAgE7C,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,QAM3C"}
|
package/dist/src/linter.js
CHANGED
|
@@ -10,7 +10,6 @@ import { longRunningOperationsRequirePollingOperation } from "./rules/lro-pollin
|
|
|
10
10
|
import { noExplicitRoutesResourceOps } from "./rules/no-explicit-routes-resource-ops.js";
|
|
11
11
|
import { noFixedEnumDiscriminatorRule } from "./rules/no-fixed-enum-discriminator.js";
|
|
12
12
|
import { noNullableRule } from "./rules/no-nullable.js";
|
|
13
|
-
import { noObjectRule } from "./rules/no-object.js";
|
|
14
13
|
import { noOffsetDateTimeRule } from "./rules/no-offsetdatetime.js";
|
|
15
14
|
import { operationIdRule } from "./rules/no-operation-id.js";
|
|
16
15
|
import { noRpcPathParamsRule } from "./rules/no-rpc-path-params.js";
|
|
@@ -39,7 +38,6 @@ linter.registerRules([
|
|
|
39
38
|
useStandardOperations,
|
|
40
39
|
noFixedEnumDiscriminatorRule,
|
|
41
40
|
noNullableRule,
|
|
42
|
-
noObjectRule,
|
|
43
41
|
noOffsetDateTimeRule,
|
|
44
42
|
noRpcPathParamsRule,
|
|
45
43
|
noExplicitRoutesResourceOps,
|
package/dist/src/linter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linter.js","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,4CAA4C,EAAE,MAAM,kCAAkC,CAAC;AAChG,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"linter.js","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAA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AAS,CAAC,IAAI,CAAC,CAAC;AAC/B,MAAM,CAAC,aAAa,CAClB;IACE,eAAe;IACf,aAAa;IACb,QAAQ;IACR,cAAc;IACd,UAAU;IACV,6BAA6B;IAC7B,kBAAkB;IAClB,iBAAiB;IACjB,qBAAqB;IACrB,4BAA4B;IAC5B,cAAc;IACd,oBAAoB;IACpB,mBAAmB;IACnB,2BAA2B;IAC3B,gBAAgB;IAChB,4BAA4B;IAC5B,4BAA4B;IAC5B,kBAAkB;IAClB,cAAc;IACd,iCAAiC;IACjC,gBAAgB;IAChB,oBAAoB;IACpB,oBAAoB;IACpB,4CAA4C;IAC5C,0FAA0F;IAC1F,oBAAoB;CACrB,EACD;IACE,UAAU,EAAE,IAAI;CACjB,CACF,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,MAAM,CAAC,eAAe,EAAE,CAAC;IACzB,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAE/B,wBAAwB;IACxB,cAAc,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC"}
|
package/lib/decorators.tsp
CHANGED
|
@@ -11,7 +11,7 @@ namespace Azure {
|
|
|
11
11
|
/**
|
|
12
12
|
* Marks a Model as a paged collection.
|
|
13
13
|
*/
|
|
14
|
-
extern dec pagedResult(entity:
|
|
14
|
+
extern dec pagedResult(entity: Model);
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Identifies the ModelProperty that contains the paged items. Can only be used on a Model marked with `@pagedResult`.
|
|
@@ -65,7 +65,7 @@ namespace Azure {
|
|
|
65
65
|
entity: Operation,
|
|
66
66
|
linkedOperation: Operation,
|
|
67
67
|
linkType: string,
|
|
68
|
-
parameters?:
|
|
68
|
+
parameters?: {}
|
|
69
69
|
);
|
|
70
70
|
|
|
71
71
|
/**
|
|
@@ -74,7 +74,7 @@ namespace Azure {
|
|
|
74
74
|
* @param parameters Map of `RequestParameter<T>` and/or `ResponseProperty<T>` that will
|
|
75
75
|
* be passed to the linked operation request.
|
|
76
76
|
*/
|
|
77
|
-
extern dec pollingOperation(entity: Operation, linkedOperation: Operation, parameters?:
|
|
77
|
+
extern dec pollingOperation(entity: Operation, linkedOperation: Operation, parameters?: {});
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
80
|
* Identifies that an operation is the final operation for an LRO.
|
|
@@ -82,7 +82,7 @@ namespace Azure {
|
|
|
82
82
|
* @param parameters Map of `RequestParameter<T>` and/or `ResponseProperty<T>` that will
|
|
83
83
|
* be passed to the linked operation request.
|
|
84
84
|
*/
|
|
85
|
-
extern dec finalOperation(entity: Operation, linkedOperation: Operation, parameters?:
|
|
85
|
+
extern dec finalOperation(entity: Operation, linkedOperation: Operation, parameters?: {});
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
88
|
* Identifies that an operation is used to retrieve the next page for paged operations.
|
|
@@ -90,11 +90,7 @@ namespace Azure {
|
|
|
90
90
|
* @param parameters Map of `RequestParameter<T>` and/or `ResponseProperty<T>` that will
|
|
91
91
|
* be passed to the linked operation request.
|
|
92
92
|
*/
|
|
93
|
-
extern dec nextPageOperation(
|
|
94
|
-
entity: Operation,
|
|
95
|
-
linkedOperation: Operation,
|
|
96
|
-
parameters?: object
|
|
97
|
-
);
|
|
93
|
+
extern dec nextPageOperation(entity: Operation, linkedOperation: Operation, parameters?: {});
|
|
98
94
|
}
|
|
99
95
|
}
|
|
100
96
|
|
|
@@ -104,19 +100,19 @@ namespace Azure {
|
|
|
104
100
|
/**
|
|
105
101
|
* Deletes any key properties from the model.
|
|
106
102
|
*/
|
|
107
|
-
extern dec omitKeyProperties(entity:
|
|
103
|
+
extern dec omitKeyProperties(entity: Model);
|
|
108
104
|
|
|
109
105
|
/**
|
|
110
106
|
* Identifies a property on a request model that serves as a linked operation parameter.
|
|
111
107
|
* @param name Property name on the target
|
|
112
108
|
*/
|
|
113
|
-
extern dec requestParameter(entity:
|
|
109
|
+
extern dec requestParameter(entity: Model, name: string);
|
|
114
110
|
|
|
115
111
|
/**
|
|
116
112
|
* Identifies a property on *all* non-error response models that serve as a linked operation parameter.
|
|
117
113
|
* @param name Property name on the target
|
|
118
114
|
*/
|
|
119
|
-
extern dec responseProperty(entity:
|
|
115
|
+
extern dec responseProperty(entity: Model, name: string);
|
|
120
116
|
}
|
|
121
117
|
}
|
|
122
118
|
}
|
|
@@ -129,13 +125,13 @@ namespace Azure {
|
|
|
129
125
|
* Provides a Model describing parameter customizations to spread into the target.
|
|
130
126
|
* @param customizations Model describing the customization to spread
|
|
131
127
|
*/
|
|
132
|
-
extern dec spreadCustomParameters(entity:
|
|
128
|
+
extern dec spreadCustomParameters(entity: Model, customizations: {});
|
|
133
129
|
|
|
134
130
|
/**
|
|
135
131
|
* Provides a Model describing response property customizations to spread into the target.
|
|
136
132
|
* @param customizations Model describing the customization to spread
|
|
137
133
|
*/
|
|
138
|
-
extern dec spreadCustomResponseProperties(entity:
|
|
134
|
+
extern dec spreadCustomResponseProperties(entity: Model, customizations: {});
|
|
139
135
|
|
|
140
136
|
/**
|
|
141
137
|
* Checks the TResource parameter of an operation signature to ensure it's a valid resource type.
|
package/lib/foundations.tsp
CHANGED
|
@@ -258,10 +258,10 @@ model CustomPage<
|
|
|
258
258
|
@doc("The expected shape of model types passed to the TCustom parameter of operation signatures.")
|
|
259
259
|
model CustomizationFields {
|
|
260
260
|
@doc("An object containing custom parameters that will be included in the operation.")
|
|
261
|
-
parameters?:
|
|
261
|
+
parameters?: {};
|
|
262
262
|
|
|
263
263
|
@doc("An object containing custom properties that will be included in the response.")
|
|
264
|
-
response?:
|
|
264
|
+
response?: {};
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
// Basic Operation Shapes
|
package/lib/traits.tsp
CHANGED
|
@@ -238,13 +238,13 @@ extern dec traitLocation(target: ModelProperty, contexts: EnumMember);
|
|
|
238
238
|
* to either a trait model type or its envelope property.
|
|
239
239
|
* @param addedVersion The enum member representing the service version.
|
|
240
240
|
*/
|
|
241
|
-
extern dec traitAdded(target:
|
|
241
|
+
extern dec traitAdded(target: Model | ModelProperty, addedVersion: EnumMember | null);
|
|
242
242
|
|
|
243
243
|
namespace Azure.Core.Traits.Private {
|
|
244
244
|
@added(Azure.Core.Versions.v1_0_Preview_2)
|
|
245
245
|
@Private.addTraitProperties(Traits, Location, Contexts)
|
|
246
246
|
model TraitProperties<
|
|
247
|
-
Traits extends
|
|
247
|
+
Traits extends Model,
|
|
248
248
|
Location extends TypeSpec.Reflection.EnumMember,
|
|
249
249
|
Contexts = unknown
|
|
250
250
|
> {}
|
|
@@ -280,8 +280,8 @@ namespace Azure {
|
|
|
280
280
|
* @param traitContexts The trait contexts to use for selecting trait properties.
|
|
281
281
|
*/
|
|
282
282
|
extern dec addTraitProperties(
|
|
283
|
-
target:
|
|
284
|
-
traitModel:
|
|
283
|
+
target: Model,
|
|
284
|
+
traitModel: Model,
|
|
285
285
|
traitLocation: EnumMember,
|
|
286
286
|
traitContexts: EnumMember | Union | unknown
|
|
287
287
|
);
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"no-object.d.ts","sourceRoot":"","sources":["../../../src/rules/no-object.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,YAAY,mCAmCvB,CAAC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { createRule } from "@typespec/lint";
|
|
2
|
-
import { reportDiagnostic } from "../lib.js";
|
|
3
|
-
import { isExcludedCoreType } from "./utils.js";
|
|
4
|
-
export const noObjectRule = createRule({
|
|
5
|
-
name: "no-object",
|
|
6
|
-
create({ program }) {
|
|
7
|
-
const [objectType] = program.resolveTypeReference("TypeSpec.object");
|
|
8
|
-
const reportIfObject = (program, type, target) => {
|
|
9
|
-
if (type === objectType) {
|
|
10
|
-
reportDiagnostic(program, {
|
|
11
|
-
code: "no-object",
|
|
12
|
-
target,
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
return {
|
|
17
|
-
model: (model) => {
|
|
18
|
-
if (isExcludedCoreType(program, model))
|
|
19
|
-
return;
|
|
20
|
-
if (model.baseModel) {
|
|
21
|
-
reportIfObject(program, model.baseModel, model);
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
modelProperty: (property) => {
|
|
25
|
-
if (isExcludedCoreType(program, property))
|
|
26
|
-
return;
|
|
27
|
-
reportIfObject(program, property.type, property);
|
|
28
|
-
},
|
|
29
|
-
unionVariant: (variant) => {
|
|
30
|
-
if (isExcludedCoreType(program, variant))
|
|
31
|
-
return;
|
|
32
|
-
reportIfObject(program, variant.type, variant);
|
|
33
|
-
},
|
|
34
|
-
operation: (operation) => {
|
|
35
|
-
if (isExcludedCoreType(program, operation))
|
|
36
|
-
return;
|
|
37
|
-
reportIfObject(program, operation.returnType, operation);
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
//# sourceMappingURL=no-object.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"no-object.js","sourceRoot":"","sources":["../../../src/rules/no-object.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;IACrC,IAAI,EAAE,WAAW;IACjB,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,MAAM,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;QAErE,MAAM,cAAc,GAAG,CAAC,OAAgB,EAAE,IAAU,EAAE,MAAwB,EAAE,EAAE;YAChF,IAAI,IAAI,KAAK,UAAU,EAAE;gBACvB,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,WAAW;oBACjB,MAAM;iBACP,CAAC,CAAC;aACJ;QACH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