@microsoft/typespec-msgraph 0.0.1-Preview.8 → 0.0.1-Preview.9

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 (81) hide show
  1. package/dist/src/components/annotations.d.ts +4 -1
  2. package/dist/src/components/annotations.d.ts.map +1 -1
  3. package/dist/src/components/annotations.js +18 -1
  4. package/dist/src/components/annotations.js.map +1 -1
  5. package/dist/src/components/index.js +3 -3
  6. package/dist/src/components/index.js.map +1 -1
  7. package/dist/src/components/schema-element.d.ts.map +1 -1
  8. package/dist/src/components/schema-element.js +3 -2
  9. package/dist/src/components/schema-element.js.map +1 -1
  10. package/dist/src/decorators/allowed-values.d.ts +13 -0
  11. package/dist/src/decorators/allowed-values.d.ts.map +1 -0
  12. package/dist/src/decorators/allowed-values.js +35 -0
  13. package/dist/src/decorators/allowed-values.js.map +1 -0
  14. package/dist/src/decorators/filter.d.ts +1 -1
  15. package/dist/src/decorators/filter.d.ts.map +1 -1
  16. package/dist/src/decorators/filter.js +4 -4
  17. package/dist/src/decorators/filter.js.map +1 -1
  18. package/dist/src/decorators/graph-route.d.ts +8 -1
  19. package/dist/src/decorators/graph-route.d.ts.map +1 -1
  20. package/dist/src/decorators/graph-route.js +18 -9
  21. package/dist/src/decorators/graph-route.js.map +1 -1
  22. package/dist/src/decorators/index.d.ts +2 -0
  23. package/dist/src/decorators/index.d.ts.map +1 -1
  24. package/dist/src/decorators/index.js +2 -0
  25. package/dist/src/decorators/index.js.map +1 -1
  26. package/dist/src/decorators/public-namespace.d.ts +10 -0
  27. package/dist/src/decorators/public-namespace.d.ts.map +1 -0
  28. package/dist/src/decorators/public-namespace.js +16 -0
  29. package/dist/src/decorators/public-namespace.js.map +1 -0
  30. package/dist/src/emitter.d.ts +2 -1
  31. package/dist/src/emitter.d.ts.map +1 -1
  32. package/dist/src/emitter.js +3 -1
  33. package/dist/src/emitter.js.map +1 -1
  34. package/dist/src/entities/annotations.d.ts +6 -0
  35. package/dist/src/entities/annotations.d.ts.map +1 -1
  36. package/dist/src/entities/annotations.js +19 -0
  37. package/dist/src/entities/annotations.js.map +1 -1
  38. package/dist/src/entities/model.d.ts +5 -0
  39. package/dist/src/entities/model.d.ts.map +1 -1
  40. package/dist/src/entities/model.js +3 -2
  41. package/dist/src/entities/model.js.map +1 -1
  42. package/dist/src/entities/namespace.d.ts +3 -1
  43. package/dist/src/entities/namespace.d.ts.map +1 -1
  44. package/dist/src/entities/namespace.js +11 -15
  45. package/dist/src/entities/namespace.js.map +1 -1
  46. package/dist/src/entities/operation.js +1 -1
  47. package/dist/src/entities/operation.js.map +1 -1
  48. package/dist/src/lib.d.ts +33 -2
  49. package/dist/src/lib.d.ts.map +1 -1
  50. package/dist/src/lib.js +20 -1
  51. package/dist/src/lib.js.map +1 -1
  52. package/dist/src/linter.d.ts.map +1 -1
  53. package/dist/src/linter.js +4 -0
  54. package/dist/src/linter.js.map +1 -1
  55. package/dist/src/rules/allowed-values.d.ts +6 -0
  56. package/dist/src/rules/allowed-values.d.ts.map +1 -0
  57. package/dist/src/rules/allowed-values.js +59 -0
  58. package/dist/src/rules/allowed-values.js.map +1 -0
  59. package/dist/src/rules/graph-route.d.ts +1 -0
  60. package/dist/src/rules/graph-route.d.ts.map +1 -1
  61. package/dist/src/rules/graph-route.js +61 -12
  62. package/dist/src/rules/graph-route.js.map +1 -1
  63. package/dist/src/rules/index.d.ts +3 -0
  64. package/dist/src/rules/index.d.ts.map +1 -1
  65. package/dist/src/rules/index.js +3 -0
  66. package/dist/src/rules/index.js.map +1 -1
  67. package/dist/src/rules/namespace.d.ts +3 -0
  68. package/dist/src/rules/namespace.d.ts.map +1 -0
  69. package/dist/src/rules/namespace.js +58 -0
  70. package/dist/src/rules/namespace.js.map +1 -0
  71. package/dist/src/utils.d.ts +1 -11
  72. package/dist/src/utils.d.ts.map +1 -1
  73. package/dist/src/utils.js +49 -29
  74. package/dist/src/utils.js.map +1 -1
  75. package/lib/decorators.tsp +79 -65
  76. package/lib/deployment.tsp +1 -1
  77. package/lib/lib.tsp +1 -1
  78. package/lib/porcelain.tsp +4 -4
  79. package/lib/responses.tsp +6 -6
  80. package/lib/shared-models.tsp +4 -3
  81. package/package.json +11 -11
@@ -11,7 +11,9 @@ export * from "./expand.js";
11
11
  export * from "./extends-on-same-type.js";
12
12
  export * from "./filter.js";
13
13
  export * from "./function.js";
14
+ export * from "./graph-route.js";
14
15
  export * from "./has-stream.js";
16
+ export * from "./namespace.js";
15
17
  export * from "./open.js";
16
18
  export * from "./operation-inside-interface.js";
17
19
  export * from "./order-by.js";
@@ -20,5 +22,6 @@ export * from "./required-for-create.js";
20
22
  export * from "./search.js";
21
23
  export * from "./skip.js";
22
24
  export * from "./top.js";
25
+ export * from "./allowed-values.js";
23
26
  export * from "./graph-route.js";
24
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rules/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oDAAoD,CAAC;AACnE,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,qCAAqC,CAAC;AACpD,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,iCAAiC,CAAC;AAChD,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rules/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oDAAoD,CAAC;AACnE,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,qCAAqC,CAAC;AACpD,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,iCAAiC,CAAC;AAChD,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const namespaceIsRequiredRule: import("@typespec/lint").LintRule;
2
+ export declare const invalidPublicNamespaceNameRule: import("@typespec/lint").LintRule;
3
+ //# sourceMappingURL=namespace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../../../src/rules/namespace.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,uBAAuB,mCA2BlC,CAAC;AAEH,eAAO,MAAM,8BAA8B,mCA6BzC,CAAC"}
@@ -0,0 +1,58 @@
1
+ import { createRule } from "@typespec/lint";
2
+ import { reportDiagnostic } from "../lib.js";
3
+ import { getPublicNamespaceName, hasPublicNamespace } from "../index.js";
4
+ import { getNamespaceFullName } from "@typespec/compiler";
5
+ export const namespaceIsRequiredRule = createRule({
6
+ name: "namespace-is-required",
7
+ create({ program }) {
8
+ return {
9
+ model: (model) => {
10
+ if (model.namespace && model.namespace.name) {
11
+ return;
12
+ }
13
+ while (model.baseModel) {
14
+ model = model.baseModel;
15
+ if (model.namespace && model.namespace.name) {
16
+ return;
17
+ }
18
+ }
19
+ reportDiagnostic(program, {
20
+ code: "element-missing-dependencies",
21
+ target: model,
22
+ messageId: "modelMissingNamespace",
23
+ format: {
24
+ model: model.name,
25
+ },
26
+ });
27
+ },
28
+ };
29
+ },
30
+ });
31
+ export const invalidPublicNamespaceNameRule = createRule({
32
+ name: "invalid-public-namespace-name",
33
+ create({ program }) {
34
+ return {
35
+ namespace: (namespace) => {
36
+ if (!hasPublicNamespace(program, namespace)) {
37
+ return;
38
+ }
39
+ // publicNamespace name should either be "microsoft.graph"
40
+ // or match the pattern "microsoft.graph.<string_token>"
41
+ const namespaceRegex = /microsoft\.graph\.[\w]+/;
42
+ const publicNamespaceName = getPublicNamespaceName(program, namespace);
43
+ if (publicNamespaceName === "microsoft.graph" || namespaceRegex.test(publicNamespaceName)) {
44
+ return;
45
+ }
46
+ reportDiagnostic(program, {
47
+ code: "decorator-invalid-use",
48
+ target: namespace,
49
+ messageId: "invalidPublicNamespaceName",
50
+ format: {
51
+ namespace: getNamespaceFullName(namespace),
52
+ },
53
+ });
54
+ },
55
+ };
56
+ },
57
+ });
58
+ //# sourceMappingURL=namespace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"namespace.js","sourceRoot":"","sources":["../../../src/rules/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAAC;IAChD,IA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A4B;oBACvC,MAAM,EAAE;wBACN,SAAS,EAAE,oBAAoB,CAAC,SAAS,CAAC;qBAC3C;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -6,6 +6,7 @@ export interface MsGraphInterface {
6
6
  }
7
7
  export declare function getNameForType(program: Program, type: Type): string;
8
8
  export declare function getNameForModelType(program: Program, type: Model | Scalar): string;
9
+ export declare function getCSDLPrimitiveType(typespecType: string): string;
9
10
  export declare function getIdForType(program: Program, type: Type): string;
10
11
  export declare function getNavigationTypeId(program: Program, getOperation: Operation): string;
11
12
  export declare function getInterfacesOfKinds(program: Program, navigationSources: Map<string, Interface>, kinds: string[]): Map<string, MsGraphInterface>;
@@ -39,17 +40,6 @@ export declare function isExcludedLibraryType(program: Program, type: Model | Sc
39
40
  export declare function isNavigationProperty(program: Program, property: ModelProperty): boolean;
40
41
  export declare function isNavigationSource(theInterface: Interface): boolean;
41
42
  export declare function isTopLevelNavigationSource(program: Program, theInterface: MsGraphInterface): boolean;
42
- /**
43
- * Check if a @graphRoute returns a single resource of a collection.
44
- *
45
- * `Example`
46
- *
47
- * @graphRoute("users/{id}")
48
- * interface UsersById extends Resource<user> {
49
- * get is GraphOps.GetResource;
50
- * }
51
- */
52
- export declare function isCollectionResource(program: Program, theInterface: MsGraphInterface): boolean;
53
43
  export declare function getInterfaceNavigationSourceType(program: Program, theInterface: Interface): Model | undefined;
54
44
  export declare function getNavigationSourceType(program: Program, operation: Operation): Model | undefined;
55
45
  //# 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;AAG5B,MAAM,WAAW,gBAAgB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ACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,IAAI,GAAG,SAAS,GAC1F,MAAM,CAsBR;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,IAAI,GAC9E,OAAO,CAOT;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,IAAI,GAC9E,OAAO,CAIT;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,WAuB7E;AAED,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,SAAS,GAAG,OAAO,CAEnE;AAED,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,gBAAgB,GAC7B,OAAO,CAET;AAID,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,GAAG,KAAK,GAAE,SAAS,CAQ5G;AAGD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,GAAG,KAAK,GAAE,SAAS,CAE/F"}
package/dist/src/utils.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { getNamespaceFullName, isArrayModelType, } from "@typespec/compiler";
2
- import { getEntity, getGraphRoutePath, isEntity } from "./decorators/index.js";
2
+ import { getEntity, getGraphRoutePaths, getPublicNamespaceName, hasPublicNamespace, isEntity } from "./decorators/index.js";
3
3
  export function getNameForType(program, type) {
4
4
  switch (type.kind) {
5
5
  case "Union":
@@ -62,15 +62,55 @@ export function getNameForModelType(program, type) {
62
62
  }
63
63
  return `Collection(${getPropertyTypeName(program, type.indexer.value)})`;
64
64
  }
65
+ export function getCSDLPrimitiveType(typespecType) {
66
+ switch (typespecType) {
67
+ case "string":
68
+ return "String";
69
+ case "int8":
70
+ return "Byte";
71
+ case "int16":
72
+ return "Int16";
73
+ case "int32":
74
+ return "Int32";
75
+ case "int64":
76
+ return "Int64";
77
+ case "integer":
78
+ return "Int64";
79
+ case "float32":
80
+ return "Single";
81
+ case "float64":
82
+ return "Double";
83
+ case "decimal":
84
+ return "Decimal";
85
+ case "guid":
86
+ return "Guid";
87
+ case "plainDate":
88
+ return "Date";
89
+ case "plainTime":
90
+ return "TimeOfDay";
91
+ case "zonedDateTime":
92
+ return "DateTimeOffset";
93
+ case "duration":
94
+ return "Duration";
95
+ case "boolean":
96
+ return "Bool";
97
+ case "stream":
98
+ return "Stream";
99
+ default:
100
+ return typespecType;
101
+ }
102
+ }
65
103
  export function getIdForType(program, type) {
66
104
  switch (type.kind) {
67
105
  case "Namespace":
68
- return getNamespaceFullName(type);
106
+ return hasPublicNamespace(program, type)
107
+ ? getPublicNamespaceName(program, type)
108
+ : getNamespaceFullName(type);
69
109
  case "Model":
70
110
  case "Enum":
71
111
  case "Operation":
72
112
  case "Interface":
73
- return `${getNamespaceFullName(type.namespace)}.${type.name}`;
113
+ return `${getIdForType(program, type.namespace)}.${type.name}`;
74
114
  case "String":
75
115
  case "Number":
76
116
  case "Boolean":
@@ -98,21 +138,14 @@ export function getInterfacesOfKinds(program, navigationSources, kinds) {
98
138
  // if source interfaces DO NOT have the kinds.
99
139
  return;
100
140
  }
101
- const graphRoutePath = getGraphRoutePath(program, theInterface);
102
- let graphRoutes = [];
103
- if (!graphRoutePath) {
141
+ const graphRoutePaths = getGraphRoutePaths(program, theInterface);
142
+ if (!graphRoutePaths) {
104
143
  return;
105
144
  }
106
- else if (Array.isArray(graphRoutePath)) {
107
- graphRoutes = graphRoutePath;
108
- }
109
- else {
110
- graphRoutes = [graphRoutePath];
111
- }
112
- if (!graphRoutes.length) {
145
+ if (!graphRoutePaths.length) {
113
146
  return;
114
147
  }
115
- graphRoutes.forEach((graphRoute) => {
148
+ graphRoutePaths.forEach((graphRoute) => {
116
149
  const path = removeRoutePathParams(graphRoute);
117
150
  if (!path) {
118
151
  return;
@@ -231,12 +264,12 @@ export function isExcludedCoreType(program, type) {
231
264
  // https://github.com/Azure/typespec-azure/issues/801#issuecomment-1194454247
232
265
  //
233
266
  const nsName = getNamespaceName(program, type);
234
- const excludedNamespaces = ["TypeSpec"];
267
+ const excludedNamespaces = ["TypeSpec", "MsGraph"];
235
268
  return excludedNamespaces.find((ns) => nsName.startsWith(ns)) !== undefined;
236
269
  }
237
270
  export function isExcludedLibraryType(program, type) {
238
271
  const nsName = getNamespaceName(program, type);
239
- const excludedNamespaces = ["TypeSpec", "MicrosoftGraph"];
272
+ const excludedNamespaces = ["TypeSpec", "MsGraph"];
240
273
  return excludedNamespaces.find((ns) => nsName.startsWith(ns)) !== undefined;
241
274
  }
242
275
  export function isNavigationProperty(program, property) {
@@ -266,19 +299,6 @@ export function isNavigationSource(theInterface) {
266
299
  export function isTopLevelNavigationSource(program, theInterface) {
267
300
  return removeRoutePathParams(theInterface.path).split("/").length === 1;
268
301
  }
269
- /**
270
- * Check if a @graphRoute returns a single resource of a collection.
271
- *
272
- * `Example`
273
- *
274
- * @graphRoute("users/{id}")
275
- * interface UsersById extends Resource<user> {
276
- * get is GraphOps.GetResource;
277
- * }
278
- */
279
- export function isCollectionResource(program, theInterface) {
280
- return (isTopLevelNavigationSource(program, theInterface) && theInterface.path.split("/").length === 2);
281
- }
282
302
  // Get the type returned by all operations in an interface representing a navigation source.
283
303
  // This is the 'T' in Collection<T> and friends.
284
304
  export function getInterfaceNavigationSourceType(program, theInterface) {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,oBAAoB,EAEpB,g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AC5F,gDAAgD;AAChD,MAAM,UAAU,gCAAgC,CAAC,OAAgB,EAAE,YAAuB;;IACxF,MAAM,SAAS,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC;IACrD,IAAG,SAAS,KAAK,SAAS,EAAE;QAC1B,OAAO,SAAS,CAAC;KAClB;SACI;QACH,OAAc,MAAA,SAAS,CAAC,cAAc,0CAAE,IAAI,CAAC,CAAC,CAAC,CAAC;KACjD;AACH,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,uBAAuB,CAAC,OAAgB,EAAE,SAAoB;IAC5E,OAAO,gCAAgC,CAAC,OAAO,EAAE,SAAS,CAAC,SAAU,CAAC,CAAC;AACxE,CAAC;AAEF,SAAS,oBAAoB,CAAC,YAAuB;IACnD,KAAK,MAAM,aAAa,IAAI,YAAY,CAAC,gBAAgB,EAAE;QACzD,IAAI,aAAa,CAAC,IAAI,KAAK,UAAU,IAAI,aAAa,CAAC,IAAI,KAAK,YAAY,EAAE;YAC5E,OAAO,aAAa,CAAC;SACtB;aACI;YACH,MAAM,QAAQ,GAAG,oBAAoB,CAAC,aAAa,CAAC,CAAC;YACrD,IAAI,QAAQ,KAAK,SAAS,EAAG;gBAC3B,OAAO,QAAQ,CAAC;aACjB;SACF;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;GAMG;AACH,SAAS,qBAAqB,CAAC,SAAiB;IAC9C,OAAO,SAAS,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAC7C,CAAC"}
@@ -14,6 +14,31 @@ extern dec abstract(target: Model);
14
14
  */
15
15
  extern dec action(target: Operation, name?: valueof string);
16
16
 
17
+ /**
18
+ * `@additionalQueryParameters` - Appends a key=value pair to the query string of the mapped internal URL for all models defined within the namespace.
19
+ *
20
+ * `@additionalQueryParameters` can only be applied to namespaces
21
+ */
22
+ extern dec additionalQueryParameters(target: Namespace, name: valueof string, value: valueof string);
23
+
24
+ /**
25
+ * `@agsAttribute` - Allows all AGS CSDL extensions that are not yet modelled explicitly in TypeSpec to be maintained
26
+ *
27
+ * `@agsAttribute` - Applies to models.
28
+ */
29
+ extern dec agsAttribute(
30
+ target: Model | ModelProperty | Enum | EnumMember | Operation | Interface,
31
+ name: valueof string,
32
+ value: valueof string
33
+ );
34
+
35
+ /**
36
+ * `@allowedValues` - mark model property with allowedValues.
37
+ *
38
+ * `@allowedValues` - can only be applied to model properties.
39
+ */
40
+ extern dec allowedValues(target: ModelProperty, ...values: valueof unknown[]);
41
+
17
42
  /**
18
43
  * `@alternateKey` - mark a model property as an alternateKey
19
44
  *
@@ -49,6 +74,13 @@ extern dec contains(target: ModelProperty);
49
74
  */
50
75
  extern dec count(target: Operation);
51
76
 
77
+ /**
78
+ * `@deltaCollection` - mark a model as representing a delta paged collection.
79
+ *
80
+ * `@deltaCollection` can only be applied to models.
81
+ */
82
+ extern dec deltaCollection(target: Model);
83
+
52
84
  /**
53
85
  * `@deprecatedDefinition` - Allow us create a reusable deprecation definition.
54
86
  * `@deprecatedDefinition` - Applies only to namespaces.
@@ -82,10 +114,10 @@ extern dec expand(target: Operation, property: valueof string, ...otherPropertie
82
114
  * `@filter` - Applies to: get operations that return collections of @entity or @complex models.
83
115
  * Indicates that the get operation supports OData $filter query parameter.
84
116
  *
85
- * `properties` - string containing comma separated list of property names in the model returned
117
+ * `properties` - array of property names in the model returned
86
118
  * from the get operation that can be used in $filter query parameter.
87
119
  */
88
- extern dec filter(target: Operation, properties: valueof string);
120
+ extern dec filter(target: Operation, property: valueof string, ...properties: valueof string[]);
89
121
 
90
122
 
91
123
  /**
@@ -102,6 +134,16 @@ extern dec flags(target: Enum);
102
134
  */
103
135
  extern dec function(target: Operation, name?: valueof string);
104
136
 
137
+ /**
138
+ * `@graphRoute` - mark an interface or operation with an HTTP route.
139
+ *
140
+ * `@graphRoute` - can only be applied to interfaces or operations.
141
+ */
142
+ // TODO: Using @graphRoute on an operation currently does not work due to the following TypeSpec core issue
143
+ // https://github.com/microsoft/typespec/issues/2106
144
+ // Disabling all related features while we await the outcome.
145
+ extern dec graphRoute(target: Interface /* | Operation */, path: valueof string);
146
+
105
147
  /**
106
148
  * `@hasStream` - indicates that an `@entity` model has a stream.
107
149
  *
@@ -109,6 +151,13 @@ extern dec function(target: Operation, name?: valueof string);
109
151
  */
110
152
  extern dec hasStream(target: Model, ...mediaTypes: valueof string[]);
111
153
 
154
+ /**
155
+ * `@immutable` - mark a model property as immutable.
156
+ *
157
+ * `@immutable` can only be applied to model properties.
158
+ */
159
+ extern dec immutable(target: ModelProperty);
160
+
112
161
  /**
113
162
  * `@open` - mark a model type as open
114
163
  *
@@ -134,6 +183,13 @@ extern dec operationParameters(target: Model);
134
183
  */
135
184
  extern dec orderBy(target: Operation, property: valueof string, ...otherProperties: valueof string[]);
136
185
 
186
+ /**
187
+ * `@pagedCollection` - mark a model as representing a paged collection.
188
+ *
189
+ * `@pagedCollection` can only be applied to models.
190
+ */
191
+ extern dec pagedCollection(target: Model);
192
+
137
193
  /**
138
194
  * `@privatePreview` - Allow us define a privatePreview element.
139
195
  * `@privatePreview` - Applies to models, model properties, enums, enum members, namespaces and operations.
@@ -152,20 +208,22 @@ extern dec privatePreviewDefinition(
152
208
  name: valueof string,
153
209
  announcementDate: valueof string,
154
210
  removalDate: valueof string,
155
- owner: valueof string
211
+ owner?: valueof string
156
212
  );
157
213
 
158
214
  /**
159
- * `@search` - Applies to: get operations that return collections.
160
- * Indicates that the get operation supports the OData $search query parameter.
215
+ * `@privileged` - mark the entity as privileged
216
+ *
217
+ * `@privileged` can be applied to Model, ModelProperty, Enum, EnumMember, Operation, Namespace.
161
218
  */
162
- extern dec search(target: Operation);
219
+ extern dec privileged(target: Model | ModelProperty | Enum | EnumMember | Operation | Namespace);
163
220
 
164
221
  /**
165
- * `@skip` - Applies to: get operations that return collections.
166
- * Indicates that the get operation supports the OData $skip query parameter.
222
+ * `@publicNamespace` - defines the namespace to be used in generating CSDL output for all elements contained within the namespace
223
+ *
224
+ * `@publicNamespace` can only be applied to namespaces.
167
225
  */
168
- extern dec skip(target: Operation);
226
+ extern dec publicNamespace(target: Namespace, name: valueof string);
169
227
 
170
228
  /**
171
229
  * `@readOnly` - mark a model property as readOnly property
@@ -189,6 +247,18 @@ extern dec references(target: ModelProperty);
189
247
  */
190
248
  extern dec requiredForCreate(target: ModelProperty);
191
249
 
250
+ /**
251
+ * `@search` - Applies to: get operations that return collections.
252
+ * Indicates that the get operation supports the OData $search query parameter.
253
+ */
254
+ extern dec search(target: Operation);
255
+
256
+ /**
257
+ * `@skip` - Applies to: get operations that return collections.
258
+ * Indicates that the get operation supports the OData $skip query parameter.
259
+ */
260
+ extern dec skip(target: Operation);
261
+
192
262
  /**
193
263
  * `@top` - Applies to: get operations that return collections.
194
264
  * Indicates that the get operation supports the OData $top query parameter.
@@ -202,24 +272,6 @@ extern dec top(target: Operation);
202
272
  */
203
273
  extern dec writeOnly(target: ModelProperty);
204
274
 
205
- /**
206
- * `@additionalQueryParameters` - Appends a key=value pair to the query string of the mapped internal URL for all models defined within the namespace.
207
- *
208
- * `@additionalQueryParameters` can only be applied to namespaces
209
- */
210
- extern dec additionalQueryParameters(target: Namespace, name: valueof string, value: valueof string);
211
-
212
- /**
213
- * `@agsAttribute` - Allows all AGS CSDL extensions that are not yet modelled explicitly in TypeSpec to be maintained
214
- *
215
- * `@agsAttribute` - Applies to models.
216
- */
217
- extern dec agsAttribute(
218
- target: Model | ModelProperty | Enum | EnumMember | Operation | Interface,
219
- name: valueof string,
220
- value: valueof string
221
- );
222
-
223
275
  /**
224
276
  * `@isOwner` - specify that this workload is the primary owner of this entity model
225
277
  *
@@ -227,13 +279,6 @@ extern dec agsAttribute(
227
279
  */
228
280
  extern dec isOwner(target: Model | ModelProperty);
229
281
 
230
- /**
231
- * `@privileged` - mark the entity as privileged
232
- *
233
- * `@privileged` can be applied to Model, ModelProperty, Enum, EnumMember, Operation, Namespace.
234
- */
235
- extern dec privileged(target: Model | ModelProperty | Enum | EnumMember | Operation | Namespace);
236
-
237
282
  /**
238
283
  * `@workloadName` - specifies the name used by the underlying workload
239
284
  *
@@ -253,34 +298,3 @@ extern dec workloadNameMsa(
253
298
  target: Model | ModelProperty | Enum | EnumMember,
254
299
  workloadNameMsa: valueof string
255
300
  );
256
-
257
- /**
258
- * `@pagedCollection` - mark a model as representing a paged collection.
259
- *
260
- * `@pagedCollection` can only be applied to models.
261
- */
262
- extern dec pagedCollection(target: Model);
263
-
264
- /**
265
- * `@deltaCollection` - mark a model as representing a delta paged collection.
266
- *
267
- * `@deltaCollection` can only be applied to models.
268
- */
269
- extern dec deltaCollection(target: Model);
270
-
271
- /**
272
- * `@graphRoute` - mark an interface or operation with an HTTP route.
273
- *
274
- * `@graphRoute` - can only be applied to interfaces or operations.
275
- */
276
- // TODO: Using @graphRoute on an operation currently does not work due to the following TypeSpec core issue
277
- // https://github.com/microsoft/typespec/issues/2106
278
- // Disabling all related features while we await the outcome.
279
- extern dec graphRoute(target: Interface /* | Operation */, path: valueof string);
280
-
281
- /**
282
- * `@immutable` - mark a model property as immutable.
283
- *
284
- * `@immutable` can only be applied to model properties.
285
- */
286
- extern dec immutable(target: ModelProperty);
@@ -1,4 +1,4 @@
1
- namespace TypeSpec.MsGraph.Deployment;
1
+ namespace MsGraph.Deployment;
2
2
 
3
3
  enum deploymentTargets {
4
4
  prodBeta,
package/lib/lib.tsp CHANGED
@@ -2,7 +2,7 @@ import "../dist/src/index.js";
2
2
  import "@typespec/http";
3
3
 
4
4
  using TypeSpec.Http;
5
- namespace TypeSpec.MsGraph;
5
+ namespace MsGraph;
6
6
 
7
7
  scalar date;
8
8
 
package/lib/porcelain.tsp CHANGED
@@ -8,11 +8,11 @@ import "./shared-models.tsp";
8
8
  import "./responses.tsp";
9
9
 
10
10
  using TypeSpec.Http;
11
- using TypeSpec.MsGraph;
12
- using TypeSpec.MsGraph.SharedModels;
13
- using TypeSpec.MsGraph.Responses;
11
+ using MsGraph;
12
+ using MsGraph.SharedModels;
13
+ using MsGraph.Responses;
14
14
 
15
- namespace TypeSpec.MsGraph;
15
+ namespace MsGraph;
16
16
 
17
17
  namespace Foundations {
18
18
 
package/lib/responses.tsp CHANGED
@@ -7,14 +7,14 @@ import "@microsoft/typespec-msgraph";
7
7
  import "./shared-models.tsp";
8
8
 
9
9
  using TypeSpec.Http;
10
- using TypeSpec.MsGraph;
11
- using TypeSpec.MsGraph.SharedModels;
10
+ using MsGraph;
11
+ using MsGraph.SharedModels;
12
12
 
13
13
  // Raw body models represent the content of the response body, without any additional metadata.
14
14
  // Note that these are primarily marker types. CSDL has no notion of what actual body content is returned in such types,
15
15
  // but by passing markers through, HIDI can translate to OpenAPI.
16
16
  // The content of the types exists for other future emitters that run directly off TypeSpec.
17
- namespace TypeSpec.MsGraph.Responses.Bodies {
17
+ namespace MsGraph.Responses.Bodies {
18
18
 
19
19
  @error
20
20
  model ErrorBody {
@@ -32,18 +32,18 @@ namespace TypeSpec.MsGraph.Responses.Bodies {
32
32
 
33
33
  @pagedCollection
34
34
  model PagedCollectionBody<TResource> is CollectionBody<TResource> {
35
- `@odata.nextLink`?: url;
35
+ `@odata.nextLink`?: MsGraph.SharedModels.url;
36
36
  }
37
37
 
38
38
  @pagedCollection
39
39
  @deltaCollection
40
40
  model DeltaCollectionBody<TResource> is PagedCollectionBody<TResource> {
41
- `@odata.deltaLink`?: url;
41
+ `@odata.deltaLink`?: MsGraph.SharedModels.url;
42
42
  }
43
43
  }
44
44
 
45
45
  // Response models represent the response as a whole, including the status code, headers, and body.
46
- namespace TypeSpec.MsGraph.Responses {
46
+ namespace MsGraph.Responses {
47
47
  @doc("Response to represent a Microsoft Graph collection response payload.")
48
48
  model CollectionResponse<TResource, TStatus = 200, TBody = Bodies.CollectionBody<TResource>>
49
49
  is Http.Response<TStatus> {
@@ -4,14 +4,15 @@
4
4
  // -------------------------------------------------
5
5
  import "@microsoft/typespec-msgraph";
6
6
 
7
- using TypeSpec.MsGraph;
7
+ using MsGraph;
8
8
 
9
- namespace TypeSpec.MsGraph.SharedModels;
9
+ @publicNamespace("microsoft.graph")
10
+ namespace MsGraph.SharedModels;
10
11
 
11
12
  // TODO: Spec how to deal with specified and unspecified ultimate base entities w.r.t. AGS runtime replacement policies. See #140
12
13
  @doc("The primary entity base model for Microsoft Graph.")
13
14
  @entity
14
- model msGraphEntity {
15
+ model entity {
15
16
  @key id: string;
16
17
  }
17
18