@microsoft/typespec-msgraph 1.0.0-Preview.6 → 1.0.0-Preview.8
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/components/property-element.d.ts.map +1 -1
- package/dist/src/components/property-element.js +2 -2
- package/dist/src/components/property-element.js.map +1 -1
- package/dist/src/linter.d.ts +2 -1
- package/dist/src/linter.d.ts.map +1 -1
- package/dist/src/linter.js +3 -1
- package/dist/src/linter.js.map +1 -1
- package/dist/src/rules/collections.d.ts +3 -0
- package/dist/src/rules/collections.d.ts.map +1 -1
- package/dist/src/rules/collections.js +38 -0
- package/dist/src/rules/collections.js.map +1 -1
- package/dist/src/rules/naming.d.ts.map +1 -1
- package/dist/src/rules/naming.js +5 -1
- package/dist/src/rules/naming.js.map +1 -1
- package/dist/src/supressions/csdl-suppression-rules.d.ts.map +1 -1
- package/dist/src/supressions/csdl-suppression-rules.js +2 -1
- package/dist/src/supressions/csdl-suppression-rules.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property-element.d.ts","sourceRoot":"","sources":["../../../src/components/property-element.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKlC,OAAO,EAAE,oBAAoB,EAAwD,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"property-element.d.ts","sourceRoot":"","sources":["../../../src/components/property-element.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKlC,OAAO,EAAE,oBAAoB,EAAwD,MAAM,sBAAsB,CAAC;AAsBlH,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC;IAAE,QAAQ,EAAE,oBAAoB,CAAA;CAAE,CAGZ,CAAA"}
|
|
@@ -12,13 +12,13 @@ export const PropertyElement = ({ property }) => property.IsNavigation
|
|
|
12
12
|
? React.createElement(NavigationPropertyElement, { property: property })
|
|
13
13
|
: React.createElement(StructuralPropertyElement, { property: property });
|
|
14
14
|
const NavigationPropertyElement = ({ property }) => {
|
|
15
|
-
return (React.createElement(NavigationProperty, { Name: property.Name, Type: property.PropertyTypeName, ...(property.IsContained ? { ContainsTarget: "true" } : {}), ...(property.
|
|
15
|
+
return (React.createElement(NavigationProperty, { Name: property.Name, Type: property.PropertyTypeName, ...(property.IsContained ? { ContainsTarget: "true" } : {}), ...(property.IsCollection ? {} : (property.IsNullable ? { Nullable: "true" } : { Nullable: "false" })), ...property.AgsAttributes, ...property.AddressUrl, ...property.AddressUrlMsa, ...property.PassthroughAddressUrl, ...property.PassthroughAddressUrlMsa },
|
|
16
16
|
React.createElement(RevisionsAnnotation, { definition: property.RevisionDefinition }),
|
|
17
17
|
React.createElement(DescriptionAnnotation, { description: property.Description }),
|
|
18
18
|
property.DeltaProperties ? React.createElement(DeltaAnnotation, { deltaProperties: property.DeltaProperties }) : null));
|
|
19
19
|
};
|
|
20
20
|
const StructuralPropertyElement = ({ property }) => {
|
|
21
|
-
return (React.createElement(Property, { Name: property.Name, Type: property.PropertyTypeName, ...(property.IsNullable ? {} : { Nullable: "false" }), ...property.AgsAttributes, ...(property.SupportsLimitedCharset ? { Unicode: "false" } : {}), ...property.DefaultValue ? { DefaultValue: property.DefaultValue } : {}, ...property.MaxLength ? { MaxLength: property.MaxLength } : {} },
|
|
21
|
+
return (React.createElement(Property, { Name: property.Name, Type: property.PropertyTypeName, ...(property.IsNullable ? { Nullable: "true" } : { Nullable: "false" }), ...property.AgsAttributes, ...(property.SupportsLimitedCharset ? { Unicode: "false" } : {}), ...property.DefaultValue ? { DefaultValue: property.DefaultValue } : {}, ...property.MaxLength ? { MaxLength: property.MaxLength } : {} },
|
|
22
22
|
React.createElement(ComputedAnnotation, { isComputed: property.IsComputed }),
|
|
23
23
|
React.createElement(PermissionsAnnotation, { permission: property.Permission }),
|
|
24
24
|
React.createElement(RevisionsAnnotation, { definition: property.RevisionDefinition }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property-element.js","sourceRoot":"","sources":["../../../src/components/property-element.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAa,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAQxD,MAAM,QAAQ,GAAG,CAAC,KAAoB,EAAE,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"property-element.js","sourceRoot":"","sources":["../../../src/components/property-element.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAa,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAQxD,MAAM,QAAQ,GAAG,CAAC,KAAoB,EAAE,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AASlF,MAAM,kBAAkB,GA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ts","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AA2BpE,eAAO,MAAM,OAAO,EAAE,gBAyDpB,CAAC"}
|
package/dist/src/linter.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { defineLinter } from "@typespec/compiler";
|
|
2
|
-
import { useEvolvableEnumRule, collectionPropertyShouldNotBeNullable, collectionShouldNotBeEnum, mediaTypeValuesShouldBeMinimallyFormattedForMIMETypes, interfaceNavigationSourceShouldHaveMediaIf$ValueIsSpecified, getPutPostAndPatchOperationsShouldHaveSelectDecorator, useRecordTypeInsteadOfDictionary, dictionaryTypeIsMostlyUsedWithRecordType, containedNavigationPropertyTypeShouldNotBeExternallyReferenced, entityAndComplexPropertyNameShouldNotBeName, validateCoreElementsHaveDocString, operationParametersShouldHaveRequiredBeforeOptional, containedEntityShouldNotHaveEntitySet, referenceIdPropertyShouldBeNavigationProperty, useProperDefaultRecord, shouldNotUseUnnecessaryInheritance, namesMustBeCamelCase, nullableBooleanShouldBeEnum, nullableEnumsShouldAddAdditionalMember, allowedValuesCsdlCompatibility, useCreatedInPropertyNames, useModifiedInPropertyNames } from "./rules/index.js";
|
|
2
|
+
import { useEvolvableEnumRule, collectionPropertyShouldNotBeNullable, collectionShouldNotBeEnum, collectionOfComplexTypeShouldUseEntityType, mediaTypeValuesShouldBeMinimallyFormattedForMIMETypes, interfaceNavigationSourceShouldHaveMediaIf$ValueIsSpecified, getPutPostAndPatchOperationsShouldHaveSelectDecorator, useRecordTypeInsteadOfDictionary, dictionaryTypeIsMostlyUsedWithRecordType, containedNavigationPropertyTypeShouldNotBeExternallyReferenced, entityAndComplexPropertyNameShouldNotBeName, validateCoreElementsHaveDocString, operationParametersShouldHaveRequiredBeforeOptional, containedEntityShouldNotHaveEntitySet, referenceIdPropertyShouldBeNavigationProperty, useProperDefaultRecord, shouldNotUseUnnecessaryInheritance, namesMustBeCamelCase, nullableBooleanShouldBeEnum, nullableEnumsShouldAddAdditionalMember, allowedValuesCsdlCompatibility, useCreatedInPropertyNames, useModifiedInPropertyNames } from "./rules/index.js";
|
|
3
3
|
export const $linter = defineLinter({
|
|
4
4
|
rules: [
|
|
5
5
|
useEvolvableEnumRule,
|
|
6
6
|
collectionPropertyShouldNotBeNullable,
|
|
7
7
|
collectionShouldNotBeEnum,
|
|
8
|
+
collectionOfComplexTypeShouldUseEntityType,
|
|
8
9
|
mediaTypeValuesShouldBeMinimallyFormattedForMIMETypes,
|
|
9
10
|
interfaceNavigationSourceShouldHaveMediaIf$ValueIsSpecified,
|
|
10
11
|
getPutPostAndPatchOperationsShouldHaveSelectDecorator,
|
|
@@ -32,6 +33,7 @@ export const $linter = defineLinter({
|
|
|
32
33
|
[`@microsoft/typespec-msgraph/${useEvolvableEnumRule.name}`]: true,
|
|
33
34
|
[`@microsoft/typespec-msgraph/${collectionPropertyShouldNotBeNullable.name}`]: true,
|
|
34
35
|
[`@microsoft/typespec-msgraph/${collectionShouldNotBeEnum.name}`]: true,
|
|
36
|
+
[`@microsoft/typespec-msgraph/${collectionOfComplexTypeShouldUseEntityType.name}`]: true,
|
|
35
37
|
[`@microsoft/typespec-msgraph/${namesMustBeCamelCase.name}`]: true,
|
|
36
38
|
[`@microsoft/typespec-msgraph/${nullableBooleanShouldBeEnum.name}`]: true,
|
|
37
39
|
[`@microsoft/typespec-msgraph/${nullableEnumsShouldAddAdditionalMember.name}`]: true,
|
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,
|
|
1
|
+
{"version":3,"file":"linter.js","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,Y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CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export declare const collectionPropertyShouldNotBeNullable: import("@typespec/compiler").LinterRuleDefinition<"collection-property-should-not-be-nullable", {
|
|
2
2
|
readonly default: import("@typespec/compiler").CallableMessage<["property"]>;
|
|
3
3
|
}>;
|
|
4
|
+
export declare const collectionOfComplexTypeShouldUseEntityType: import("@typespec/compiler").LinterRuleDefinition<"collection-of-complex-type-should-use-entity-type", {
|
|
5
|
+
readonly default: import("@typespec/compiler").CallableMessage<["property"]>;
|
|
6
|
+
}>;
|
|
4
7
|
//# sourceMappingURL=collections.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../../src/rules/collections.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../../../src/rules/collections.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qCAAqC;;EA8BhD,CAAC;AAEH,eAAO,MAAM,0CAA0C;;EAuCrD,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { createRule, paramMessage } from "@typespec/compiler";
|
|
2
2
|
import { isTypeCollection, isTypeNullable } from "../utils.js";
|
|
3
|
+
import { isComplex } from "../index.js";
|
|
4
|
+
import { getActualType } from "../utils.js";
|
|
3
5
|
export const collectionPropertyShouldNotBeNullable = createRule({
|
|
4
6
|
name: "collection-property-should-not-be-nullable",
|
|
5
7
|
severity: "warning",
|
|
@@ -29,4 +31,40 @@ export const collectionPropertyShouldNotBeNullable = createRule({
|
|
|
29
31
|
};
|
|
30
32
|
}
|
|
31
33
|
});
|
|
34
|
+
export const collectionOfComplexTypeShouldUseEntityType = createRule({
|
|
35
|
+
name: "collection-of-complex-type-should-use-entity-type",
|
|
36
|
+
severity: "warning",
|
|
37
|
+
description: "Collection properties should use entity types instead of complex types for addressability",
|
|
38
|
+
messages: {
|
|
39
|
+
default: paramMessage `The property '${"property"}' should be a navigation property (collection of entity types) instead of collection of complex types. Because objects of complex types in Microsoft Graph don't have unique identifiers, they are not directly addressable via URIs. For more information, see the [Microsoft REST API Guidelines collection URL patterns](https://github.com/microsoft/api-guidelines/blob/vNext/graph/articles/collections.md#112-redefine-as-entity-type-for-collections-of-complex-types).`,
|
|
40
|
+
},
|
|
41
|
+
create(context) {
|
|
42
|
+
return {
|
|
43
|
+
modelProperty(property) {
|
|
44
|
+
// Only check properties on entity types (structural properties)
|
|
45
|
+
if (!property.model) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
// Check if this is a collection type
|
|
49
|
+
if (!isTypeCollection(context.program, property.type)) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
// Get the element type of the collection
|
|
53
|
+
const elementType = getActualType(context.program, property.type);
|
|
54
|
+
if (!elementType || elementType.kind !== "Model") {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (!isComplex(context.program, elementType)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
context.reportDiagnostic({
|
|
61
|
+
target: property,
|
|
62
|
+
format: {
|
|
63
|
+
property: property.name,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
});
|
|
32
70
|
//# sourceMappingURL=collections.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../../../src/rules/collections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"collections.js","sourceRoot":"","sources":["../../../src/rules/collections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,cA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C;gBAED,qCAAqC;gBACrC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;oBACtD,OAAO;gBACT,CAAC;gBAED,yCAAyC;gBACzC,MAAM,WAAW,GAAG,aAAa,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;gBAClE,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;oBACjD,OAAO;gBACT,CAAC;gBAED,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,CAAC;oBAC7C,OAAO;gBACT,CAAC;gBAED,OAAO,CAAC,gBAAgB,CAAC;oBACvB,MAAM,EAAE,QAAQ;oBAChB,MAAM,EAAE;wBACN,QAAQ,EAAE,QAAQ,CAAC,IAAI;qBACxB;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"naming.d.ts","sourceRoot":"","sources":["../../../src/rules/naming.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAKhB,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,eAAO,MAAM,oBAAoB;;
|
|
1
|
+
{"version":3,"file":"naming.d.ts","sourceRoot":"","sources":["../../../src/rules/naming.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAKhB,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,eAAO,MAAM,oBAAoB;;EAiC/B,CAAC"}
|
package/dist/src/rules/naming.js
CHANGED
|
@@ -24,7 +24,11 @@ export const namesMustBeCamelCase = createRule({
|
|
|
24
24
|
});
|
|
25
25
|
},
|
|
26
26
|
operation: (operation) => {
|
|
27
|
-
|
|
27
|
+
// Only run camel case check for operations that have @function or @action decorators
|
|
28
|
+
const hasFunctionOrAction = operation.decorators.some(decorator => { var _a, _b; return ((_a = decorator.definition) === null || _a === void 0 ? void 0 : _a.name) === "@function" || ((_b = decorator.definition) === null || _b === void 0 ? void 0 : _b.name) === "@action"; });
|
|
29
|
+
if (hasFunctionOrAction) {
|
|
30
|
+
checkCamelCase(context, operation, operation.name);
|
|
31
|
+
}
|
|
28
32
|
},
|
|
29
33
|
};
|
|
30
34
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"naming.js","sourceRoot":"","sources":["../../../src/rules/naming.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EAEV,YAAY,GAEb,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;IAC7C,IAAI,EAAE,0BAA0B;IAChC,QAAQ,EAAE,SAAS;IACnB,WAAW,EAAE,mCAAmC;IAChD,QAAQ,EAAE;QACR,OAAO,EAAE,YAAY,CAAA,SAAS,MAAM,+DAA+D,WAAW,IAAI;KACnH;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;gBACf,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YAC7C,CAAC;YACD,aAAa,EAAE,CAAC,QAAQ,EAAE,EAAE;gBAC1B,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;YACnD,CAAC;YACD,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE;gBACjB,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;gBACjD,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;oBAClC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;gBAC/C,CAAC,CAAC,CAAC;YACL,CAAC;YACD,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SAAS,CAAC,UAAU,0CAAE,IAAI,MAAK,WAAW,IAAI,CAAA,MAAA,SAAS,CAAC,UAAU,0CAAE,IAAI,MAAK,SAAS,CAAA,EAAA,CACvF,CAAC;gBAEF,IAAI,mBAAmB,EAAE,CAAC;oBACxB,cAAc,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;gBACrD,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH;;GAEG;AACH,SAAS,cAAc,CACrB,OAEE,EACF,MAAY,EACZ,IAAY;IAEZ,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO;IACT,CAAC;IAED,wCAAwC;IACxC,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAE/D,OAAO,CAAC,gBAAgB,CAAC;YACvB,MAAM;YACN,MAAM,EAAE;gBACN,IAAI;gBACJ,SAAS;aACV;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csdl-suppression-rules.d.ts","sourceRoot":"","sources":["../../../src/supressions/csdl-suppression-rules.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"csdl-suppression-rules.d.ts","sourceRoot":"","sources":["../../../src/supressions/csdl-suppression-rules.ts"],"names":[],"mappings":"AASA;;;;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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { collectionPropertyShouldNotBeNullable } from "../rules/collections.js";
|
|
1
|
+
import { collectionPropertyShouldNotBeNullable, collectionOfComplexTypeShouldUseEntityType } from "../rules/collections.js";
|
|
2
2
|
import { containedEntityShouldNotHaveEntitySet } from "../rules/contains.js";
|
|
3
3
|
import { referenceIdPropertyShouldBeNavigationProperty } from "../rules/entity.js";
|
|
4
4
|
import { collectionShouldNotBeEnum, nullableBooleanShouldBeEnum, nullableEnumsShouldAddAdditionalMember, useEvolvableEnumRule } from "../rules/enum.js";
|
|
@@ -13,6 +13,7 @@ const DEFAULT_RULE = "default";
|
|
|
13
13
|
*/
|
|
14
14
|
export const csdlSuppressionRules = {
|
|
15
15
|
[collectionPropertyShouldNotBeNullable.name]: "CollectionPropertyShouldNotBeNullable",
|
|
16
|
+
[collectionOfComplexTypeShouldUseEntityType.name]: "ComplexTypeCollectionShouldUseEntityTypeInstead",
|
|
16
17
|
[collectionShouldNotBeEnum.name]: "EnumCollectionShouldBeFlaggedEnum",
|
|
17
18
|
[containedEntityShouldNotHaveEntitySet.name]: "ContainedNavPropertyShouldNotHaveEntitySet",
|
|
18
19
|
[namesMustBeCamelCase.name]: "CamelCase",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csdl-suppression-rules.js","sourceRoot":"","sources":["../../../src/supressions/csdl-suppression-rules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"csdl-suppression-rules.js","sourceRoot":"","sources":["../../../src/supressions/csdl-suppression-rules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,0CAA0C,EAAE,MAAM,yBAAyB,CAAC;AAC5H,OAAO,EAAE,qCAAqC,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,6CAA6C,EAAE,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GAAG,EAAE,CAAC;IACzC,MAAM,QAAQ,GAAG,oBAAoB,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,YAAY,CAAC,CAAC;IAC5D,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/typespec-msgraph",
|
|
3
|
-
"version": "1.0.0-Preview.
|
|
3
|
+
"version": "1.0.0-Preview.8",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec for Microsoft Graph provides a description of the Microsoft Graph APIs. It is used for generating API description languages, client and service code, documentation, and other assets.",
|
|
6
6
|
"homepage": "https://github.com/microsoftgraph/typespec-msgraph",
|