@microsoft/typespec-msgraph 0.0.1-Preview.24 → 0.0.1-Preview.25

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.
Files changed (49) hide show
  1. package/dist/src/components/annotations.d.ts +3 -3
  2. package/dist/src/components/annotations.d.ts.map +1 -1
  3. package/dist/src/components/annotations.js +24 -2
  4. package/dist/src/components/annotations.js.map +1 -1
  5. package/dist/src/components/structured-type-element.d.ts.map +1 -1
  6. package/dist/src/components/structured-type-element.js +4 -3
  7. package/dist/src/components/structured-type-element.js.map +1 -1
  8. package/dist/src/emitter.js +2 -1
  9. package/dist/src/emitter.js.map +1 -1
  10. package/dist/src/entities/annotations.d.ts +7 -2
  11. package/dist/src/entities/annotations.d.ts.map +1 -1
  12. package/dist/src/entities/annotations.js +68 -54
  13. package/dist/src/entities/annotations.js.map +1 -1
  14. package/dist/src/entities/entity-container.d.ts.map +1 -1
  15. package/dist/src/entities/entity-container.js +15 -3
  16. package/dist/src/entities/entity-container.js.map +1 -1
  17. package/dist/src/entities/model.d.ts.map +1 -1
  18. package/dist/src/entities/model.js +83 -32
  19. package/dist/src/entities/model.js.map +1 -1
  20. package/dist/src/entities/namespace.d.ts +3 -3
  21. package/dist/src/entities/namespace.d.ts.map +1 -1
  22. package/dist/src/entities/namespace.js.map +1 -1
  23. package/dist/src/lib.d.ts +74 -74
  24. package/dist/src/lib.js +3 -3
  25. package/dist/src/lib.js.map +1 -1
  26. package/dist/src/path-tree.d.ts +16 -0
  27. package/dist/src/path-tree.d.ts.map +1 -0
  28. package/dist/src/path-tree.js +76 -0
  29. package/dist/src/path-tree.js.map +1 -0
  30. package/dist/src/rules/enum.d.ts +1 -1
  31. package/dist/src/rules/graph-route.d.ts.map +1 -1
  32. package/dist/src/rules/graph-route.js +76 -39
  33. package/dist/src/rules/graph-route.js.map +1 -1
  34. package/dist/src/rules/media.d.ts +3 -3
  35. package/dist/src/rules/model.d.ts +2 -2
  36. package/dist/src/rules/operation-inside-interface.d.ts +1 -1
  37. package/dist/src/rules/ownerless.d.ts.map +1 -1
  38. package/dist/src/rules/ownerless.js +5 -3
  39. package/dist/src/rules/ownerless.js.map +1 -1
  40. package/dist/src/rules/reference-target.d.ts +1 -1
  41. package/dist/src/rules/reference-target.d.ts.map +1 -1
  42. package/dist/src/rules/reference-target.js +0 -1
  43. package/dist/src/rules/reference-target.js.map +1 -1
  44. package/dist/src/utils.d.ts +5 -0
  45. package/dist/src/utils.d.ts.map +1 -1
  46. package/dist/src/utils.js +32 -2
  47. package/dist/src/utils.js.map +1 -1
  48. package/lib/shared-models.tsp +1 -1
  49. package/package.json +3 -3
package/dist/src/lib.d.ts CHANGED
@@ -5,55 +5,55 @@ export interface MsGraphEmitterOptions {
5
5
  export declare const $flags: import("@typespec/compiler").PackageFlags;
6
6
  export declare const reportDiagnostic: <C extends "decorator-missing-dependencies" | "element-missing-dependencies" | "decorator-invalid-use" | "singleton-invalid-name" | "extends-invalid-use" | "type-invalid-use", M extends keyof {
7
7
  "decorator-missing-dependencies": {
8
- readonly default: import("@typespec/compiler").CallableMessage<[string, string, string]>;
8
+ readonly default: import("@typespec/compiler").CallableMessage<["decorator", "required", "location"]>;
9
9
  readonly function: import("@typespec/compiler").CallableMessage<[]>;
10
10
  };
11
11
  "element-missing-dependencies": {
12
- readonly default: import("@typespec/compiler").CallableMessage<[string, string, string]>;
12
+ readonly default: import("@typespec/compiler").CallableMessage<["element", "other", "location"]>;
13
13
  readonly operation: import("@typespec/compiler").CallableMessage<[]>;
14
14
  readonly collectionNavigationPropertiesNotNullable: "Collection-valued navigation properties cannot be nullable.";
15
- readonly propertyRequiredForCreate: import("@typespec/compiler").CallableMessage<[string, string]>;
16
- readonly modelMissingNamespace: import("@typespec/compiler").CallableMessage<[string]>;
17
- readonly operationParameterMismatch: import("@typespec/compiler").CallableMessage<[string, string]>;
18
- readonly topLevelNamespaceMissingPublicNamespace: import("@typespec/compiler").CallableMessage<[string]>;
19
- readonly propertyMissingContainsOrReferences: import("@typespec/compiler").CallableMessage<[string, string]>;
15
+ readonly propertyRequiredForCreate: import("@typespec/compiler").CallableMessage<["property", "model"]>;
16
+ readonly modelMissingNamespace: import("@typespec/compiler").CallableMessage<["model"]>;
17
+ readonly operationParameterMismatch: import("@typespec/compiler").CallableMessage<["operation", "parameters"]>;
18
+ readonly topLevelNamespaceMissingPublicNamespace: import("@typespec/compiler").CallableMessage<["namespace"]>;
19
+ readonly propertyMissingContainsOrReferences: import("@typespec/compiler").CallableMessage<["property", "entity"]>;
20
20
  };
21
21
  "decorator-invalid-use": {
22
- readonly default: import("@typespec/compiler").CallableMessage<[string, string, string]>;
22
+ readonly default: import("@typespec/compiler").CallableMessage<["decorator", "other", "location"]>;
23
23
  readonly alternateKey: import("@typespec/compiler").CallableMessage<[]>;
24
- readonly disallowedTypeSpecDecorators: import("@typespec/compiler").CallableMessage<[string]>;
25
- readonly expandProperties: import("@typespec/compiler").CallableMessage<[string, string]>;
26
- readonly filterProperties: import("@typespec/compiler").CallableMessage<[string, string]>;
24
+ readonly disallowedTypeSpecDecorators: import("@typespec/compiler").CallableMessage<["decorator"]>;
25
+ readonly expandProperties: import("@typespec/compiler").CallableMessage<["properties", "model"]>;
26
+ readonly filterProperties: import("@typespec/compiler").CallableMessage<["properties", "model"]>;
27
27
  readonly invalidAllPropertiesNotationUsage: import("@typespec/compiler").CallableMessage<[]>;
28
28
  readonly key: import("@typespec/compiler").CallableMessage<[]>;
29
- readonly orderByProperties: import("@typespec/compiler").CallableMessage<[string, string]>;
30
- readonly required: import("@typespec/compiler").CallableMessage<[string, string]>;
31
- readonly wrongType: import("@typespec/compiler").CallableMessage<[string, string]>;
29
+ readonly orderByProperties: import("@typespec/compiler").CallableMessage<["properties", "model"]>;
30
+ readonly required: import("@typespec/compiler").CallableMessage<["decorator", "parameters"]>;
31
+ readonly wrongType: import("@typespec/compiler").CallableMessage<["decorator", "target"]>;
32
32
  readonly graphRoute: import("@typespec/compiler").CallableMessage<[]>;
33
33
  readonly allowedValues: import("@typespec/compiler").CallableMessage<[]>;
34
34
  readonly allowedValuesTypeHomogeinity: import("@typespec/compiler").CallableMessage<[]>;
35
35
  readonly allowedValuesInvalidType: import("@typespec/compiler").CallableMessage<[]>;
36
- readonly invalidPublicNamespaceName: import("@typespec/compiler").CallableMessage<[string]>;
37
- readonly invalidWorkloadNamespaceName: import("@typespec/compiler").CallableMessage<[string]>;
36
+ readonly invalidPublicNamespaceName: import("@typespec/compiler").CallableMessage<["namespace"]>;
37
+ readonly invalidWorkloadNamespaceName: import("@typespec/compiler").CallableMessage<["namespace"]>;
38
38
  readonly partial: import("@typespec/compiler").CallableMessage<[]>;
39
39
  readonly graphDeprecatedMustBeAccompaniedByDefinition: import("@typespec/compiler").CallableMessage<[]>;
40
40
  readonly graphDeprecatedValueMustBeDefinedInDeprecatedDefinition: import("@typespec/compiler").CallableMessage<[]>;
41
41
  readonly ownerlessMustBeAppliedToInterfacesWithSingleSegmentGraphRouteRule: import("@typespec/compiler").CallableMessage<[]>;
42
42
  readonly referencedEntityModelCannotHaveComplexTypeProperties: import("@typespec/compiler").CallableMessage<[]>;
43
43
  readonly referencedEntityModelCanOnlyHaveNavigationProperties: import("@typespec/compiler").CallableMessage<[]>;
44
- readonly ownerlessInterfaceCannotHaveAnyOperations: import("@typespec/compiler").CallableMessage<[]>;
44
+ readonly ownerlessInterfaceCannotHaveAnyNonActionFunctionOperations: import("@typespec/compiler").CallableMessage<[]>;
45
45
  readonly ownerlessDecoratorCannotBeUsedWithIsOwner: import("@typespec/compiler").CallableMessage<[]>;
46
46
  readonly ownerlessDecoratorCannotHaveBaseModel: import("@typespec/compiler").CallableMessage<[]>;
47
47
  readonly entityTypeInOnwerlessCannotBeUsedWithOtherInterfaces: import("@typespec/compiler").CallableMessage<[]>;
48
48
  readonly globalOperationMustBeUsedWithNonRoutedInterface: import("@typespec/compiler").CallableMessage<[]>;
49
49
  readonly globalOperationMustBeUsedWithProjectBindingType: import("@typespec/compiler").CallableMessage<[]>;
50
- readonly graphRouteWithRoutingParameterAsFinalSegment: import("@typespec/compiler").CallableMessage<[string]>;
50
+ readonly graphRouteWithRoutingParameterAsFinalSegment: import("@typespec/compiler").CallableMessage<["graphRoute"]>;
51
51
  readonly referenceTargetInterfaceMustHaveGraphRoute: import("@typespec/compiler").CallableMessage<[]>;
52
52
  readonly referenceTargetMustOnlyBeUsedOnceOnInterface: import("@typespec/compiler").CallableMessage<[]>;
53
- readonly referenceTargetPathShouldNotHaveParameters: import("@typespec/compiler").CallableMessage<[string]>;
53
+ readonly referenceTargetPathShouldNotHaveParameters: import("@typespec/compiler").CallableMessage<["decorator", "target"]>;
54
54
  readonly interfaceWithGraphRouteMustExtendGraphStandardBaseInterface: import("@typespec/compiler").CallableMessage<[]>;
55
- readonly duplicateGraphRouteNotAllowed: import("@typespec/compiler").CallableMessage<[string, string, string]>;
56
- readonly duplicateParametersAreNotAllowedInGraphRoute: import("@typespec/compiler").CallableMessage<[string, string]>;
55
+ readonly duplicateGraphRouteNotAllowed: import("@typespec/compiler").CallableMessage<["graphRoute", "target", "existing"]>;
56
+ readonly duplicateParametersAreNotAllowedInGraphRoute: import("@typespec/compiler").CallableMessage<["parameters", "graphRoute", "target"]>;
57
57
  readonly complexCannotBeDecoratedWithPartial: import("@typespec/compiler").CallableMessage<[]>;
58
58
  readonly returnSourceOnlyAppliesToActionsAndFunctions: import("@typespec/compiler").CallableMessage<[]>;
59
59
  readonly deltaCanOnlyBeAppliedToFunctionsNamedDelta: import("@typespec/compiler").CallableMessage<[]>;
@@ -61,81 +61,81 @@ export declare const reportDiagnostic: <C extends "decorator-missing-dependencie
61
61
  readonly deltaCanOnlyBeUsedInCollectionInterfacesThatExtendEntityTypes: import("@typespec/compiler").CallableMessage<[]>;
62
62
  readonly interfaceWithDeltaDefinitionMustIncludeAGetOperation: import("@typespec/compiler").CallableMessage<[]>;
63
63
  readonly deltaFunctionReturnTypeMustBeCollectionOfEntityType: import("@typespec/compiler").CallableMessage<[]>;
64
- readonly complexTypesAreNotAddressableThroughUniqueUrls: import("@typespec/compiler").CallableMessage<[string]>;
65
- readonly entityAndComplexAreMutuallyExclusive: import("@typespec/compiler").CallableMessage<[string]>;
66
- readonly filterPropertiesShouldBeSimple: import("@typespec/compiler").CallableMessage<[string, string]>;
67
- readonly navigationPropertyShouldBeTargettedWithOneInterface: import("@typespec/compiler").CallableMessage<[string]>;
68
- readonly graphRouteMustMatchModelStructure: import("@typespec/compiler").CallableMessage<[string, string]>;
69
- readonly overloadedFunctionReturnTypesMustBeSame: import("@typespec/compiler").CallableMessage<[string, string]>;
70
- readonly enumMemberUnknownFutureValueCannotHaveDocString: import("@typespec/compiler").CallableMessage<[string]>;
71
- readonly addressUrlsAreNotEqual: import("@typespec/compiler").CallableMessage<[string, string]>;
64
+ readonly complexTypesAreNotAddressableThroughUniqueUrls: import("@typespec/compiler").CallableMessage<["complexType"]>;
65
+ readonly entityAndComplexAreMutuallyExclusive: import("@typespec/compiler").CallableMessage<["model"]>;
66
+ readonly filterPropertiesShouldBeSimple: import("@typespec/compiler").CallableMessage<["property", "model"]>;
67
+ readonly navigationPropertyShouldBeTargettedWithOneInterface: import("@typespec/compiler").CallableMessage<["models"]>;
68
+ readonly graphRouteMustMatchModelStructure: import("@typespec/compiler").CallableMessage<["graphRoute", "model"]>;
69
+ readonly overloadedFunctionReturnTypesMustBeSame: import("@typespec/compiler").CallableMessage<["returnTypes", "operation"]>;
70
+ readonly enumMemberUnknownFutureValueCannotHaveDocString: import("@typespec/compiler").CallableMessage<["member"]>;
71
+ readonly addressUrlsAreNotEqual: import("@typespec/compiler").CallableMessage<["decorator", "target"]>;
72
72
  };
73
73
  "singleton-invalid-name": {
74
- readonly default: import("@typespec/compiler").CallableMessage<[string]>;
74
+ readonly default: import("@typespec/compiler").CallableMessage<["value"]>;
75
75
  };
76
76
  "extends-invalid-use": {
77
- readonly default: import("@typespec/compiler").CallableMessage<[string, string]>;
77
+ readonly default: import("@typespec/compiler").CallableMessage<["type", "type"]>;
78
78
  readonly namespaces: "A model can only extend other models in a different logical namespace. Use @partial instead.";
79
79
  };
80
80
  "type-invalid-use": {
81
- readonly default: import("@typespec/compiler").CallableMessage<[string]>;
82
- readonly recordTypeCannotBePrepopulated: import("@typespec/compiler").CallableMessage<[string]>;
83
- readonly recordTypeCannotBeNull: import("@typespec/compiler").CallableMessage<[string]>;
84
- readonly recordTypeCannotBeUsedInLine: import("@typespec/compiler").CallableMessage<[string]>;
85
- readonly interfaceWithPartialBindingType: import("@typespec/compiler").CallableMessage<[string, string]>;
86
- readonly propertyTypeCannotBeStringLiteral: import("@typespec/compiler").CallableMessage<[string, string]>;
81
+ readonly default: import("@typespec/compiler").CallableMessage<["type"]>;
82
+ readonly recordTypeCannotBePrepopulated: import("@typespec/compiler").CallableMessage<["type"]>;
83
+ readonly recordTypeCannotBeNull: import("@typespec/compiler").CallableMessage<["type"]>;
84
+ readonly recordTypeCannotBeUsedInLine: import("@typespec/compiler").CallableMessage<["type"]>;
85
+ readonly interfaceWithPartialBindingType: import("@typespec/compiler").CallableMessage<["interface", "type"]>;
86
+ readonly propertyTypeCannotBeStringLiteral: import("@typespec/compiler").CallableMessage<["property", "type"]>;
87
87
  };
88
88
  }[C]>(program: import("@typespec/compiler").Program, diag: import("@typespec/compiler").DiagnosticReport<{
89
89
  "decorator-missing-dependencies": {
90
- readonly default: import("@typespec/compiler").CallableMessage<[string, string, string]>;
90
+ readonly default: import("@typespec/compiler").CallableMessage<["decorator", "required", "location"]>;
91
91
  readonly function: import("@typespec/compiler").CallableMessage<[]>;
92
92
  };
93
93
  "element-missing-dependencies": {
94
- readonly default: import("@typespec/compiler").CallableMessage<[string, string, string]>;
94
+ readonly default: import("@typespec/compiler").CallableMessage<["element", "other", "location"]>;
95
95
  readonly operation: import("@typespec/compiler").CallableMessage<[]>;
96
96
  readonly collectionNavigationPropertiesNotNullable: "Collection-valued navigation properties cannot be nullable.";
97
- readonly propertyRequiredForCreate: import("@typespec/compiler").CallableMessage<[string, string]>;
98
- readonly modelMissingNamespace: import("@typespec/compiler").CallableMessage<[string]>;
99
- readonly operationParameterMismatch: import("@typespec/compiler").CallableMessage<[string, string]>;
100
- readonly topLevelNamespaceMissingPublicNamespace: import("@typespec/compiler").CallableMessage<[string]>;
101
- readonly propertyMissingContainsOrReferences: import("@typespec/compiler").CallableMessage<[string, string]>;
97
+ readonly propertyRequiredForCreate: import("@typespec/compiler").CallableMessage<["property", "model"]>;
98
+ readonly modelMissingNamespace: import("@typespec/compiler").CallableMessage<["model"]>;
99
+ readonly operationParameterMismatch: import("@typespec/compiler").CallableMessage<["operation", "parameters"]>;
100
+ readonly topLevelNamespaceMissingPublicNamespace: import("@typespec/compiler").CallableMessage<["namespace"]>;
101
+ readonly propertyMissingContainsOrReferences: import("@typespec/compiler").CallableMessage<["property", "entity"]>;
102
102
  };
103
103
  "decorator-invalid-use": {
104
- readonly default: import("@typespec/compiler").CallableMessage<[string, string, string]>;
104
+ readonly default: import("@typespec/compiler").CallableMessage<["decorator", "other", "location"]>;
105
105
  readonly alternateKey: import("@typespec/compiler").CallableMessage<[]>;
106
- readonly disallowedTypeSpecDecorators: import("@typespec/compiler").CallableMessage<[string]>;
107
- readonly expandProperties: import("@typespec/compiler").CallableMessage<[string, string]>;
108
- readonly filterProperties: import("@typespec/compiler").CallableMessage<[string, string]>;
106
+ readonly disallowedTypeSpecDecorators: import("@typespec/compiler").CallableMessage<["decorator"]>;
107
+ readonly expandProperties: import("@typespec/compiler").CallableMessage<["properties", "model"]>;
108
+ readonly filterProperties: import("@typespec/compiler").CallableMessage<["properties", "model"]>;
109
109
  readonly invalidAllPropertiesNotationUsage: import("@typespec/compiler").CallableMessage<[]>;
110
110
  readonly key: import("@typespec/compiler").CallableMessage<[]>;
111
- readonly orderByProperties: import("@typespec/compiler").CallableMessage<[string, string]>;
112
- readonly required: import("@typespec/compiler").CallableMessage<[string, string]>;
113
- readonly wrongType: import("@typespec/compiler").CallableMessage<[string, string]>;
111
+ readonly orderByProperties: import("@typespec/compiler").CallableMessage<["properties", "model"]>;
112
+ readonly required: import("@typespec/compiler").CallableMessage<["decorator", "parameters"]>;
113
+ readonly wrongType: import("@typespec/compiler").CallableMessage<["decorator", "target"]>;
114
114
  readonly graphRoute: import("@typespec/compiler").CallableMessage<[]>;
115
115
  readonly allowedValues: import("@typespec/compiler").CallableMessage<[]>;
116
116
  readonly allowedValuesTypeHomogeinity: import("@typespec/compiler").CallableMessage<[]>;
117
117
  readonly allowedValuesInvalidType: import("@typespec/compiler").CallableMessage<[]>;
118
- readonly invalidPublicNamespaceName: import("@typespec/compiler").CallableMessage<[string]>;
119
- readonly invalidWorkloadNamespaceName: import("@typespec/compiler").CallableMessage<[string]>;
118
+ readonly invalidPublicNamespaceName: import("@typespec/compiler").CallableMessage<["namespace"]>;
119
+ readonly invalidWorkloadNamespaceName: import("@typespec/compiler").CallableMessage<["namespace"]>;
120
120
  readonly partial: import("@typespec/compiler").CallableMessage<[]>;
121
121
  readonly graphDeprecatedMustBeAccompaniedByDefinition: import("@typespec/compiler").CallableMessage<[]>;
122
122
  readonly graphDeprecatedValueMustBeDefinedInDeprecatedDefinition: import("@typespec/compiler").CallableMessage<[]>;
123
123
  readonly ownerlessMustBeAppliedToInterfacesWithSingleSegmentGraphRouteRule: import("@typespec/compiler").CallableMessage<[]>;
124
124
  readonly referencedEntityModelCannotHaveComplexTypeProperties: import("@typespec/compiler").CallableMessage<[]>;
125
125
  readonly referencedEntityModelCanOnlyHaveNavigationProperties: import("@typespec/compiler").CallableMessage<[]>;
126
- readonly ownerlessInterfaceCannotHaveAnyOperations: import("@typespec/compiler").CallableMessage<[]>;
126
+ readonly ownerlessInterfaceCannotHaveAnyNonActionFunctionOperations: import("@typespec/compiler").CallableMessage<[]>;
127
127
  readonly ownerlessDecoratorCannotBeUsedWithIsOwner: import("@typespec/compiler").CallableMessage<[]>;
128
128
  readonly ownerlessDecoratorCannotHaveBaseModel: import("@typespec/compiler").CallableMessage<[]>;
129
129
  readonly entityTypeInOnwerlessCannotBeUsedWithOtherInterfaces: import("@typespec/compiler").CallableMessage<[]>;
130
130
  readonly globalOperationMustBeUsedWithNonRoutedInterface: import("@typespec/compiler").CallableMessage<[]>;
131
131
  readonly globalOperationMustBeUsedWithProjectBindingType: import("@typespec/compiler").CallableMessage<[]>;
132
- readonly graphRouteWithRoutingParameterAsFinalSegment: import("@typespec/compiler").CallableMessage<[string]>;
132
+ readonly graphRouteWithRoutingParameterAsFinalSegment: import("@typespec/compiler").CallableMessage<["graphRoute"]>;
133
133
  readonly referenceTargetInterfaceMustHaveGraphRoute: import("@typespec/compiler").CallableMessage<[]>;
134
134
  readonly referenceTargetMustOnlyBeUsedOnceOnInterface: import("@typespec/compiler").CallableMessage<[]>;
135
- readonly referenceTargetPathShouldNotHaveParameters: import("@typespec/compiler").CallableMessage<[string]>;
135
+ readonly referenceTargetPathShouldNotHaveParameters: import("@typespec/compiler").CallableMessage<["decorator", "target"]>;
136
136
  readonly interfaceWithGraphRouteMustExtendGraphStandardBaseInterface: import("@typespec/compiler").CallableMessage<[]>;
137
- readonly duplicateGraphRouteNotAllowed: import("@typespec/compiler").CallableMessage<[string, string, string]>;
138
- readonly duplicateParametersAreNotAllowedInGraphRoute: import("@typespec/compiler").CallableMessage<[string, string]>;
137
+ readonly duplicateGraphRouteNotAllowed: import("@typespec/compiler").CallableMessage<["graphRoute", "target", "existing"]>;
138
+ readonly duplicateParametersAreNotAllowedInGraphRoute: import("@typespec/compiler").CallableMessage<["parameters", "graphRoute", "target"]>;
139
139
  readonly complexCannotBeDecoratedWithPartial: import("@typespec/compiler").CallableMessage<[]>;
140
140
  readonly returnSourceOnlyAppliesToActionsAndFunctions: import("@typespec/compiler").CallableMessage<[]>;
141
141
  readonly deltaCanOnlyBeAppliedToFunctionsNamedDelta: import("@typespec/compiler").CallableMessage<[]>;
@@ -143,29 +143,29 @@ export declare const reportDiagnostic: <C extends "decorator-missing-dependencie
143
143
  readonly deltaCanOnlyBeUsedInCollectionInterfacesThatExtendEntityTypes: import("@typespec/compiler").CallableMessage<[]>;
144
144
  readonly interfaceWithDeltaDefinitionMustIncludeAGetOperation: import("@typespec/compiler").CallableMessage<[]>;
145
145
  readonly deltaFunctionReturnTypeMustBeCollectionOfEntityType: import("@typespec/compiler").CallableMessage<[]>;
146
- readonly complexTypesAreNotAddressableThroughUniqueUrls: import("@typespec/compiler").CallableMessage<[string]>;
147
- readonly entityAndComplexAreMutuallyExclusive: import("@typespec/compiler").CallableMessage<[string]>;
148
- readonly filterPropertiesShouldBeSimple: import("@typespec/compiler").CallableMessage<[string, string]>;
149
- readonly navigationPropertyShouldBeTargettedWithOneInterface: import("@typespec/compiler").CallableMessage<[string]>;
150
- readonly graphRouteMustMatchModelStructure: import("@typespec/compiler").CallableMessage<[string, string]>;
151
- readonly overloadedFunctionReturnTypesMustBeSame: import("@typespec/compiler").CallableMessage<[string, string]>;
152
- readonly enumMemberUnknownFutureValueCannotHaveDocString: import("@typespec/compiler").CallableMessage<[string]>;
153
- readonly addressUrlsAreNotEqual: import("@typespec/compiler").CallableMessage<[string, string]>;
146
+ readonly complexTypesAreNotAddressableThroughUniqueUrls: import("@typespec/compiler").CallableMessage<["complexType"]>;
147
+ readonly entityAndComplexAreMutuallyExclusive: import("@typespec/compiler").CallableMessage<["model"]>;
148
+ readonly filterPropertiesShouldBeSimple: import("@typespec/compiler").CallableMessage<["property", "model"]>;
149
+ readonly navigationPropertyShouldBeTargettedWithOneInterface: import("@typespec/compiler").CallableMessage<["models"]>;
150
+ readonly graphRouteMustMatchModelStructure: import("@typespec/compiler").CallableMessage<["graphRoute", "model"]>;
151
+ readonly overloadedFunctionReturnTypesMustBeSame: import("@typespec/compiler").CallableMessage<["returnTypes", "operation"]>;
152
+ readonly enumMemberUnknownFutureValueCannotHaveDocString: import("@typespec/compiler").CallableMessage<["member"]>;
153
+ readonly addressUrlsAreNotEqual: import("@typespec/compiler").CallableMessage<["decorator", "target"]>;
154
154
  };
155
155
  "singleton-invalid-name": {
156
- readonly default: import("@typespec/compiler").CallableMessage<[string]>;
156
+ readonly default: import("@typespec/compiler").CallableMessage<["value"]>;
157
157
  };
158
158
  "extends-invalid-use": {
159
- readonly default: import("@typespec/compiler").CallableMessage<[string, string]>;
159
+ readonly default: import("@typespec/compiler").CallableMessage<["type", "type"]>;
160
160
  readonly namespaces: "A model can only extend other models in a different logical namespace. Use @partial instead.";
161
161
  };
162
162
  "type-invalid-use": {
163
- readonly default: import("@typespec/compiler").CallableMessage<[string]>;
164
- readonly recordTypeCannotBePrepopulated: import("@typespec/compiler").CallableMessage<[string]>;
165
- readonly recordTypeCannotBeNull: import("@typespec/compiler").CallableMessage<[string]>;
166
- readonly recordTypeCannotBeUsedInLine: import("@typespec/compiler").CallableMessage<[string]>;
167
- readonly interfaceWithPartialBindingType: import("@typespec/compiler").CallableMessage<[string, string]>;
168
- readonly propertyTypeCannotBeStringLiteral: import("@typespec/compiler").CallableMessage<[string, string]>;
163
+ readonly default: import("@typespec/compiler").CallableMessage<["type"]>;
164
+ readonly recordTypeCannotBePrepopulated: import("@typespec/compiler").CallableMessage<["type"]>;
165
+ readonly recordTypeCannotBeNull: import("@typespec/compiler").CallableMessage<["type"]>;
166
+ readonly recordTypeCannotBeUsedInLine: import("@typespec/compiler").CallableMessage<["type"]>;
167
+ readonly interfaceWithPartialBindingType: import("@typespec/compiler").CallableMessage<["interface", "type"]>;
168
+ readonly propertyTypeCannotBeStringLiteral: import("@typespec/compiler").CallableMessage<["property", "type"]>;
169
169
  };
170
170
  }, C, M>) => void;
171
171
  //# sourceMappingURL=lib.d.ts.map
package/dist/src/lib.js CHANGED
@@ -63,7 +63,7 @@ export const { reportDiagnostic } = createTypeSpecLibrary({
63
63
  ownerlessMustBeAppliedToInterfacesWithSingleSegmentGraphRouteRule: paramMessage `The @ownerless decorator can only be applied to interfaces with a single segment @graphRoute.`,
64
64
  referencedEntityModelCannotHaveComplexTypeProperties: paramMessage `The referenced entity model cannot have complex type properties.`,
65
65
  referencedEntityModelCanOnlyHaveNavigationProperties: paramMessage `The referenced entity model can only have navigation properties.`,
66
- ownerlessInterfaceCannotHaveAnyOperations: paramMessage `The @ownerless decorator can only be applied to interfaces without any operations.`,
66
+ ownerlessInterfaceCannotHaveAnyNonActionFunctionOperations: paramMessage `The @ownerless decorator can only be applied to interfaces that contain only action or function operations.`,
67
67
  ownerlessDecoratorCannotBeUsedWithIsOwner: paramMessage `The referenced model in the ownerless interface cannot be used with @isOwner decorator.`,
68
68
  ownerlessDecoratorCannotHaveBaseModel: paramMessage `The referenced model in the ownerless interface cannot have a base model.`,
69
69
  entityTypeInOnwerlessCannotBeUsedWithOtherInterfaces: paramMessage `The referenced model in the ownerless interface cannot be used in the extends clause of other interfaces.`,
@@ -72,10 +72,10 @@ export const { reportDiagnostic } = createTypeSpecLibrary({
72
72
  graphRouteWithRoutingParameterAsFinalSegment: paramMessage `The @graphRoute ${"graphRoute"} with a routing parameter as the last segment cannot be used with a collection interface.`,
73
73
  referenceTargetInterfaceMustHaveGraphRoute: paramMessage `The @referenceTarget decorator must be used on an interface with a @graphRoute decorator.`,
74
74
  referenceTargetMustOnlyBeUsedOnceOnInterface: paramMessage `The @referenceTarget decorator can only be used once on an interface.`,
75
- referenceTargetPathShouldNotHaveParameters: paramMessage `The @referenceTarget path "${"target"}" cannot have parameters {}.`,
75
+ referenceTargetPathShouldNotHaveParameters: paramMessage `The decorator "${"decorator"}" path "${"target"}" cannot have parameters {}.`,
76
76
  interfaceWithGraphRouteMustExtendGraphStandardBaseInterface: paramMessage `The @graphRoute decorator can only be used on an interface that ultimately extends a Graph standard base interface i.e. Resource<T> or Collection<T>.`,
77
77
  duplicateGraphRouteNotAllowed: paramMessage `The @graphRoute "${"graphRoute"}" on "${"target"}" is already defined on another interface "${"existing"}".`,
78
- duplicateParametersAreNotAllowedInGraphRoute: paramMessage `The parameters "${"parameters"}" on the @graphRoute "${"graphRoute"}" must have unique names.`,
78
+ duplicateParametersAreNotAllowedInGraphRoute: paramMessage `The parameters "${"parameters"}" on the @graphRoute "${"graphRoute"}" for "${"target"}" must have unique names.`,
79
79
  complexCannotBeDecoratedWithPartial: paramMessage `A @complex type cannot be a @partial.`,
80
80
  returnSourceOnlyAppliesToActionsAndFunctions: paramMessage `The @returnSource decorator can only be applied to @function and @action operations.`,
81
81
  deltaCanOnlyBeAppliedToFunctionsNamedDelta: paramMessage `The @delta decorator can only be used with @function operations named delta.`,
@@ -1 +1 @@
1
- {"version":3,"file":"lib.js","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,qBAAqB,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAE7G,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAC;AAMnC,MAAM,oBAAoB,GAA0C;IAClE,IAAI,EAAE,QAAQ;IACd,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACV,QAAQ,EAAE;YACR,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,wFAAwF;SACtG;KACF;IACD,QAAQ,EAAE,EAAE;CACb,CAAA;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC;IACvC,uBAAuB,EAAE,KAAK;CAC/B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,qBAAqB,CAAC;IACxD,IAAI,EAAE,6BAA6B;IACnC,WAAW,EAAE;QACX,gCAAgC,EAAE;YAChC,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,OAAO,WAAW,sDAAsD,UAAU,qBAAqB,UAAU,GAAG;gBACzI,QAAQ,EAAE,YAAY,CAAA,oFAAoF;aAC3G;SACF;QACD,8BAA8B,EAAE;YAC9B,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,OAAO,SAAS,+BAA+B,OA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,0CAA0C,MAAM,0CAA0C;gBACpK,iCAAiC,EAAE,YAAY,CAAA,iBAAiB,UAAU,iBAAiB,MAAM,WAAW;aAC7G;SACF;KACF;IACD,OAAO,EAAE,EAAE,OAAO,EAAE,oBAA6D,EAAE;CAC3E,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { Model } from "@typespec/compiler";
2
+ export declare class TreeNode {
3
+ name: string;
4
+ entityType: Model | undefined;
5
+ containingEntityType: Model | undefined;
6
+ children: Map<string, TreeNode>;
7
+ constructor(entityType?: Model | undefined);
8
+ }
9
+ export declare class PathTree {
10
+ root: TreeNode;
11
+ constructor();
12
+ addNode(path: string, entityType: Model): void;
13
+ getAllNodesWithContainingEntityType(entityName: string, node?: TreeNode, result?: TreeNode[]): TreeNode[];
14
+ getNodeByPath(path: string): TreeNode | undefined;
15
+ }
16
+ //# sourceMappingURL=path-tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-tree.d.ts","sourceRoot":"","sources":["../../src/path-tree.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAM3C,qBAAa,QAAQ;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,KAAK,GAAG,SAAS,CAAC;IAC9B,oBAAoB,EAAE,KAAK,GAAG,SAAS,CAAC;IACxC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;gBAEpB,UAAU,GAAE,KAAK,GAAG,SAAqB;CAMtD;AAKD,qBAAa,QAAQ;IACnB,IAAI,EAAE,QAAQ,CAAC;;IAOf,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,GAAG,IAAI;IAkC9C,mCAAmC,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,GAAE,QAAoB,EAAE,MAAM,GAAE,QAAQ,EAAO,GAAG,QAAQ,EAAE;IAWxH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;CAelD"}
@@ -0,0 +1,76 @@
1
+ import { cleanGraphRoutePath } from "./utils.js";
2
+ /* A class that represents a graph route path segment, its associated entity type, the
3
+ * containing entity, and its children segments.
4
+ */
5
+ export class TreeNode {
6
+ constructor(entityType = undefined) {
7
+ this.name = 'root';
8
+ this.entityType = entityType;
9
+ this.containingEntityType = undefined;
10
+ this.children = new Map();
11
+ }
12
+ }
13
+ /* A class that represents the tree structure of graph route paths and the associations
14
+ * among path segments and operations for adding and retrieving the segments and their metadata.
15
+ */
16
+ export class PathTree {
17
+ constructor() {
18
+ this.root = new TreeNode(undefined);
19
+ }
20
+ // Adds a node to the tree for the given path and entity type.
21
+ addNode(path, entityType) {
22
+ path = cleanGraphRoutePath(path);
23
+ const segments = path.split("/");
24
+ let currentNode = this.root;
25
+ for (const segment of segments) {
26
+ if (!currentNode.children.has(segment)) {
27
+ if (segments.indexOf(segment) === segments.length - 1) {
28
+ // The entity type is set only for the last segment of the path
29
+ currentNode.children.set(segment, new TreeNode(entityType));
30
+ }
31
+ else {
32
+ currentNode.children.set(segment, new TreeNode(undefined));
33
+ }
34
+ }
35
+ else {
36
+ // Segment already exists in the tree; update its node properties only if it is the last segment
37
+ currentNode = currentNode.children.get(segment);
38
+ if (segments.indexOf(segment) === segments.length - 1 && !currentNode.entityType) {
39
+ currentNode.entityType = entityType;
40
+ for (const child of currentNode.children.values()) {
41
+ child.containingEntityType = entityType;
42
+ }
43
+ }
44
+ continue;
45
+ }
46
+ // The containing entity type of the current node is the entity type of its parent node
47
+ currentNode.children.get(segment).containingEntityType = currentNode.entityType;
48
+ currentNode = currentNode.children.get(segment);
49
+ currentNode.name = segment;
50
+ }
51
+ }
52
+ // Retrieves all nodes with the given containing entity name.
53
+ getAllNodesWithContainingEntityType(entityName, node = this.root, result = []) {
54
+ if (node.containingEntityType && node.containingEntityType.name === entityName) {
55
+ result.push(node);
56
+ }
57
+ for (const child of node.children.values()) {
58
+ this.getAllNodesWithContainingEntityType(entityName, child, result);
59
+ }
60
+ return result;
61
+ }
62
+ // Retrieves the node for the given path.
63
+ getNodeByPath(path) {
64
+ path = cleanGraphRoutePath(path);
65
+ const segments = path.split('/');
66
+ let currentNode = this.root;
67
+ for (const segment of segments) {
68
+ if (!currentNode) {
69
+ return undefined;
70
+ }
71
+ currentNode = currentNode.children.get(segment);
72
+ }
73
+ return currentNode;
74
+ }
75
+ }
76
+ //# sourceMappingURL=path-tree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-tree.js","sourceRoot":"","sources":["../../src/path-tree.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAyB,MAAM,YAAY,CAAC;AAExE;;EAEE;AACF,MAAM,OAAO,QAAQ;IAMnB,YAAY,aAAgC,SAAS;QACnD,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,oBAAoB,GAAG,SAAS,CAAC;QACtC,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAoB,CAAC;IAC9C,CAAC;CACF;AAED;;EAEE;AACF,MAAM,OAAO,QAAQ;IAGnB;QACE,IAAI,CAAC,IAAI,GAAG,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAED,8DAA8D;IAC9D,OAAO,CAAC,IAAY,EAAE,UAAiB;QACrC,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;QACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEjC,IAAI,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC;QAC5B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;gBACvC,IAAI,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,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AAC,CAAC;QACpB,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;YAC3C,IAAI,CAAC,mCAAmC,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QACtE,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,yCAAyC;IACzC,aAAa,CAAC,IAAY;QACxB,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;QACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,WAAW,GAAyB,IAAI,CAAC,IAAI,CAAC;QAElD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjB,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,WAAW,GAAG,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAClD,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;CAEF"}
@@ -1,6 +1,6 @@
1
1
  import { Program } from "@typespec/compiler";
2
2
  export declare const useEvolvableEnumRule: import("@typespec/compiler").LinterRuleDefinition<"use-evolvable-enum", {
3
- readonly default: import("@typespec/compiler").CallableMessage<[string]>;
3
+ readonly default: import("@typespec/compiler").CallableMessage<["enum"]>;
4
4
  }>;
5
5
  export declare function validateEnumMemberUnknownFutureValueShouldNotHaveDocString(program: Program): void;
6
6
  //# sourceMappingURL=enum.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"graph-route.d.ts","sourceRoot":"","sources":["../../../src/rules/graph-route.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,OAAO,EAAkC,MAAM,oBAAoB,CAAC;AAInG;;GAEG;AAEH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,OAAO,QAW9D;AAyBD,wBAAgB,oDAAoD,CAAC,OAAO,EAAE,OAAO,QAWpF;AAqDD,wBAAgB,wDAAwD,CAAC,OAAO,EAAE,OAAO,QA2BxF;AAeD;;GAEG;AACH,wBAAgB,wDAAwD,CAAC,OAAO,EAAE,OAAO,QA0BxF;AAED,wBAAgB,sCAAsC,CAAC,OAAO,EAAE,OAAO,QAwBtE;AAgBD,wBAAgB,wCAAwC,CAAC,OAAO,EAAE,OAAO,QA6BxE;AAED,wBAAgB,0EAA0E,CAAC,OAAO,EAAE,OAAO,QAsC1G"}
1
+ {"version":3,"file":"graph-route.d.ts","sourceRoot":"","sources":["../../../src/rules/graph-route.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,OAAO,EAAkC,MAAM,oBAAoB,CAAC;AAKnG;;GAEG;AAEH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,OAAO,QAW9D;AAyBD,wBAAgB,oDAAoD,CAAC,OAAO,EAAE,OAAO,QAWpF;AAqDD,wBAAgB,wDAAwD,CAAC,OAAO,EAAE,OAAO,QA2BxF;AAeD;;GAEG;AACH,wBAAgB,wDAAwD,CAAC,OAAO,EAAE,OAAO,QA0BxF;AAED,wBAAgB,sCAAsC,CAAC,OAAO,EAAE,OAAO,QAwBtE;AAgBD,wBAAgB,wCAAwC,CAAC,OAAO,EAAE,OAAO,QA6BxE;AAuBD,wBAAgB,0EAA0E,CAAC,OAAO,EAAE,OAAO,QA0E1G"}
@@ -1,8 +1,9 @@
1
1
  import { reportDiagnostic } from "../lib.js";
2
- import { extractParamsFromPath, getGraphRoutePaths, getGraphRoutes, hasGraphRoute } from "../index.js";
2
+ import { extractParamsFromPath, getGraphRoutePaths, getGraphRoutes, getPartialReferenceModel, hasGraphRoute, isAction, isFunction, isPartial } from "../index.js";
3
3
  import { navigateTypesInNamespace } from "@typespec/compiler";
4
- import { getAllNestedNavigationPaths, getIdForType, getSourceInterfaces, removeRoutePathParams } from "../utils.js";
4
+ import { cleanGraphRoutePath, getAllNestedNavigationPaths, getIdForType, getInterfaceNavigationSourceType, getSourceInterfaces, isInterfaceBindingTypeOwned, removeRoutePathParams } from "../utils.js";
5
5
  import { GetDeclaredNamespaces } from "../entities/namespace.js";
6
+ import { PathTree } from "../path-tree.js";
6
7
  /**
7
8
  * @graphRoute should not have a leading forward slash
8
9
  */
@@ -222,7 +223,27 @@ export function validateGraphRouteParametersMustBeUnique(program) {
222
223
  });
223
224
  }
224
225
  }
226
+ function buildPathTree(program) {
227
+ const tree = new PathTree();
228
+ for (const namespace of GetDeclaredNamespaces(program)) {
229
+ navigateTypesInNamespace(namespace, {
230
+ interface: ($interface) => {
231
+ if (!hasGraphRoute(program, $interface)) {
232
+ return;
233
+ }
234
+ const entityType = getInterfaceNavigationSourceType(program, $interface);
235
+ getGraphRoutePaths(program, $interface).forEach(graphRoutePath => {
236
+ const path = removeRoutePathParams(graphRoutePath);
237
+ tree.addNode(path, entityType);
238
+ });
239
+ }
240
+ });
241
+ }
242
+ return tree;
243
+ }
225
244
  export function validateGraphRouteMustMatchModelStructureWithRespectToNavigationProperties(program) {
245
+ // Capture all the segments and their types in a tree structure
246
+ const pathTree = buildPathTree(program);
226
247
  for (const namespace of GetDeclaredNamespaces(program)) {
227
248
  navigateTypesInNamespace(namespace, {
228
249
  interface: ($interface) => {
@@ -231,25 +252,52 @@ export function validateGraphRouteMustMatchModelStructureWithRespectToNavigation
231
252
  }
232
253
  const graphRoutePaths = getGraphRoutePaths(program, $interface);
233
254
  graphRoutePaths.forEach(graphRoutePath => {
255
+ var _a, _b, _c;
234
256
  if (removeRoutePathParams(graphRoutePath).split("/").length === 1) {
235
257
  return;
236
258
  }
237
- const entitySegment = getEntitySegment(graphRoutePath);
238
- const structuralPath = getStructuralPathFromGraphRoute(entitySegment, graphRoutePath);
239
- const models = namespace.models;
240
- const routeModel = models.get(entitySegment);
241
- if (routeModel) {
242
- const structuralProperties = getAllNestedNavigationPaths(program, routeModel);
243
- if (!structuralProperties.includes(structuralPath)) {
244
- reportDiagnostic(program, {
245
- code: "decorator-invalid-use",
246
- target: $interface,
247
- messageId: "graphRouteMustMatchModelStructure",
248
- format: {
249
- graphRoute: graphRoutePath,
250
- model: routeModel.name,
259
+ const path = cleanGraphRoutePath(graphRoutePath);
260
+ const segments = path.split("/");
261
+ for (const segment of segments) {
262
+ if (segments.indexOf(segment) === segments.length - 1) {
263
+ break;
264
+ }
265
+ // Check whether the current entity segment and subsequent navigation property segment make a valid navigation path
266
+ const entitySegment = (_c = (_b = (_a = pathTree.getNodeByPath(segment)) === null || _a === void 0 ? void 0 : _a.entityType) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : getEntitySegment(graphRoutePath);
267
+ if (!entitySegment) {
268
+ /* TODO:
269
+ A decorator-invalid-use diagnostic should be reported for this case;
270
+ a graphRoute must have all its navigation segments defined on at least one interface.
271
+ issue: https://github.com/microsoftgraph/typespec-msgraph/issues/848 and
272
+ issue: https://github.com/microsoftgraph/typespec-msgraph/issues/817
273
+ Evaluation: 'getEntitySegment(graphRoutePath)' wll subsequently need to be removed
274
+ */
275
+ return;
276
+ }
277
+ const navPropSegment = segments[segments.indexOf(segment) + 1];
278
+ const structuralPath = entitySegment.concat("/", navPropSegment);
279
+ const routeModel = namespace.models.get(entitySegment);
280
+ if (routeModel) {
281
+ const structuralProperties = getAllNestedNavigationPaths(program, routeModel);
282
+ if (isPartial(program, routeModel)) {
283
+ const partialModel = getPartialReferenceModel(program, routeModel);
284
+ if (partialModel) {
285
+ structuralProperties.push(...getAllNestedNavigationPaths(program, partialModel));
251
286
  }
252
- });
287
+ }
288
+ if (!structuralProperties.includes(structuralPath)
289
+ && !isActionFunctionOnPartialType(program, $interface)) {
290
+ reportDiagnostic(program, {
291
+ code: "decorator-invalid-use",
292
+ target: $interface,
293
+ messageId: "graphRouteMustMatchModelStructure",
294
+ format: {
295
+ graphRoute: graphRoutePath,
296
+ model: routeModel.name,
297
+ },
298
+ });
299
+ }
300
+ return;
253
301
  }
254
302
  }
255
303
  });
@@ -257,30 +305,19 @@ export function validateGraphRouteMustMatchModelStructureWithRespectToNavigation
257
305
  });
258
306
  }
259
307
  }
260
- /**
261
- * This function removes the composable function pattern from the path
262
- * accessReviews/{reviewId}/instances/{instanceId}/decisions/filterByCurrentUser(string) -> accessReviews/{reviewId}/instances/{instanceId}/decisions
263
- * @param path
264
- * @returns
265
- */
266
- const removeComposableFunctionPattern = (path) => {
267
- const pattern = /\/[^/]+(\((?:[^]*|\([^()]*\))*\))/g;
268
- if (pattern.test(path)) {
269
- return path.replace(pattern, '');
308
+ function isActionFunctionOnPartialType(program, $interface) {
309
+ if (isInterfaceBindingTypeOwned(program, $interface)) {
310
+ return false;
270
311
  }
271
- return path;
272
- };
273
- function getStructuralPathFromGraphRoute(entitySegment, graphRoutePath) {
274
- let structuralPath = entitySegment.concat("/", removeRoutePathParams(graphRoutePath).split("/").slice(1).join("/"));
275
- structuralPath = removeTrailingRef(structuralPath);
276
- structuralPath = removeComposableFunctionPattern(structuralPath);
277
- return structuralPath;
278
- }
279
- function removeTrailingRef(path) {
280
- if (path.endsWith("/$ref")) {
281
- return path.slice(0, -5);
312
+ if ($interface.operations.size > 0) {
313
+ for (const operation of $interface.operations.values()) {
314
+ if (!(isAction(program, operation) || isFunction(program, operation))) {
315
+ return false;
316
+ }
317
+ }
318
+ return true;
282
319
  }
283
- return path;
320
+ return false;
284
321
  }
285
322
  function getEntitySegment(graphRoutePath) {
286
323
  const routeWithoutParams = removeRoutePathParams(graphRoutePath);