@microsoft/typespec-msgraph 0.0.1-Preview.11 → 0.0.1-Preview.13

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 (218) hide show
  1. package/dist/src/components/annotations.js +21 -3
  2. package/dist/src/components/annotations.js.map +1 -1
  3. package/dist/src/components/operation-element.d.ts.map +1 -1
  4. package/dist/src/components/operation-element.js +16 -5
  5. package/dist/src/components/operation-element.js.map +1 -1
  6. package/dist/src/components/property-element.js +1 -1
  7. package/dist/src/components/property-element.js.map +1 -1
  8. package/dist/src/components/revisions-annotation.d.ts.map +1 -1
  9. package/dist/src/components/revisions-annotation.js +2 -1
  10. package/dist/src/components/revisions-annotation.js.map +1 -1
  11. package/dist/src/components/schema-element.d.ts.map +1 -1
  12. package/dist/src/components/schema-element.js +5 -3
  13. package/dist/src/components/schema-element.js.map +1 -1
  14. package/dist/src/components/term-element.d.ts +9 -0
  15. package/dist/src/components/term-element.d.ts.map +1 -0
  16. package/dist/src/components/term-element.js +8 -0
  17. package/dist/src/components/term-element.js.map +1 -0
  18. package/dist/src/decorators/ags-attribute.d.ts +2 -1
  19. package/dist/src/decorators/ags-attribute.d.ts.map +1 -1
  20. package/dist/src/decorators/ags-attribute.js +37 -1
  21. package/dist/src/decorators/ags-attribute.js.map +1 -1
  22. package/dist/src/decorators/experimental.d.ts +9 -0
  23. package/dist/src/decorators/experimental.d.ts.map +1 -0
  24. package/dist/src/decorators/experimental.js +13 -0
  25. package/dist/src/decorators/experimental.js.map +1 -0
  26. package/dist/src/decorators/global-operation.d.ts +9 -0
  27. package/dist/src/decorators/global-operation.d.ts.map +1 -0
  28. package/dist/src/decorators/global-operation.js +13 -0
  29. package/dist/src/decorators/global-operation.js.map +1 -0
  30. package/dist/src/decorators/graph-deprecated.d.ts +11 -0
  31. package/dist/src/decorators/graph-deprecated.d.ts.map +1 -0
  32. package/dist/src/decorators/graph-deprecated.js +19 -0
  33. package/dist/src/decorators/graph-deprecated.js.map +1 -0
  34. package/dist/src/decorators/index.d.ts +5 -0
  35. package/dist/src/decorators/index.d.ts.map +1 -1
  36. package/dist/src/decorators/index.js +5 -0
  37. package/dist/src/decorators/index.js.map +1 -1
  38. package/dist/src/decorators/is-owner.js +1 -1
  39. package/dist/src/decorators/ownerless.d.ts +8 -0
  40. package/dist/src/decorators/ownerless.d.ts.map +1 -0
  41. package/dist/src/decorators/ownerless.js +12 -0
  42. package/dist/src/decorators/ownerless.js.map +1 -0
  43. package/dist/src/decorators/public-namespace.d.ts.map +1 -1
  44. package/dist/src/decorators/public-namespace.js +4 -1
  45. package/dist/src/decorators/public-namespace.js.map +1 -1
  46. package/dist/src/decorators/term.d.ts +13 -0
  47. package/dist/src/decorators/term.d.ts.map +1 -0
  48. package/dist/src/decorators/term.js +14 -0
  49. package/dist/src/decorators/term.js.map +1 -0
  50. package/dist/src/emitter.d.ts.map +1 -1
  51. package/dist/src/emitter.js +2 -0
  52. package/dist/src/emitter.js.map +1 -1
  53. package/dist/src/entities/annotations.d.ts +4 -0
  54. package/dist/src/entities/annotations.d.ts.map +1 -1
  55. package/dist/src/entities/annotations.js +15 -0
  56. package/dist/src/entities/annotations.js.map +1 -1
  57. package/dist/src/entities/enum.js.map +1 -1
  58. package/dist/src/entities/model.d.ts +1 -0
  59. package/dist/src/entities/model.d.ts.map +1 -1
  60. package/dist/src/entities/model.js +54 -4
  61. package/dist/src/entities/model.js.map +1 -1
  62. package/dist/src/entities/namespace.d.ts +6 -1
  63. package/dist/src/entities/namespace.d.ts.map +1 -1
  64. package/dist/src/entities/namespace.js +93 -6
  65. package/dist/src/entities/namespace.js.map +1 -1
  66. package/dist/src/entities/operation.d.ts +5 -0
  67. package/dist/src/entities/operation.d.ts.map +1 -1
  68. package/dist/src/entities/operation.js +32 -8
  69. package/dist/src/entities/operation.js.map +1 -1
  70. package/dist/src/entities/revision-definition.d.ts +1 -0
  71. package/dist/src/entities/revision-definition.d.ts.map +1 -1
  72. package/dist/src/entities/revision-definition.js +3 -3
  73. package/dist/src/entities/revision-definition.js.map +1 -1
  74. package/dist/src/entities/term.d.ts +8 -0
  75. package/dist/src/entities/term.d.ts.map +1 -0
  76. package/dist/src/entities/term.js +14 -0
  77. package/dist/src/entities/term.js.map +1 -0
  78. package/dist/src/index.d.ts +1 -1
  79. package/dist/src/index.d.ts.map +1 -1
  80. package/dist/src/index.js +1 -1
  81. package/dist/src/index.js.map +1 -1
  82. package/dist/src/lib.d.ts +59 -142
  83. package/dist/src/lib.d.ts.map +1 -1
  84. package/dist/src/lib.js +20 -10
  85. package/dist/src/lib.js.map +1 -1
  86. package/dist/src/rules/allowed-values.d.ts +2 -1
  87. package/dist/src/rules/allowed-values.d.ts.map +1 -1
  88. package/dist/src/rules/allowed-values.js +7 -7
  89. package/dist/src/rules/allowed-values.js.map +1 -1
  90. package/dist/src/rules/alternate-key.d.ts +4 -3
  91. package/dist/src/rules/alternate-key.d.ts.map +1 -1
  92. package/dist/src/rules/alternate-key.js +23 -23
  93. package/dist/src/rules/alternate-key.js.map +1 -1
  94. package/dist/src/rules/collection-navigation-properties-not-nullable.d.ts +2 -1
  95. package/dist/src/rules/collection-navigation-properties-not-nullable.d.ts.map +1 -1
  96. package/dist/src/rules/collection-navigation-properties-not-nullable.js +9 -9
  97. package/dist/src/rules/collection-navigation-properties-not-nullable.js.map +1 -1
  98. package/dist/src/rules/computed.d.ts +2 -1
  99. package/dist/src/rules/computed.d.ts.map +1 -1
  100. package/dist/src/rules/computed.js +9 -8
  101. package/dist/src/rules/computed.js.map +1 -1
  102. package/dist/src/rules/contains.d.ts +2 -1
  103. package/dist/src/rules/contains.d.ts.map +1 -1
  104. package/dist/src/rules/contains.js +9 -8
  105. package/dist/src/rules/contains.js.map +1 -1
  106. package/dist/src/rules/count.d.ts +2 -1
  107. package/dist/src/rules/count.d.ts.map +1 -1
  108. package/dist/src/rules/count.js +9 -8
  109. package/dist/src/rules/count.js.map +1 -1
  110. package/dist/src/rules/disallowed-typespec-decorators.d.ts +2 -1
  111. package/dist/src/rules/disallowed-typespec-decorators.d.ts.map +1 -1
  112. package/dist/src/rules/disallowed-typespec-decorators.js +29 -25
  113. package/dist/src/rules/disallowed-typespec-decorators.js.map +1 -1
  114. package/dist/src/rules/entity.d.ts +5 -2
  115. package/dist/src/rules/entity.d.ts.map +1 -1
  116. package/dist/src/rules/entity.js +102 -19
  117. package/dist/src/rules/entity.js.map +1 -1
  118. package/dist/src/rules/enum.d.ts +3 -1
  119. package/dist/src/rules/enum.d.ts.map +1 -1
  120. package/dist/src/rules/enum.js +9 -6
  121. package/dist/src/rules/enum.js.map +1 -1
  122. package/dist/src/rules/expand.d.ts +3 -2
  123. package/dist/src/rules/expand.d.ts.map +1 -1
  124. package/dist/src/rules/expand.js +16 -16
  125. package/dist/src/rules/expand.js.map +1 -1
  126. package/dist/src/rules/extends-on-same-type.d.ts +2 -1
  127. package/dist/src/rules/extends-on-same-type.d.ts.map +1 -1
  128. package/dist/src/rules/extends-on-same-type.js +9 -8
  129. package/dist/src/rules/extends-on-same-type.js.map +1 -1
  130. package/dist/src/rules/filter.d.ts +4 -3
  131. package/dist/src/rules/filter.d.ts.map +1 -1
  132. package/dist/src/rules/filter.js +23 -23
  133. package/dist/src/rules/filter.js.map +1 -1
  134. package/dist/src/rules/function.d.ts +2 -1
  135. package/dist/src/rules/function.d.ts.map +1 -1
  136. package/dist/src/rules/function.js +9 -9
  137. package/dist/src/rules/function.js.map +1 -1
  138. package/dist/src/rules/global-operation.d.ts +4 -0
  139. package/dist/src/rules/global-operation.d.ts.map +1 -0
  140. package/dist/src/rules/global-operation.js +60 -0
  141. package/dist/src/rules/global-operation.js.map +1 -0
  142. package/dist/src/rules/graph-deprecated.d.ts +8 -0
  143. package/dist/src/rules/graph-deprecated.d.ts.map +1 -0
  144. package/dist/src/rules/graph-deprecated.js +152 -0
  145. package/dist/src/rules/graph-deprecated.js.map +1 -0
  146. package/dist/src/rules/graph-route.d.ts +4 -2
  147. package/dist/src/rules/graph-route.d.ts.map +1 -1
  148. package/dist/src/rules/graph-route.js +55 -15
  149. package/dist/src/rules/graph-route.js.map +1 -1
  150. package/dist/src/rules/has-stream.d.ts +2 -1
  151. package/dist/src/rules/has-stream.d.ts.map +1 -1
  152. package/dist/src/rules/has-stream.js +9 -8
  153. package/dist/src/rules/has-stream.js.map +1 -1
  154. package/dist/src/rules/index.d.ts +3 -0
  155. package/dist/src/rules/index.d.ts.map +1 -1
  156. package/dist/src/rules/index.js +3 -0
  157. package/dist/src/rules/index.js.map +1 -1
  158. package/dist/src/rules/namespace.d.ts +4 -2
  159. package/dist/src/rules/namespace.d.ts.map +1 -1
  160. package/dist/src/rules/namespace.js +66 -35
  161. package/dist/src/rules/namespace.js.map +1 -1
  162. package/dist/src/rules/open.d.ts +2 -1
  163. package/dist/src/rules/open.d.ts.map +1 -1
  164. package/dist/src/rules/open.js +9 -8
  165. package/dist/src/rules/open.js.map +1 -1
  166. package/dist/src/rules/operation-inside-interface.d.ts +2 -1
  167. package/dist/src/rules/operation-inside-interface.d.ts.map +1 -1
  168. package/dist/src/rules/operation-inside-interface.js +9 -8
  169. package/dist/src/rules/operation-inside-interface.js.map +1 -1
  170. package/dist/src/rules/order-by.d.ts +3 -2
  171. package/dist/src/rules/order-by.d.ts.map +1 -1
  172. package/dist/src/rules/order-by.js +16 -16
  173. package/dist/src/rules/order-by.js.map +1 -1
  174. package/dist/src/rules/ownerless.d.ts +10 -0
  175. package/dist/src/rules/ownerless.d.ts.map +1 -0
  176. package/dist/src/rules/ownerless.js +155 -0
  177. package/dist/src/rules/ownerless.js.map +1 -0
  178. package/dist/src/rules/partial.d.ts +2 -1
  179. package/dist/src/rules/partial.d.ts.map +1 -1
  180. package/dist/src/rules/partial.js +9 -8
  181. package/dist/src/rules/partial.js.map +1 -1
  182. package/dist/src/rules/references.d.ts +2 -1
  183. package/dist/src/rules/references.d.ts.map +1 -1
  184. package/dist/src/rules/references.js +9 -8
  185. package/dist/src/rules/references.js.map +1 -1
  186. package/dist/src/rules/required-for-create.d.ts +2 -1
  187. package/dist/src/rules/required-for-create.d.ts.map +1 -1
  188. package/dist/src/rules/required-for-create.js +9 -8
  189. package/dist/src/rules/required-for-create.js.map +1 -1
  190. package/dist/src/rules/search.d.ts +2 -1
  191. package/dist/src/rules/search.d.ts.map +1 -1
  192. package/dist/src/rules/search.js +9 -8
  193. package/dist/src/rules/search.js.map +1 -1
  194. package/dist/src/rules/skip.d.ts +2 -1
  195. package/dist/src/rules/skip.d.ts.map +1 -1
  196. package/dist/src/rules/skip.js +9 -8
  197. package/dist/src/rules/skip.js.map +1 -1
  198. package/dist/src/rules/top.d.ts +2 -1
  199. package/dist/src/rules/top.d.ts.map +1 -1
  200. package/dist/src/rules/top.js +9 -8
  201. package/dist/src/rules/top.js.map +1 -1
  202. package/dist/src/testing/index.d.ts +1 -0
  203. package/dist/src/testing/index.d.ts.map +1 -1
  204. package/dist/src/testing/index.js +21 -0
  205. package/dist/src/testing/index.js.map +1 -1
  206. package/dist/src/utils.d.ts +4 -0
  207. package/dist/src/utils.d.ts.map +1 -1
  208. package/dist/src/utils.js +68 -20
  209. package/dist/src/utils.js.map +1 -1
  210. package/dist/src/{linter.d.ts → validate.d.ts} +1 -1
  211. package/dist/src/validate.d.ts.map +1 -0
  212. package/dist/src/validate.js +51 -0
  213. package/dist/src/validate.js.map +1 -0
  214. package/lib/decorators.tsp +35 -0
  215. package/package.json +5 -7
  216. package/dist/src/linter.d.ts.map +0 -1
  217. package/dist/src/linter.js +0 -44
  218. package/dist/src/linter.js.map +0 -1
@@ -0,0 +1,155 @@
1
+ import { getLocationContext, navigateTypesInNamespace, } from "@typespec/compiler";
2
+ import { getGraphRoutePaths, hasIsOwner, isComplex, isContains, isOwnerless, isReferences } from "../index.js";
3
+ import { getInterfaceNavigationSourceType } from "../utils.js";
4
+ import { reportDiagnostic } from "../lib.js";
5
+ import { GetDeclaredNamespaces, getNavigationSources } from "../entities/namespace.js";
6
+ /***
7
+ * @ownerless can only be applied to interfaces
8
+ */
9
+ export function validateOwnerlessMustOnlyBeAppliedToInterfacesWithSingleSegmentGraphRoute(program) {
10
+ for (const namespace of GetDeclaredNamespaces(program)) {
11
+ navigateTypesInNamespace(namespace, {
12
+ interface: (interfaceModel) => {
13
+ if (isLibraryTypeOrNotOwnerless(program, interfaceModel)) {
14
+ return;
15
+ }
16
+ const paths = getGraphRoutePaths(program, interfaceModel);
17
+ if (!paths) {
18
+ reportOwnerlessDiagnostic(program, interfaceModel, 'ownerlessMustBeAppliedToInterfacesWithSingleSegmentGraphRouteRule');
19
+ }
20
+ if (paths) {
21
+ const pathParts = paths[0].split("/");
22
+ if (pathParts.length > 1) {
23
+ reportOwnerlessDiagnostic(program, interfaceModel, 'ownerlessMustBeAppliedToInterfacesWithSingleSegmentGraphRouteRule');
24
+ }
25
+ }
26
+ }
27
+ });
28
+ }
29
+ }
30
+ ;
31
+ export function validateOwnerlessEntityModelReferencedMustOnlyHaveNavigationPropertiesRule(program) {
32
+ for (const namespace of GetDeclaredNamespaces(program)) {
33
+ navigateTypesInNamespace(namespace, {
34
+ interface: (interfaceModel) => {
35
+ if (isLibraryTypeOrNotOwnerless(program, interfaceModel)) {
36
+ return;
37
+ }
38
+ const bindingType = getInterfaceNavigationSourceType(program, interfaceModel);
39
+ if (bindingType) {
40
+ const bindingTypeProperties = [...bindingType.properties];
41
+ bindingTypeProperties.forEach(([_, property]) => {
42
+ if (isContains(program, property)) {
43
+ return;
44
+ }
45
+ if (isReferences(program, property)) {
46
+ return;
47
+ }
48
+ if (property.type.kind === "Model" && isComplex(program, property.type)) {
49
+ reportOwnerlessDiagnostic(program, interfaceModel, 'referencedEntityModelCannotHaveComplexTypeProperties');
50
+ }
51
+ reportOwnerlessDiagnostic(program, interfaceModel, 'referencedEntityModelCanOnlyHaveNavigationProperties');
52
+ });
53
+ }
54
+ }
55
+ });
56
+ }
57
+ }
58
+ ;
59
+ export function validateOwnerlessInterfaceMustNotHaveAnyOperations(program) {
60
+ for (const namespace of GetDeclaredNamespaces(program)) {
61
+ navigateTypesInNamespace(namespace, {
62
+ interface: (interfaceModel) => {
63
+ if (isLibraryTypeOrNotOwnerless(program, interfaceModel)) {
64
+ return;
65
+ }
66
+ if (interfaceModel.operations.size > 0) {
67
+ reportOwnerlessDiagnostic(program, interfaceModel, 'ownerlessInterfaceCannotHaveAnyOperations');
68
+ }
69
+ }
70
+ });
71
+ }
72
+ }
73
+ ;
74
+ export function validateOwnerlessDecoratorCannotBeUsedWithIsOwner(program) {
75
+ for (const namespace of GetDeclaredNamespaces(program)) {
76
+ navigateTypesInNamespace(namespace, {
77
+ interface: (interfaceModel) => {
78
+ if (isLibraryTypeOrNotOwnerless(program, interfaceModel)) {
79
+ return;
80
+ }
81
+ const bindingType = getInterfaceNavigationSourceType(program, interfaceModel);
82
+ if (bindingType && hasIsOwner(program, bindingType)) {
83
+ reportOwnerlessDiagnostic(program, interfaceModel, 'ownerlessDecoratorCannotBeUsedWithIsOwner');
84
+ }
85
+ }
86
+ });
87
+ }
88
+ }
89
+ ;
90
+ export function validateEntityTypeInOwnerlessExtendsClauseCannotBeUsedInOtherInterfaces(program) {
91
+ const interfaces = getInterfaces(program);
92
+ const { bindingType, ownerlessInterface } = getBindingTypeAndOwnerlessInterface(program, interfaces);
93
+ for (const namespace of GetDeclaredNamespaces(program)) {
94
+ navigateTypesInNamespace(namespace, {
95
+ interface: (interfaceModel) => {
96
+ if (getLocationContext(program, interfaceModel).type === 'library') {
97
+ return;
98
+ }
99
+ if (interfaceModel === ownerlessInterface) {
100
+ return;
101
+ }
102
+ const currentInterfaceBindingType = getInterfaceNavigationSourceType(program, interfaceModel);
103
+ if (bindingType && currentInterfaceBindingType && bindingType.name === currentInterfaceBindingType.name) {
104
+ reportOwnerlessDiagnostic(program, interfaceModel, 'entityTypeInOnwerlessCannotBeUsedWithOtherInterfaces');
105
+ }
106
+ }
107
+ });
108
+ }
109
+ }
110
+ ;
111
+ function getBindingTypeAndOwnerlessInterface(program, interfaces) {
112
+ let bindingType = {};
113
+ let ownerlessInterface = {};
114
+ for (const interfaceModel of interfaces) {
115
+ if (isOwnerless(program, interfaceModel)) {
116
+ bindingType = getInterfaceNavigationSourceType(program, interfaceModel);
117
+ ownerlessInterface = interfaceModel;
118
+ break;
119
+ }
120
+ }
121
+ return { bindingType, ownerlessInterface };
122
+ }
123
+ function getInterfaces(program) {
124
+ const interfaces = [];
125
+ GetDeclaredNamespaces(program).forEach(namespace => {
126
+ const sources = getNavigationSources(namespace.interfaces);
127
+ sources.forEach(source => {
128
+ interfaces.push(source);
129
+ });
130
+ });
131
+ return interfaces;
132
+ }
133
+ function isLibraryTypeOrNotOwnerless(program, interfaceModel) {
134
+ return getLocationContext(program, interfaceModel).type === 'library' || !isOwnerless(program, interfaceModel);
135
+ }
136
+ // Note that type checking for messageId has been disabled to avoid the maintainance burden of adding a new union type value
137
+ // to the messageId parameter of the reportDiagnostic function for each new diagnostic message in the lib.ts file.
138
+ function reportOwnerlessDiagnostic(program, interfaceModel, messageId) {
139
+ reportDiagnostic(program, {
140
+ code: 'decorator-invalid-use',
141
+ target: interfaceModel,
142
+ messageId: messageId,
143
+ format: {
144
+ model: "",
145
+ namespace: "",
146
+ decorator: "@ownerless",
147
+ location: "",
148
+ other: "",
149
+ parameters: "",
150
+ properties: "",
151
+ target: ""
152
+ }
153
+ });
154
+ }
155
+ //# sourceMappingURL=ownerless.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ownerless.js","sourceRoot":"","sources":["../../../src/rules/ownerless.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,kBAAkB,EAAE,wBAAwB,GAAG,MAAM,oBAAoB,CAAC;AAC9G,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC/G,OAAO,EAAE,gCAAgC,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WA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M,EAAE,EAAE;SACX;KACF,CAAC,CAAA;AACJ,CAAC"}
@@ -1,5 +1,6 @@
1
+ import { Program } from "@typespec/compiler";
1
2
  /**
2
3
  * @partial applies to a model.
3
4
  */
4
- export declare const extendedModelBaseShouldMatchPartialBaseModel: import("@typespec/lint").LintRule;
5
+ export declare function validateExtendedModelBaseShouldMatchPartialBaseModel(program: Program): void;
5
6
  //# sourceMappingURL=partial.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"partial.d.ts","sourceRoot":"","sources":["../../../src/rules/partial.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,eAAO,MAAM,4CAA4C,mCA0BvD,CAAC"}
1
+ {"version":3,"file":"partial.d.ts","sourceRoot":"","sources":["../../../src/rules/partial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA4B,MAAM,oBAAoB,CAAC;AAMvE;;GAEG;AAEH,wBAAgB,oDAAoD,CAAC,OAAO,EAAE,OAAO,QAyBpF"}
@@ -1,13 +1,13 @@
1
- import { createRule } from "@typespec/lint";
1
+ import { navigateTypesInNamespace } from "@typespec/compiler";
2
2
  import { getPartialReferenceModel, isPartial } from "../index.js";
3
3
  import { reportDiagnostic } from "../lib.js";
4
+ import { GetDeclaredNamespaces } from "../entities/namespace.js";
4
5
  /**
5
6
  * @partial applies to a model.
6
7
  */
7
- export const extendedModelBaseShouldMatchPartialBaseModel = createRule({
8
- name: "extended-model-base-should-match-partial-model-base",
9
- create({ program }) {
10
- return {
8
+ export function validateExtendedModelBaseShouldMatchPartialBaseModel(program) {
9
+ for (const namespace of GetDeclaredNamespaces(program)) {
10
+ navigateTypesInNamespace(namespace, {
11
11
  model: (model) => {
12
12
  var _a, _b;
13
13
  if (!isPartial(program, model)) {
@@ -29,7 +29,8 @@ export const extendedModelBaseShouldMatchPartialBaseModel = createRule({
29
29
  });
30
30
  }
31
31
  },
32
- };
33
- },
34
- });
32
+ });
33
+ }
34
+ }
35
+ ;
35
36
  //# sourceMappingURL=partial.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"partial.js","sourceRoot":"","sources":["../../../src/rules/partial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAG7C;;GAEG;AAEH,MAAM,CAAC,MAAM,4CAA4C,GAAG,UAAU,CAAC;IACrE,IAAI,EAAE,qDAAqD;IAC3D,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;;gBACf,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;oBAC9B,OAAO;iBACR;gBACD,IAAG,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,CAAA,EAAC;oBACnB,OAAO;iBACR;gBACD,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;gBAClE,IAAG,CAAA,MAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,SAAS,0CAAE,IAAI,OAAK,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,0CAAE,IAAI,CAAA,EAAC;oBAC9D,gBAAgB,CAAC,OAAO,EAAE;wBACxB,IAAI,EAAE,uBAAuB;wBAC7B,MAAM,EAAE,KAAK;wBACb,SAAS,EAAE,SAAS;wBACpB,MAAM,EAAE;4BACN,SAAS,EAAE,UAAU;4BACrB,MAAM,EAAE,OAAO;yBAChB;qBACF,CAAC,CAAC;iBACJ;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"partial.js","sourceRoot":"","sources":["../../../src/rules/partial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAGjE;;GAEG;AAEH,MAAM,UAAU,oDAAoD,CAAC,OAAgB;IACnF,KAAK,MAAM,SAAS,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAE;QACtD,wBAAwB,CAAC,SAAS,EAAE;YAClC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;;gBACf,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE;oBAC9B,OAAO;iBACR;gBACD,IAAG,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,CAAA,EAAC;oBACnB,OAAO;iBACR;gBACD,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;gBAClE,IAAG,CAAA,MAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,SAAS,0CAAE,IAAI,OAAK,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,0CAAE,IAAI,CAAA,EAAC;oBAC9D,gBAAgB,CAAC,OAAO,EAAE;wBACxB,IAAI,EAAE,uBAAuB;wBAC7B,MAAM,EAAE,KAAK;wBACb,SAAS,EAAE,SAAS;wBACpB,MAAM,EAAE;4BACN,SAAS,EAAE,UAAU;4BACrB,MAAM,EAAE,OAAO;yBAChB;qBACF,CAAC,CAAC;iBACJ;YACH,CAAC;SACF,CAAC,CAAC;KACJ;AACH,CAAC;AAAA,CAAC"}
@@ -1,5 +1,6 @@
1
+ import { Program } from "@typespec/compiler";
1
2
  /**
2
3
  * @references applies to a navigation property.
3
4
  */
4
- export declare const referencesOnlyAppliesToNavigationPropertyRule: import("@typespec/lint").LintRule;
5
+ export declare function validateReferencesOnlyAppliesToNavigationProperty(program: Program): void;
5
6
  //# sourceMappingURL=references.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../../src/rules/references.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,6CAA6C,mCAyBxD,CAAC"}
1
+ {"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../../src/rules/references.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAA4B,MAAM,oBAAoB,CAAC;AAGvE;;GAEG;AACH,wBAAgB,iDAAiD,CAAC,OAAO,EAAE,OAAO,QAwBjF"}
@@ -1,14 +1,14 @@
1
- import { createRule } from "@typespec/lint";
2
1
  import { isReferences } from "../index.js";
3
2
  import { reportDiagnostic } from "../lib.js";
4
3
  import { isNavigationProperty } from "../utils.js";
4
+ import { navigateTypesInNamespace } from "@typespec/compiler";
5
+ import { GetDeclaredNamespaces } from "../entities/namespace.js";
5
6
  /**
6
7
  * @references applies to a navigation property.
7
8
  */
8
- export const referencesOnlyAppliesToNavigationPropertyRule = createRule({
9
- name: "references-only-applies-to-navigation-property",
10
- create({ program }) {
11
- return {
9
+ export function validateReferencesOnlyAppliesToNavigationProperty(program) {
10
+ for (const namespace of GetDeclaredNamespaces(program)) {
11
+ navigateTypesInNamespace(namespace, {
12
12
  modelProperty: (property) => {
13
13
  if (!isReferences(program, property)) {
14
14
  return;
@@ -26,7 +26,8 @@ export const referencesOnlyAppliesToNavigationPropertyRule = createRule({
26
26
  },
27
27
  });
28
28
  },
29
- };
30
- },
31
- });
29
+ });
30
+ }
31
+ }
32
+ ;
32
33
  //# sourceMappingURL=references.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"references.js","sourceRoot":"","sources":["../../../src/rules/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,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AAC,OAAO,EAAE,QAAQ,CAAC,EAAE;oBACpC,OAAO;iBACR;gBAED,IAAI,oBAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE;oBAC3C,OAAO;iBACR;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,QAAQ;oBAChB,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE;wBACN,SAAS,EAAE,aAAa;wBACxB,MAAM,EAAE,wCAAwC;qBACjD;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;KACJ;AACH,CAAC;AAAA,CAAC"}
@@ -1,2 +1,3 @@
1
- export declare const requiredRequestParametersRule: import("@typespec/lint").LintRule;
1
+ import { Program } from "@typespec/compiler";
2
+ export declare function validateRequiredRequestParameters(program: Program): void;
2
3
  //# sourceMappingURL=required-for-create.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"required-for-create.d.ts","sourceRoot":"","sources":["../../../src/rules/required-for-create.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,6BAA6B,mCAsCxC,CAAC"}
1
+ {"version":3,"file":"required-for-create.d.ts","sourceRoot":"","sources":["../../../src/rules/required-for-create.ts"],"names":[],"mappings":"AAGA,OAAO,EAAS,OAAO,EAA4B,MAAM,oBAAoB,CAAC;AAI9E,wBAAgB,iCAAiC,CAAC,OAAO,EAAE,OAAO,QAqCjE"}
@@ -1,12 +1,12 @@
1
- import { createRule } from "@typespec/lint";
2
1
  import { isComputed, isRequiredForCreate } from "../index.js";
3
2
  import { getIdForType, isTypeNullable } from "../utils.js";
4
3
  import { getOperationVerb } from "@typespec/http";
4
+ import { navigateTypesInNamespace } from "@typespec/compiler";
5
5
  import { reportDiagnostic } from "../lib.js";
6
- export const requiredRequestParametersRule = createRule({
7
- name: "required-request-parameters",
8
- create({ program }) {
9
- return {
6
+ import { GetDeclaredNamespaces } from "../entities/namespace.js";
7
+ export function validateRequiredRequestParameters(program) {
8
+ for (const namespace of GetDeclaredNamespaces(program)) {
9
+ navigateTypesInNamespace(namespace, {
10
10
  interface: (theInterface) => {
11
11
  const postOperations = [...theInterface.operations]
12
12
  .map(([_, operation]) => operation)
@@ -34,7 +34,8 @@ export const requiredRequestParametersRule = createRule({
34
34
  }
35
35
  });
36
36
  },
37
- };
38
- },
39
- });
37
+ });
38
+ }
39
+ }
40
+ ;
40
41
  //# sourceMappingURL=required-for-create.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"required-for-create.js","sourceRoot":"","sources":["../../../src/rules/required-for-create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,CAAC,MAAM,6BAA6B,GAAG,UAAU,CAAC;IACtD,IAAI,EAAE,6BAA6B;IACnC,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,SAAS,EAAE,CAAC,YAAY,EAAE,EAAE;gBAC1B,MAAM,cAAc,GAAG,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC;qBAChD,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC;qBAClC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,KAAK,MAAM,CAAC,CAAC;gBAE1E,cAAc,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;oBACnC,IAAI,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;wBAC/C,MAAM,IAAI,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C,OAAO,EAAE,QAAQ,CAAC,KAAM,CAAC;qCAC9C;iCACF,CAAC,CAAC;6BACJ;wBACH,CAAC,CAAC,CAAC;qBACJ;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;KACJ;AACH,CAAC;AAAA,CAAC"}
@@ -1,5 +1,6 @@
1
+ import { Program } from "@typespec/compiler";
1
2
  /**
2
3
  * @search applies to get operations that return collections.
3
4
  */
4
- export declare const searchAppliesToGetOperationsThatReturnCollectionsRule: import("@typespec/lint").LintRule;
5
+ export declare function validateSearchAppliesToGetOperationsThatReturnCollections(program: Program): void;
5
6
  //# sourceMappingURL=search.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/rules/search.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,eAAO,MAAM,qDAAqD,mCA6BhE,CAAC"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/rules/search.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAA4B,MAAM,oBAAoB,CAAC;AAGvE;;GAEG;AACH,wBAAgB,yDAAyD,CAAC,OAAO,EAAE,OAAO,QA4BzF"}
@@ -1,15 +1,15 @@
1
- import { createRule } from "@typespec/lint";
2
1
  import { getOperationVerb } from "@typespec/http";
3
2
  import { isSearch } from "../index.js";
4
3
  import { isTypeCollection } from "../utils.js";
5
4
  import { reportDiagnostic } from "../lib.js";
5
+ import { navigateTypesInNamespace } from "@typespec/compiler";
6
+ import { GetDeclaredNamespaces } from "../entities/namespace.js";
6
7
  /**
7
8
  * @search applies to get operations that return collections.
8
9
  */
9
- export const searchAppliesToGetOperationsThatReturnCollectionsRule = createRule({
10
- name: "search-applies-to-get-operations-that-return-collections",
11
- create({ program }) {
12
- return {
10
+ export function validateSearchAppliesToGetOperationsThatReturnCollections(program) {
11
+ for (const namespace of GetDeclaredNamespaces(program)) {
12
+ navigateTypesInNamespace(namespace, {
13
13
  operation: (operation) => {
14
14
  if (!isSearch(program, operation)) {
15
15
  return;
@@ -31,7 +31,8 @@ export const searchAppliesToGetOperationsThatReturnCollectionsRule = createRule(
31
31
  },
32
32
  });
33
33
  },
34
- };
35
- },
36
- });
34
+ });
35
+ }
36
+ }
37
+ ;
37
38
  //# sourceMappingURL=search.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"search.js","sourceRoot":"","sources":["../../../src/rules/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,qDAAqD,GAAG,UAAU,CAAC;IAC9E,IAAI,EAAE,0DAA0D;IAChE,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;gBACvB,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE;oBACjC,OAAO;iBACR;gBAED,IAAI,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,KAAK,KAAK,EAAE;oBAClD,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC;oBACxC,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;oBAC3D,IAAI,YAAY,EAAE;wBAChB,OAAO;qBACR;iBACF;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,SAAS;oBACjB,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE;wBACN,SAAS,EAAE,SAAS;wBACpB,MAAM,EAAE,yCAAyC;qBAClD;iBACF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 +1,6 @@
1
+ import { Program } from "@typespec/compiler";
1
2
  /**
2
3
  * @skip applies to get operations that return collections.
3
4
  */
4
- export declare const skipAppliesToGetOperationsThatReturnCollectionsRule: import("@typespec/lint").LintRule;
5
+ export declare function validateSkipAppliesToGetOperationsThatReturnCollections(program: Program): void;
5
6
  //# sourceMappingURL=skip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"skip.d.ts","sourceRoot":"","sources":["../../../src/rules/skip.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,eAAO,MAAM,mDAAmD,mCA6B9D,CAAC"}
1
+ {"version":3,"file":"skip.d.ts","sourceRoot":"","sources":["../../../src/rules/skip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA4B,MAAM,oBAAoB,CAAC;AAOvE;;GAEG;AACH,wBAAgB,uDAAuD,CAAC,OAAO,EAAE,OAAO,QA4BvF"}
@@ -1,15 +1,15 @@
1
- import { createRule } from "@typespec/lint";
1
+ import { navigateTypesInNamespace } from "@typespec/compiler";
2
2
  import { getOperationVerb } from "@typespec/http";
3
3
  import { isSkip } from "../index.js";
4
4
  import { isTypeCollection } from "../utils.js";
5
5
  import { reportDiagnostic } from "../lib.js";
6
+ import { GetDeclaredNamespaces } from "../entities/namespace.js";
6
7
  /**
7
8
  * @skip applies to get operations that return collections.
8
9
  */
9
- export const skipAppliesToGetOperationsThatReturnCollectionsRule = createRule({
10
- name: "skip-applies-to-get-operations-that-return-collections",
11
- create({ program }) {
12
- return {
10
+ export function validateSkipAppliesToGetOperationsThatReturnCollections(program) {
11
+ for (const namespace of GetDeclaredNamespaces(program)) {
12
+ navigateTypesInNamespace(namespace, {
13
13
  operation: (operation) => {
14
14
  if (!isSkip(program, operation)) {
15
15
  return;
@@ -31,7 +31,8 @@ export const skipAppliesToGetOperationsThatReturnCollectionsRule = createRule({
31
31
  },
32
32
  });
33
33
  },
34
- };
35
- },
36
- });
34
+ });
35
+ }
36
+ }
37
+ ;
37
38
  //# sourceMappingURL=skip.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"skip.js","sourceRoot":"","sources":["../../../src/rules/skip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,mDAAmD,GAAG,UAAU,CAAC;IAC5E,IAAI,EAAE,wDAAwD;IAC9D,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;gBACvB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE;oBAC/B,OAAO;iBACR;gBAED,IAAI,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,KAAK,KAAK,EAAE;oBAClD,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC;oBACxC,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;oBAC3D,IAAI,YAAY,EAAE;wBAChB,OAAO;qBACR;iBACF;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,SAAS;oBACjB,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE;wBACN,SAAS,EAAE,OAAO;wBAClB,MAAM,EAAE,yCAAyC;qBAClD;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"skip.js","sourceRoot":"","sources":["../../../src/rules/skip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE;;GAEG;AACH,MAAM,UAAU,uDAAuD,CAAC,OAAgB;IACtF,KAAK,MAAM,SAAS,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAE;QACtD,wBAAwB,CAAC,SAAS,EAAE;YAClC,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;gBACvB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE;oBAC/B,OAAO;iBACR;gBAED,IAAI,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,KAAK,KAAK,EAAE;oBAClD,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC;oBACxC,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;oBAC3D,IAAI,YAAY,EAAE;wBAChB,OAAO;qBACR;iBACF;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,SAAS;oBACjB,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE;wBACN,SAAS,EAAE,OAAO;wBAClB,MAAM,EAAE,yCAAyC;qBAClD;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;KACJ;AACH,CAAC;AAAA,CAAC"}
@@ -1,5 +1,6 @@
1
+ import { Program } from "@typespec/compiler";
1
2
  /**
2
3
  * @top applies to get operations that return collections.
3
4
  */
4
- export declare const topAppliesToGetOperationsThatReturnCollectionsRule: import("@typespec/lint").LintRule;
5
+ export declare function validateTopAppliesToGetOperationsThatReturnCollections(program: Program): void;
5
6
  //# sourceMappingURL=top.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"top.d.ts","sourceRoot":"","sources":["../../../src/rules/top.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,eAAO,MAAM,kDAAkD,mCA6B7D,CAAC"}
1
+ {"version":3,"file":"top.d.ts","sourceRoot":"","sources":["../../../src/rules/top.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA4B,MAAM,oBAAoB,CAAC;AAOvE;;GAEG;AACH,wBAAgB,sDAAsD,CAAC,OAAO,EAAE,OAAO,QA4BtF"}
@@ -1,15 +1,15 @@
1
- import { createRule } from "@typespec/lint";
1
+ import { navigateTypesInNamespace } from "@typespec/compiler";
2
2
  import { getOperationVerb } from "@typespec/http";
3
3
  import { isTop } from "../index.js";
4
4
  import { isTypeCollection } from "../utils.js";
5
5
  import { reportDiagnostic } from "../lib.js";
6
+ import { GetDeclaredNamespaces } from "../entities/namespace.js";
6
7
  /**
7
8
  * @top applies to get operations that return collections.
8
9
  */
9
- export const topAppliesToGetOperationsThatReturnCollectionsRule = createRule({
10
- name: "top-applies-to-get-operations-that-return-collections",
11
- create({ program }) {
12
- return {
10
+ export function validateTopAppliesToGetOperationsThatReturnCollections(program) {
11
+ for (const namespace of GetDeclaredNamespaces(program)) {
12
+ navigateTypesInNamespace(namespace, {
13
13
  operation: (operation) => {
14
14
  if (!isTop(program, operation)) {
15
15
  return;
@@ -31,7 +31,8 @@ export const topAppliesToGetOperationsThatReturnCollectionsRule = createRule({
31
31
  },
32
32
  });
33
33
  },
34
- };
35
- },
36
- });
34
+ });
35
+ }
36
+ }
37
+ ;
37
38
  //# sourceMappingURL=top.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"top.js","sourceRoot":"","sources":["../../../src/rules/top.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AA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AC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE;;GAEG;AACH,MAAM,UAAU,sDAAsD,CAAC,OAAgB;IACrF,KAAK,MAAM,SAAS,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAE;QACtD,wBAAwB,CAAC,SAAS,EAAE;YAClC,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;gBACvB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE;oBAC9B,OAAO;iBACR;gBAED,IAAI,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,KAAK,KAAK,EAAE;oBAClD,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC;oBACxC,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;oBAC3D,IAAI,YAAY,EAAE;wBAChB,OAAO;qBACR;iBACF;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,SAAS;oBACjB,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE;wBACN,SAAS,EAAE,MAAM;wBACjB,MAAM,EAAE,yCAAyC;qBAClD;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;KACJ;AACH,CAAC;AAAA,CAAC"}
@@ -1,3 +1,4 @@
1
1
  import { TypeSpecTestLibrary } from "@typespec/compiler/testing";
2
2
  export declare const MsGraphTestLibrary: TypeSpecTestLibrary;
3
+ export declare const ReferenceModelTestLibrary: TypeSpecTestLibrary;
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testing/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGjE,eAAO,MAAM,kBAAkB,EAAE,mBAoBhC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testing/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGjE,eAAO,MAAM,kBAAkB,EAAE,mBAoBhC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,mBAoBvC,CAAA"}
@@ -21,4 +21,25 @@ export const MsGraphTestLibrary = {
21
21
  },
22
22
  ],
23
23
  };
24
+ export const ReferenceModelTestLibrary = {
25
+ name: "@microsoft/typespec-msgraph-reference-prod-beta",
26
+ packageRoot: resolvePath(fileURLToPath(import.meta.url), "../../../../../typespec-msgraph-reference-prod-beta/"),
27
+ files: [
28
+ {
29
+ realDir: "",
30
+ pattern: "package.json",
31
+ virtualPath: "./node_modules/@microsoft/typespec-msgraph-reference-prod-beta",
32
+ },
33
+ {
34
+ realDir: "dist/",
35
+ pattern: "*.js",
36
+ virtualPath: "./node_modules/@microsoft/typespec-msgraph-reference-prod-beta/dist/",
37
+ },
38
+ {
39
+ realDir: "lib",
40
+ pattern: "*.tsp",
41
+ virtualPath: "./node_modules/@microsoft/typespec-msgraph-reference-prod-beta/lib",
42
+ },
43
+ ],
44
+ };
24
45
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,CAAC,MAAM,kBAAkB,GAAwB;IACrD,IAAI,EAAE,6BAA6B;IACnC,WAAW,EAAE,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,cAAc,CAAC;IACxE,KAAK,EAAE;QACL;YACE,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,cAAc;YACvB,WAAW,EAAE,4CAA4C;SAC1D;QACD;YACE,OAAO,EAAE,UAAU;YACnB,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,qDAAqD;SACnE;QACD;YACE,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,gDAAgD;SAC9D;KACF;CACF,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,CAAC,MAAM,kBAAkB,GAAwB;IACrD,IAAI,EAAE,6BAA6B;IACnC,WAAW,EAAE,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,cAAc,CAAC;IACxE,KAAK,EAAE;QACL;YACE,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,cAAc;YACvB,WAAW,EAAE,4CAA4C;SAC1D;QACD;YACE,OAAO,EAAE,UAAU;YACnB,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,qDAAqD;SACnE;QACD;YACE,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,gDAAgD;SAC9D;KACF;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAwB;IAC5D,IAAI,EAAE,iDAAiD;IACvD,WAAW,EAAE,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,sDAAsD,CAAC;IAChH,KAAK,EAAE;QACL;YACE,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,cAAc;YACvB,WAAW,EAAE,gEAAgE;SAC9E;QACD;YACE,OAAO,EAAE,OAAO;YAChB,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,sEAAsE;SACpF;QACD;YACE,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,oEAAoE;SAClF;KACF;CACF,CAAA"}
@@ -14,7 +14,9 @@ export declare function getCSDLPrimitiveType(typespecType: string): string;
14
14
  export declare function getIdForType(program: Program, type: Type): string;
15
15
  export declare function getNavigationTypeId(program: Program, getOperation: Operation): string;
16
16
  export declare function getInterfacesOfKinds(program: Program, navigationSources: Map<string, Interface>, kinds: string[]): Map<string, MsGraphInterface>;
17
+ export declare function getTwoSegmentResourceInterface(program: Program, navigationSources: Map<string, Interface>): Map<string, MsGraphInterface>;
17
18
  export declare function getPropertyTypeName(program: Program, type: Type): string;
19
+ export declare function removeReferencePrefixFromType(typeName: string): string;
18
20
  export declare function isTypeNullable(program: Program, type: Type): boolean;
19
21
  export declare function extractTypesFromUnion(type: Union): Type[];
20
22
  export declare function getSingletonTypeId(program: Program, singletonType: string | null, getOperation: Operation | undefined): string | undefined;
@@ -46,4 +48,6 @@ export declare function isNavigationSource(theInterface: Interface): boolean;
46
48
  export declare function isTopLevelNavigationSource(program: Program, theInterface: MsGraphInterface): boolean;
47
49
  export declare function getInterfaceNavigationSourceType(program: Program, theInterface: Interface): Model | undefined;
48
50
  export declare function getNavigationSourceType(program: Program, operation: Operation): Model | undefined;
51
+ export declare function isSameNamespace(program: Program, model: Model, baseModel?: Model): boolean;
52
+ export declare function isTypeDefinedInExternalLibrary(program: Program, type: Type): boolean;
49
53
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAEJ,SAAS,EAET,KAAK,EACL,aAAa,EACb,SAAS,EACT,SAAS,EACT,OAAO,EACP,MAAM,EACN,IAAI,EACJ,KAAK,EACN,MAAM,oBAAoB,CAAC;AAI5B,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,SAAS,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,SAAS,CAAC;IACxB,UAAU,EAAE,gBAAgB,EAAE,CAAC;I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