@microsoft/typespec-msgraph 1.0.0-Preview.2 → 1.0.0-Preview.4
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 +4 -0
- package/dist/src/components/common-elements.d.ts +2 -0
- package/dist/src/components/common-elements.d.ts.map +1 -1
- package/dist/src/components/common-elements.js +15 -1
- package/dist/src/components/common-elements.js.map +1 -1
- package/dist/src/components/entity-container-element.d.ts +1 -0
- package/dist/src/components/entity-container-element.d.ts.map +1 -1
- package/dist/src/components/entity-container-element.js +1 -1
- package/dist/src/components/entity-container-element.js.map +1 -1
- package/dist/src/components/reference-target-element.d.ts.map +1 -1
- package/dist/src/components/schema-element.d.ts.map +1 -1
- package/dist/src/components/schema-element.js +1 -1
- package/dist/src/components/schema-element.js.map +1 -1
- package/dist/src/decorators/allowed-values.d.ts.map +1 -1
- package/dist/src/decorators/allowed-values.js +20 -2
- package/dist/src/decorators/allowed-values.js.map +1 -1
- package/dist/src/decorators/container.d.ts +10 -0
- package/dist/src/decorators/container.d.ts.map +1 -0
- package/dist/src/decorators/container.js +29 -0
- package/dist/src/decorators/container.js.map +1 -0
- package/dist/src/decorators/graph-partial.d.ts.map +1 -1
- package/dist/src/decorators/graph-route.d.ts.map +1 -1
- package/dist/src/decorators/graph-route.js +1 -1
- package/dist/src/decorators/graph-route.js.map +1 -1
- package/dist/src/decorators/index.d.ts +1 -0
- package/dist/src/decorators/index.d.ts.map +1 -1
- package/dist/src/decorators/index.js +1 -0
- package/dist/src/decorators/index.js.map +1 -1
- package/dist/src/emitter.d.ts +1 -0
- package/dist/src/emitter.d.ts.map +1 -1
- package/dist/src/emitter.js +16 -8
- package/dist/src/emitter.js.map +1 -1
- package/dist/src/entities/annotations.d.ts.map +1 -1
- package/dist/src/entities/annotations.js +7 -5
- package/dist/src/entities/annotations.js.map +1 -1
- package/dist/src/entities/model.d.ts.map +1 -1
- package/dist/src/entities/model.js +7 -6
- package/dist/src/entities/model.js.map +1 -1
- package/dist/src/entities/namespace.d.ts +1 -0
- package/dist/src/entities/namespace.d.ts.map +1 -1
- package/dist/src/entities/namespace.js +5 -3
- package/dist/src/entities/namespace.js.map +1 -1
- package/dist/src/entities/operation.js +2 -2
- package/dist/src/entities/operation.js.map +1 -1
- package/dist/src/entities/property.d.ts +1 -1
- package/dist/src/entities/property.d.ts.map +1 -1
- package/dist/src/entities/property.js +6 -18
- package/dist/src/entities/property.js.map +1 -1
- package/dist/src/lib.d.ts +10 -1
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +18 -6
- package/dist/src/lib.js.map +1 -1
- package/dist/src/linter.d.ts.map +1 -1
- package/dist/src/linter.js +26 -2
- package/dist/src/linter.js.map +1 -1
- package/dist/src/rules/allowed-values.d.ts +3 -0
- package/dist/src/rules/allowed-values.d.ts.map +1 -1
- package/dist/src/rules/allowed-values.js +32 -1
- package/dist/src/rules/allowed-values.js.map +1 -1
- package/dist/src/rules/collections.d.ts +4 -0
- package/dist/src/rules/collections.d.ts.map +1 -0
- package/dist/src/rules/collections.js +32 -0
- package/dist/src/rules/collections.js.map +1 -0
- package/dist/src/rules/contains.d.ts +6 -0
- package/dist/src/rules/contains.d.ts.map +1 -1
- package/dist/src/rules/contains.js +64 -4
- package/dist/src/rules/contains.js.map +1 -1
- package/dist/src/rules/entity.d.ts +3 -0
- package/dist/src/rules/entity.d.ts.map +1 -1
- package/dist/src/rules/entity.js +48 -1
- package/dist/src/rules/entity.js.map +1 -1
- package/dist/src/rules/enum.d.ts +9 -0
- package/dist/src/rules/enum.d.ts.map +1 -1
- package/dist/src/rules/enum.js +79 -3
- package/dist/src/rules/enum.js.map +1 -1
- package/dist/src/rules/index.d.ts +2 -0
- package/dist/src/rules/index.d.ts.map +1 -1
- package/dist/src/rules/index.js +2 -0
- package/dist/src/rules/index.js.map +1 -1
- package/dist/src/rules/limited-charset.d.ts.map +1 -1
- package/dist/src/rules/model.d.ts +3 -0
- package/dist/src/rules/model.d.ts.map +1 -1
- package/dist/src/rules/model.js +62 -20
- package/dist/src/rules/model.js.map +1 -1
- package/dist/src/rules/namespace.js +1 -1
- package/dist/src/rules/namespace.js.map +1 -1
- package/dist/src/rules/properties.d.ts +10 -0
- package/dist/src/rules/properties.d.ts.map +1 -0
- package/dist/src/rules/properties.js +118 -0
- package/dist/src/rules/properties.js.map +1 -0
- package/dist/src/supressions/csdl-suppression-rules.d.ts +8 -0
- package/dist/src/supressions/csdl-suppression-rules.d.ts.map +1 -0
- package/dist/src/supressions/csdl-suppression-rules.js +28 -0
- package/dist/src/supressions/csdl-suppression-rules.js.map +1 -0
- package/dist/src/supressions/path-util.d.ts +17 -0
- package/dist/src/supressions/path-util.d.ts.map +1 -0
- package/dist/src/supressions/path-util.js +65 -0
- package/dist/src/supressions/path-util.js.map +1 -0
- package/dist/src/supressions/suppression-collector.d.ts +10 -0
- package/dist/src/supressions/suppression-collector.d.ts.map +1 -0
- package/dist/src/supressions/suppression-collector.js +158 -0
- package/dist/src/supressions/suppression-collector.js.map +1 -0
- package/dist/src/utils.d.ts +8 -2
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +61 -4
- package/dist/src/utils.js.map +1 -1
- package/lib/decorators.tsp +10 -0
- package/lib/schema-Prod-v1.0.tsp +312 -0
- package/package.json +23 -18
package/dist/src/rules/model.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createRule, navigateTypesInNamespace, paramMessage } from "@typespec/compiler";
|
|
2
|
-
import { extractTypesFromUnion, getTypeModel, isExcludedCoreType, isTypeDefinedInExternalLibrary } from "../utils.js";
|
|
1
|
+
import { createRule, navigateTypesInNamespace, paramMessage, } from "@typespec/compiler";
|
|
2
|
+
import { extractTypesFromUnion, getTypeModel, isExcludedCoreType, isTypeDefinedInExternalLibrary, } from "../utils.js";
|
|
3
3
|
import { isEntity, isComplex, isContains, isOperationParameters } from "../index.js";
|
|
4
4
|
import { GetDeclaredNamespaces } from "../entities/namespace.js";
|
|
5
5
|
import { reportDiagnostic } from "../lib.js";
|
|
@@ -23,14 +23,13 @@ export function validateModelShouldBeEntityOrComplexType(program) {
|
|
|
23
23
|
code: "model-invalid-use",
|
|
24
24
|
target: model,
|
|
25
25
|
format: {
|
|
26
|
-
model: model.name
|
|
26
|
+
model: model.name,
|
|
27
27
|
},
|
|
28
28
|
});
|
|
29
29
|
},
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
;
|
|
34
33
|
export const containedNavigationPropertyTypeShouldNotBeExternallyReferenced = createRule({
|
|
35
34
|
name: "contained-navigation-property-type-should-not-be-externally-referenced",
|
|
36
35
|
severity: "warning",
|
|
@@ -44,25 +43,27 @@ export const containedNavigationPropertyTypeShouldNotBeExternallyReferenced = cr
|
|
|
44
43
|
const properties = model.properties;
|
|
45
44
|
for (const [_, property] of properties) {
|
|
46
45
|
const propertyType = getTypeModel(context.program, property.type);
|
|
47
|
-
if (propertyType &&
|
|
46
|
+
if (propertyType &&
|
|
47
|
+
isContains(context.program, property) &&
|
|
48
|
+
isTypeDefinedInExternalLibrary(context.program, propertyType)) {
|
|
48
49
|
context.reportDiagnostic({
|
|
49
50
|
target: property,
|
|
50
51
|
format: {
|
|
51
|
-
property: property.name
|
|
52
|
-
}
|
|
52
|
+
property: property.name,
|
|
53
|
+
},
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
}
|
|
57
|
+
},
|
|
57
58
|
};
|
|
58
|
-
}
|
|
59
|
+
},
|
|
59
60
|
});
|
|
60
61
|
export const operationParametersShouldHaveRequiredBeforeOptional = createRule({
|
|
61
62
|
name: "operation-parameters-should-have-required-before-optional",
|
|
62
63
|
severity: "warning",
|
|
63
64
|
description: "Operation parameters should have required parameters before optional ones",
|
|
64
65
|
messages: {
|
|
65
|
-
default: paramMessage `Required parameters should appear before optional parameters in @operationParameters
|
|
66
|
+
default: paramMessage `Required parameters should appear before optional parameters in @operationParameters.`,
|
|
66
67
|
},
|
|
67
68
|
create(context) {
|
|
68
69
|
return {
|
|
@@ -78,13 +79,13 @@ export const operationParametersShouldHaveRequiredBeforeOptional = createRule({
|
|
|
78
79
|
else if (foundOptional) {
|
|
79
80
|
context.reportDiagnostic({
|
|
80
81
|
target: param,
|
|
81
|
-
format: {}
|
|
82
|
+
format: {},
|
|
82
83
|
});
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
|
-
}
|
|
86
|
+
},
|
|
86
87
|
};
|
|
87
|
-
}
|
|
88
|
+
},
|
|
88
89
|
});
|
|
89
90
|
export function validatePropertyTypeIsNotStringLiteral(program) {
|
|
90
91
|
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
@@ -95,21 +96,20 @@ export function validatePropertyTypeIsNotStringLiteral(program) {
|
|
|
95
96
|
}
|
|
96
97
|
// To skip cases like '@path value:"$value"', '@header contentType: "image/*"'
|
|
97
98
|
const propDecoratorToSkip = ["@path", "@header"];
|
|
98
|
-
const propDecorators = property.decorators
|
|
99
|
-
|
|
100
|
-
if (propDecoratorToSkip.some(value => propDecorators.includes(value))) {
|
|
99
|
+
const propDecorators = property.decorators.map((decorator) => { var _a; return (_a = decorator.definition) === null || _a === void 0 ? void 0 : _a.name; });
|
|
100
|
+
if (propDecoratorToSkip.some((value) => propDecorators.includes(value))) {
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
if (property.type.kind === "Union") {
|
|
104
104
|
const unionTypes = extractTypesFromUnion(property.type);
|
|
105
|
-
unionTypes.forEach(type => {
|
|
105
|
+
unionTypes.forEach((type) => {
|
|
106
106
|
reportModelPropertyTypeDiagnostics(program, property, type.kind);
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
else {
|
|
110
110
|
reportModelPropertyTypeDiagnostics(program, property, property.type.kind);
|
|
111
111
|
}
|
|
112
|
-
}
|
|
112
|
+
},
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -124,8 +124,50 @@ function reportModelPropertyTypeDiagnostics(program, property, propertyTypeKind)
|
|
|
124
124
|
messageId: "propertyTypeCannotBeStringLiteral",
|
|
125
125
|
format: {
|
|
126
126
|
property: property.name,
|
|
127
|
-
type: propertyTypeKind.toLowerCase()
|
|
128
|
-
}
|
|
127
|
+
type: propertyTypeKind.toLowerCase(),
|
|
128
|
+
},
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
|
+
export const shouldNotUseUnnecessaryInheritance = createRule({
|
|
132
|
+
name: "should-not-use-unnecessary-inheritance",
|
|
133
|
+
severity: "warning",
|
|
134
|
+
description: "Identifies unnecessary inheritance hierarchies where a base type has only one derived type and is not used elsewhere",
|
|
135
|
+
messages: {
|
|
136
|
+
default: paramMessage `Base type '${"baseType"}' is only inherited by '${"derivedType"}' and is not used elsewhere. Consider merging the properties into asingle type to simplify the model. If you intend to add more types derived from '${"baseType"}' in the future, you may suppress this warning`,
|
|
137
|
+
},
|
|
138
|
+
create(context) {
|
|
139
|
+
return {
|
|
140
|
+
model: (model) => {
|
|
141
|
+
// Only check entity and complex types
|
|
142
|
+
const { baseModel } = model;
|
|
143
|
+
if (!baseModel ||
|
|
144
|
+
(!isEntity(context.program, model) && !isComplex(context.program, model))) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (isExcludedCoreType(context.program, baseModel) ||
|
|
148
|
+
isTypeDefinedInExternalLibrary(context.program, baseModel)) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const derivedTypes = [];
|
|
152
|
+
for (const namespace of GetDeclaredNamespaces(context.program)) {
|
|
153
|
+
for (const [_, model] of namespace.models) {
|
|
154
|
+
if (model.baseModel === baseModel) {
|
|
155
|
+
derivedTypes.push(model);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (derivedTypes.length !== 1) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
context.reportDiagnostic({
|
|
163
|
+
target: model,
|
|
164
|
+
format: {
|
|
165
|
+
baseType: baseModel.name,
|
|
166
|
+
derivedType: model.name,
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
},
|
|
172
|
+
});
|
|
131
173
|
//# sourceMappingURL=model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/rules/model.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/rules/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,UAAU,EACV,wBAAwB,EACxB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,qBAAqB,EACrB,YAAY,EACZ,kBAAkB,EAClB,8BAA8B,GAC/B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,UAAU,wCAAwC,CAAC,OAAgB;IACvE,KAAK,MAAM,SAAS,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAE,CAAC;QACvD,wBAAwB,CAAC,SAAS,EAAE;YAClC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;gBACf,IAAI,kBAAkB,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,8BAA8B,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC;oBACzF,OAAO;gBACT,CAAC;gBAED,IAAI,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC;oBAC1D,OAAO;gBACT,CAAC;gBAED,MAAM,eAAe,GAAG,KAAK,CAAC,UAAU,CAAC;gBACzC,KAAK,MAAM,SAAS,IAAI,eAAe,EAA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BACxB,WAAW,EAAE,KAAK,CAAC,IAAI;qBACxB;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -51,7 +51,7 @@ export function validatePublicNamespaceName(program) {
|
|
|
51
51
|
}
|
|
52
52
|
;
|
|
53
53
|
export function validateTopLevelNamespaceMustHavePublicNamespace(program) {
|
|
54
|
-
const rootNamespace = program.
|
|
54
|
+
const rootNamespace = program.getGlobalNamespaceType();
|
|
55
55
|
for (const namespace of expandNamespaces(rootNamespace)) {
|
|
56
56
|
if (isTypeDefinedInExternalLibrary(program, namespace)) {
|
|
57
57
|
continue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"namespace.js","sourceRoot":"","sources":["../../../src/rules/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAW,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAC/F,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC9G,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAErG,MAAM,UAAU,2BAA2B,CAAC,OAAgB;IAC1D,KAAK,MAAM,SAAS,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAE,CAAC;QACvD,wBAAwB,CAAC,SAAS,EAAE;YAClC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;gBACf,IAAI,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;oBAC5C,OAAO;gBACT,CAAC;gBAED,OAAO,KAAK,C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AAE;gBACN,SAAS,EAAE,oBAAoB,CAAC,SAAS,CAAC;aAC3C;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAAA,CAAC;AAEF,MAAM,UAAU,6BAA6B,CAAC,OAAgB;IAC5D,KAAK,MAAM,SAAS,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAE,CAAC;QACvD,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,CAAC;YAC9C,OAAO;QACT,CAAC;QAED,MAAM,qBAAqB,GAAG,wBAAwB,CAAC,OAAO,EAAE,SAAS,CAAE,CAAC;QAE5E,IAAI,CAAC,0BAA0B,CAAC,qBAAqB,CAAC,EAAE,CAAC;YACvD,OAAO;QACT,CAAC;QAED,gBAAgB,CAAC,OAAO,EAAE;YACxB,IAAI,EAAE,uBAAuB;YAC7B,MAAM,EAAE,SAAS;YACjB,SAAS,EAAE,8BAA8B;YACzC,MAAM,EAAE;gBACN,SAAS,EAAE,oBAAoB,CAAC,SAAS,CAAC;aAC3C;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAAA,CAAC;AAEF,SAAS,0BAA0B,CAAC,SAAiB;IACnD,0DAA0D;IAC1D,wDAAwD;IACxD,MAAM,cAAc,GAAG,yBAAyB,CAAC;IACjD,OAAO,SAAS,KAAK,yBAAyB,IAAI,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACnF,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const useCreatedInPropertyNames: import("@typespec/compiler").LinterRuleDefinition<"use-created-in-property-names", {
|
|
2
|
+
readonly default: import("@typespec/compiler").CallableMessage<["property", "foundWord", "suggested"]>;
|
|
3
|
+
}>;
|
|
4
|
+
export declare const useModifiedInPropertyNames: import("@typespec/compiler").LinterRuleDefinition<"use-modified-in-property-names", {
|
|
5
|
+
readonly default: import("@typespec/compiler").CallableMessage<["property", "foundWord", "suggested"]>;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const useProperDefaultRecord: import("@typespec/compiler").LinterRuleDefinition<"use-proper-default-record", {
|
|
8
|
+
readonly default: import("@typespec/compiler").CallableMessage<["model"]>;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=properties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../../src/rules/properties.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,yBAAyB;;EAiCpC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;EAiCrC,CAAC;AAGH,eAAO,MAAM,sBAAsB;;EAoCjC,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { createRule, paramMessage } from "@typespec/compiler";
|
|
2
|
+
import { findOneOfWordsIC, toSameFirstCharCasingAs } from "../utils.js";
|
|
3
|
+
import { getActualType } from "../utils.js";
|
|
4
|
+
import { GetDeclaredNamespaces } from "../entities/namespace.js";
|
|
5
|
+
const CREATED_WORD_LIST = ["creation", "create"];
|
|
6
|
+
const MODIFIED_WORD_LIST = ["updated", "changed"];
|
|
7
|
+
export const useCreatedInPropertyNames = createRule({
|
|
8
|
+
name: "use-created-in-property-names",
|
|
9
|
+
severity: "warning",
|
|
10
|
+
description: "Enforce using 'created' instead of 'creation' or 'create' in property names.",
|
|
11
|
+
messages: {
|
|
12
|
+
default: paramMessage `Property '${"property"}' should use 'created' instead of '${"foundWord"}'. Consider renaming the property to '${"suggested"}' instead.`,
|
|
13
|
+
},
|
|
14
|
+
create(context) {
|
|
15
|
+
return {
|
|
16
|
+
modelProperty(property) {
|
|
17
|
+
const propertyName = property.name;
|
|
18
|
+
const flaggedWord = findOneOfWordsIC(propertyName, CREATED_WORD_LIST);
|
|
19
|
+
if (!flaggedWord) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const correctVariant = toSameFirstCharCasingAs('created', flaggedWord);
|
|
23
|
+
const suggestedPropertyName = propertyName.replace(flaggedWord, correctVariant);
|
|
24
|
+
context.reportDiagnostic({
|
|
25
|
+
target: property,
|
|
26
|
+
messageId: "default",
|
|
27
|
+
format: {
|
|
28
|
+
property: propertyName,
|
|
29
|
+
foundWord: flaggedWord,
|
|
30
|
+
suggested: suggestedPropertyName,
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
export const useModifiedInPropertyNames = createRule({
|
|
38
|
+
name: "use-modified-in-property-names",
|
|
39
|
+
severity: "warning",
|
|
40
|
+
description: "Enforce using 'modified' instead of 'updated' or 'changed' in property names.",
|
|
41
|
+
messages: {
|
|
42
|
+
default: paramMessage `Property '${"property"}' should use 'modified' instead of '${"foundWord"}'. Consider renaming the property to '${"suggested"}' instead.`,
|
|
43
|
+
},
|
|
44
|
+
create(context) {
|
|
45
|
+
return {
|
|
46
|
+
modelProperty(property) {
|
|
47
|
+
const propertyName = property.name;
|
|
48
|
+
const flaggedWord = findOneOfWordsIC(propertyName, MODIFIED_WORD_LIST);
|
|
49
|
+
if (!flaggedWord) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const correctVariant = toSameFirstCharCasingAs('modified', flaggedWord);
|
|
53
|
+
const suggestedPropertyName = propertyName.replace(flaggedWord, correctVariant);
|
|
54
|
+
context.reportDiagnostic({
|
|
55
|
+
target: property,
|
|
56
|
+
messageId: "default",
|
|
57
|
+
format: {
|
|
58
|
+
property: propertyName,
|
|
59
|
+
foundWord: flaggedWord,
|
|
60
|
+
suggested: suggestedPropertyName,
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
export const useProperDefaultRecord = createRule({
|
|
68
|
+
name: "use-proper-default-record",
|
|
69
|
+
severity: "warning",
|
|
70
|
+
description: "Identifies poor API design pattern where boolean isDefault property is used within collection items to indicate default item",
|
|
71
|
+
messages: {
|
|
72
|
+
default: paramMessage `Model '${"model"}' has an 'isDefault' boolean property and is used in collections. Consider exposing a separate property that directly references the default item instead of using boolean flags within collection items.`,
|
|
73
|
+
},
|
|
74
|
+
create(context) {
|
|
75
|
+
return {
|
|
76
|
+
modelProperty: (property) => {
|
|
77
|
+
// Check if this model has an isDefault boolean property
|
|
78
|
+
const propertyName = property.name;
|
|
79
|
+
if (!(propertyName.toLowerCase() === "isdefault" &&
|
|
80
|
+
property.type.kind === "Scalar" &&
|
|
81
|
+
property.type.name === "boolean")) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
// We found an isDefault property, now check if its containing model is used in collections
|
|
85
|
+
const model = property.model;
|
|
86
|
+
// Check if this model is used as a collection element anywhere in the program
|
|
87
|
+
if (isModelUsedInCollections(context.program, model)) {
|
|
88
|
+
context.reportDiagnostic({
|
|
89
|
+
target: property,
|
|
90
|
+
messageId: "default",
|
|
91
|
+
format: {
|
|
92
|
+
model: model.name,
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
/**
|
|
101
|
+
* Checks if a model is used as an element type in collections elsewhere in the program
|
|
102
|
+
*/
|
|
103
|
+
function isModelUsedInCollections(program, targetModel) {
|
|
104
|
+
// Walk through all types in the program to find collections using this model
|
|
105
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
106
|
+
for (const [_, model] of namespace.models) {
|
|
107
|
+
for (const [_, property] of model.properties) {
|
|
108
|
+
const type = property.type;
|
|
109
|
+
if (type.kind === "Union" || type.kind === "Model" && type.name === "Array") {
|
|
110
|
+
const actualType = getActualType(program, type);
|
|
111
|
+
return actualType === targetModel && model !== targetModel;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=properties.js.map
|
|
@@ -0,0 +1 @@
|
|
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,OAAO,EAAE,IAAI,CAAC,CAAC;oBAChD,OAAO,UAAU,KAAK,WAAW,IAAI,KAAK,KAAK,WAAW,CAAC;gBAC3D,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map of internal linter rule export names (without package scope)
|
|
3
|
+
* to the stable suppression codes used in CSDL.
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export declare const csdlSuppressionRules: Record<string, string | undefined>;
|
|
7
|
+
export declare function findCsdlValidationRule(linterRule: string): string | undefined;
|
|
8
|
+
//# sourceMappingURL=csdl-suppression-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csdl-suppression-rules.d.ts","sourceRoot":"","sources":["../../../src/supressions/csdl-suppression-rules.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAenE,CAAC;AAIF,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI7E"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const DEFAULT_RULE = "default";
|
|
2
|
+
/**
|
|
3
|
+
* Map of internal linter rule export names (without package scope)
|
|
4
|
+
* to the stable suppression codes used in CSDL.
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
export const csdlSuppressionRules = {
|
|
8
|
+
// Implemented rules
|
|
9
|
+
"use-evolvable-enum": "EnumShouldBeEvolvable",
|
|
10
|
+
"collection-should-not-be-enum": "EnumCollectionShouldBeFlaggedEnum",
|
|
11
|
+
"nullable-boolean-should-be-enum": "NullableBooleanShouldBeEnum",
|
|
12
|
+
"nullable-enums-should-add-additional-member": "NullableEnumsShouldAddAdditionalMember",
|
|
13
|
+
"contained-entity-should-not-have-entity-set": "ContainedNavPropertyShouldNotHaveEntitySet",
|
|
14
|
+
"should-not-use-unnecessary-inheritance": "ShouldNotUseUnnecessaryInheritance",
|
|
15
|
+
"reference-id-property-should-be-navigation-property": "ReferenceIdPropertyShouldBeNavigationProperty",
|
|
16
|
+
"use-proper-default-record": "UseProperDefaultRecord",
|
|
17
|
+
"use-created-in-property-names": "UseCreatedInPropertyName",
|
|
18
|
+
"use-modified-in-property-names": "UseModifiedInPropertyName",
|
|
19
|
+
// To be implemented
|
|
20
|
+
"collection-property-should-not-be-nullable": "CollectionPropertyShouldNotBeNullable",
|
|
21
|
+
DEFAULT_RULE: undefined
|
|
22
|
+
};
|
|
23
|
+
export function findCsdlValidationRule(linterRule) {
|
|
24
|
+
const rule = linterRule.split('/').pop();
|
|
25
|
+
const csdlRule = csdlSuppressionRules[rule !== null && rule !== void 0 ? rule : DEFAULT_RULE];
|
|
26
|
+
return csdlRule;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=csdl-suppression-rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csdl-suppression-rules.js","sourceRoot":"","sources":["../../../src/supressions/csdl-suppression-rules.ts"],"names":[],"mappings":"AAAA,MAAM,YAAY,GAAG,SAAS,CAAC;AAC/B;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAuC;IACtE,oBAAoB;IACpB,oBAAoB,EAAE,uBAAuB;IAC7C,+BAA+B,EAAE,mCAAmC;IACpE,iCAAiC,EAAE,6BAA6B;IAChE,6CAA6C,EAAE,wCAAwC;IACvF,6CAA6C,EAAE,4CAA4C;IAC3F,wCAAwC,EAAE,oCAAoC;IAC9E,qDAAqD,EAAE,+CAA+C;IACtG,2BAA2B,EAAE,wBAAwB;IACrD,+BAA+B,EAAE,0BAA0B;IAC3D,gCAAgC,EAAE,2BAA2B;IAC7D,oBAAoB;IACpB,4CAA4C,EAAE,uCAAuC;IACrF,YAAY,EAAE,SAAS;CACxB,CAAC;AAIF,MAAM,UAAU,sBAAsB,CAAC,UAAkB;IACvD,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;IACzC,MAAM,QAAQ,GAAG,oBAAoB,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,YAAY,CAAC,CAAC;IAC5D,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EmitContext, Program } from "@typespec/compiler";
|
|
2
|
+
import { MsGraphEmitterOptions } from "../lib.js";
|
|
3
|
+
import { TypeSpecScriptNode } from "@typespec/compiler/ast";
|
|
4
|
+
export declare function extractEnvAndVersionFromPath(filePath: string): {
|
|
5
|
+
env: string;
|
|
6
|
+
version: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function buildWorkloadKeyPath(context: EmitContext<MsGraphEmitterOptions>, outputDir: string): string;
|
|
9
|
+
export declare function getLocalProjectFile(program: Program): {
|
|
10
|
+
path: string;
|
|
11
|
+
sourceFile: TypeSpecScriptNode;
|
|
12
|
+
} | undefined;
|
|
13
|
+
export declare function createSuppressionFilePath(context: EmitContext<MsGraphEmitterOptions>, path: string): Promise<{
|
|
14
|
+
outputPath: string;
|
|
15
|
+
csdlPath: string;
|
|
16
|
+
}>;
|
|
17
|
+
//# sourceMappingURL=path-util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-util.d.ts","sourceRoot":"","sources":["../../../src/supressions/path-util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAc,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAI5D,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAY/F;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,CAAC,qBAAqB,CAAC,EAAE,SAAS,EAAC,MAAM,GAAG,MAAM,CAQ1G;AAaD,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,GACf;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,kBAAkB,CAAA;CAAE,GAAG,SAAS,CAY9D;AAED,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,WAAW,CAAC,qBAAqB,CAAC,EAC3C,IAAI,EAAE,MAAM,GACX,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAgCnD"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const NODE_MODULES_FILTER = "node_modules";
|
|
2
|
+
export function extractEnvAndVersionFromPath(filePath) {
|
|
3
|
+
// Extract filename from full path
|
|
4
|
+
const filename = filePath.split(/[/\\]/).pop() || "";
|
|
5
|
+
// Split by '-' and extract the second and third parts
|
|
6
|
+
const parts = filename.split("-");
|
|
7
|
+
// Default values if parsing fails
|
|
8
|
+
const env = parts.length > 1 ? parts[1].replace(/\.(ts|tsp)$/, "") : "Prod";
|
|
9
|
+
const version = parts.length > 2 ? parts[2].replace(/\.(ts|tsp)$/, "") : "v1.0";
|
|
10
|
+
return { env, version };
|
|
11
|
+
}
|
|
12
|
+
export function buildWorkloadKeyPath(context, outputDir) {
|
|
13
|
+
const { program, options } = context;
|
|
14
|
+
const csdlFileName = "schema.csdl";
|
|
15
|
+
const absoluteCsdlPath = `${outputDir}/${csdlFileName}`;
|
|
16
|
+
const baseDirectory = options.baseDir || program.projectRoot;
|
|
17
|
+
return makeRelativePath(absoluteCsdlPath, baseDirectory);
|
|
18
|
+
}
|
|
19
|
+
function makeRelativePath(absolutePath, basePath) {
|
|
20
|
+
if (!absolutePath.startsWith(basePath)) {
|
|
21
|
+
return absolutePath;
|
|
22
|
+
}
|
|
23
|
+
const relativePath = absolutePath.substring(basePath.length);
|
|
24
|
+
return relativePath.startsWith("/") || relativePath.startsWith("\\")
|
|
25
|
+
? relativePath.substring(1).replace(/\\/g, "/")
|
|
26
|
+
: relativePath.replace(/\\/g, "/");
|
|
27
|
+
}
|
|
28
|
+
export function getLocalProjectFile(program) {
|
|
29
|
+
const localFile = Array.from(program.sourceFiles)
|
|
30
|
+
.filter(([sourceFile]) => sourceFile.startsWith(program.projectRoot) && !sourceFile.includes(NODE_MODULES_FILTER))
|
|
31
|
+
.shift();
|
|
32
|
+
if (!localFile)
|
|
33
|
+
return undefined;
|
|
34
|
+
const [path, sourceFile] = localFile;
|
|
35
|
+
return { path, sourceFile };
|
|
36
|
+
}
|
|
37
|
+
export async function createSuppressionFilePath(context, path) {
|
|
38
|
+
//let's check if there's any csdl file in the folder and we are in a override folder
|
|
39
|
+
const isOverride = path.includes("override");
|
|
40
|
+
if (isOverride) {
|
|
41
|
+
// Check if there's a CSDL file in the output directory
|
|
42
|
+
const outputDir = path;
|
|
43
|
+
const fs = context.program.host;
|
|
44
|
+
try {
|
|
45
|
+
// Look for any .csdl files in the output directory
|
|
46
|
+
const files = await fs.readDir(outputDir);
|
|
47
|
+
const hasCsdlTspFile = files.some((file) => file.endsWith(".csdl") || file.endsWith(".tsp"));
|
|
48
|
+
if (hasCsdlTspFile) {
|
|
49
|
+
// If we're in override and there's a CSDL file, go one level up
|
|
50
|
+
const pathParts = outputDir.split(/[/\\]/);
|
|
51
|
+
const newPath = pathParts.slice(0, pathParts.length - 1).join("/");
|
|
52
|
+
return { outputPath: newPath, csdlPath: "override/" };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
// If we can't read the directory, fall back to default behavior
|
|
57
|
+
console.warn(`Warning: Could not read directory ${path}: ${error}`);
|
|
58
|
+
// Default case: suppression.json in the output directory
|
|
59
|
+
return { outputPath: path, csdlPath: "" };
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// Default case: suppression.json in the output directory
|
|
63
|
+
return { outputPath: path, csdlPath: "" };
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=path-util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-util.js","sourceRoot":"","sources":["../../../src/supressions/path-util.ts"],"names":[],"mappings":"AAIA,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAE3C,MAAM,UAAU,4BAA4B,CAAC,QAAgB;IAC3D,kCAAkC;IAClC,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;IAErD,sDAAsD;IACtD,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAElC,kCAAkC;IAClC,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAC5E,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAEhF,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,OAA2C,EAAE,SAAgB;IAChG,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IACrC,MAAM,YAAY,GAAG,aAAa,CAAC;IACnC,MAAM,gBAAgB,GAAG,GAAG,SAAS,IAAI,YAAY,EAAE,CAAC;IAExD,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC;IAE7D,OAAO,gBAAgB,C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S,GAAG,IAAI,CAAC;QACvB,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;QAEhC,IAAI,CAAC;YACH,mDAAmD;YACnD,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YAC1C,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAC/B,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAClE,CAAC;YAEF,IAAI,cAAc,EAAE,CAAC;gBACnB,gEAAgE;gBAChE,MAAM,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBAC3C,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACnE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;YACxD,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,gEAAgE;YAChE,OAAO,CAAC,IAAI,CAAC,qCAAqC,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC;YACpE,yDAAyD;YACzD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;QAC5C,CAAC;IACH,CAAC;IAED,yDAAyD;IACzD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EmitContext } from "@typespec/compiler";
|
|
2
|
+
import { TypeSpecScriptNode } from "@typespec/compiler/ast";
|
|
3
|
+
import { MsGraphEmitterOptions } from "../lib.js";
|
|
4
|
+
/**
|
|
5
|
+
* Collects suppressions from TypeSpec source files and merges them with existing suppressions.
|
|
6
|
+
* If a suppression.json file already exists in the output directory, new suppressions will be
|
|
7
|
+
* merged with the existing ones for the same CSDL path.
|
|
8
|
+
*/
|
|
9
|
+
export declare function collectSuppressions(context: EmitContext<MsGraphEmitterOptions>, path: string, sourceFile: TypeSpecScriptNode): Promise<Record<string, Record<string, string>> | undefined>;
|
|
10
|
+
//# sourceMappingURL=suppression-collector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suppression-collector.d.ts","sourceRoot":"","sources":["../../../src/supressions/suppression-collector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAUL,kBAAkB,EACnB,MAAM,wBAAwB,CAAC;AAQhC,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAMlD;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,WAAW,CAAC,qBAAqB,CAAC,EAC3C,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,kBAAkB,GAC7B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC,CAsB7D"}
|