@microsoft/typespec-msgraph 0.0.1-Preview.7 → 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 (120) 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 +22 -4
  4. package/dist/src/components/annotations.js.map +1 -1
  5. package/dist/src/components/filter-restrictions-annotation.d.ts +6 -0
  6. package/dist/src/components/filter-restrictions-annotation.d.ts.map +1 -0
  7. package/dist/src/components/filter-restrictions-annotation.js +10 -0
  8. package/dist/src/components/filter-restrictions-annotation.js.map +1 -0
  9. package/dist/src/components/immutable-annotation.d.ts +5 -0
  10. package/dist/src/components/immutable-annotation.d.ts.map +1 -0
  11. package/dist/src/components/immutable-annotation.js +6 -0
  12. package/dist/src/components/immutable-annotation.js.map +1 -0
  13. package/dist/src/components/index.js +3 -3
  14. package/dist/src/components/index.js.map +1 -1
  15. package/dist/src/components/insert-restrictions-annotation.d.ts +6 -0
  16. package/dist/src/components/insert-restrictions-annotation.d.ts.map +1 -0
  17. package/dist/src/components/insert-restrictions-annotation.js +10 -0
  18. package/dist/src/components/insert-restrictions-annotation.js.map +1 -0
  19. package/dist/src/components/property-element.d.ts.map +1 -1
  20. package/dist/src/components/property-element.js +3 -1
  21. package/dist/src/components/property-element.js.map +1 -1
  22. package/dist/src/components/schema-element.d.ts.map +1 -1
  23. package/dist/src/components/schema-element.js +6 -7
  24. package/dist/src/components/schema-element.js.map +1 -1
  25. package/dist/src/decorators/action.d.ts +10 -0
  26. package/dist/src/decorators/action.d.ts.map +1 -0
  27. package/dist/src/decorators/action.js +16 -0
  28. package/dist/src/decorators/action.js.map +1 -0
  29. package/dist/src/decorators/allowed-values.d.ts +13 -0
  30. package/dist/src/decorators/allowed-values.d.ts.map +1 -0
  31. package/dist/src/decorators/allowed-values.js +35 -0
  32. package/dist/src/decorators/allowed-values.js.map +1 -0
  33. package/dist/src/decorators/filter.d.ts +11 -0
  34. package/dist/src/decorators/filter.d.ts.map +1 -0
  35. package/dist/src/decorators/filter.js +27 -0
  36. package/dist/src/decorators/filter.js.map +1 -0
  37. package/dist/src/decorators/graph-route.d.ts +8 -1
  38. package/dist/src/decorators/graph-route.d.ts.map +1 -1
  39. package/dist/src/decorators/graph-route.js +27 -13
  40. package/dist/src/decorators/graph-route.js.map +1 -1
  41. package/dist/src/decorators/immutable.d.ts +8 -0
  42. package/dist/src/decorators/immutable.d.ts.map +1 -0
  43. package/dist/src/decorators/immutable.js +12 -0
  44. package/dist/src/decorators/immutable.js.map +1 -0
  45. package/dist/src/decorators/index.d.ts +6 -0
  46. package/dist/src/decorators/index.d.ts.map +1 -1
  47. package/dist/src/decorators/index.js +6 -0
  48. package/dist/src/decorators/index.js.map +1 -1
  49. package/dist/src/decorators/public-namespace.d.ts +10 -0
  50. package/dist/src/decorators/public-namespace.d.ts.map +1 -0
  51. package/dist/src/decorators/public-namespace.js +16 -0
  52. package/dist/src/decorators/public-namespace.js.map +1 -0
  53. package/dist/src/decorators/required-for-create.d.ts +10 -0
  54. package/dist/src/decorators/required-for-create.d.ts.map +1 -0
  55. package/dist/src/decorators/required-for-create.js +14 -0
  56. package/dist/src/decorators/required-for-create.js.map +1 -0
  57. package/dist/src/emitter.d.ts +2 -1
  58. package/dist/src/emitter.d.ts.map +1 -1
  59. package/dist/src/emitter.js +3 -1
  60. package/dist/src/emitter.js.map +1 -1
  61. package/dist/src/entities/annotations.d.ts +9 -0
  62. package/dist/src/entities/annotations.d.ts.map +1 -1
  63. package/dist/src/entities/annotations.js +42 -1
  64. package/dist/src/entities/annotations.js.map +1 -1
  65. package/dist/src/entities/model.d.ts +6 -0
  66. package/dist/src/entities/model.d.ts.map +1 -1
  67. package/dist/src/entities/model.js +4 -2
  68. package/dist/src/entities/model.js.map +1 -1
  69. package/dist/src/entities/namespace.d.ts +3 -3
  70. package/dist/src/entities/namespace.d.ts.map +1 -1
  71. package/dist/src/entities/namespace.js +26 -10
  72. package/dist/src/entities/namespace.js.map +1 -1
  73. package/dist/src/entities/operation.d.ts.map +1 -1
  74. package/dist/src/entities/operation.js +2 -3
  75. package/dist/src/entities/operation.js.map +1 -1
  76. package/dist/src/entities/property.d.ts.map +1 -1
  77. package/dist/src/entities/property.js +3 -0
  78. package/dist/src/entities/property.js.map +1 -1
  79. package/dist/src/lib.d.ts +45 -2
  80. package/dist/src/lib.d.ts.map +1 -1
  81. package/dist/src/lib.js +23 -1
  82. package/dist/src/lib.js.map +1 -1
  83. package/dist/src/linter.d.ts.map +1 -1
  84. package/dist/src/linter.js +8 -0
  85. package/dist/src/linter.js.map +1 -1
  86. package/dist/src/rules/allowed-values.d.ts +6 -0
  87. package/dist/src/rules/allowed-values.d.ts.map +1 -0
  88. package/dist/src/rules/allowed-values.js +59 -0
  89. package/dist/src/rules/allowed-values.js.map +1 -0
  90. package/dist/src/rules/filter.d.ts +4 -0
  91. package/dist/src/rules/filter.d.ts.map +1 -0
  92. package/dist/src/rules/filter.js +92 -0
  93. package/dist/src/rules/filter.js.map +1 -0
  94. package/dist/src/rules/graph-route.d.ts +6 -0
  95. package/dist/src/rules/graph-route.d.ts.map +1 -0
  96. package/dist/src/rules/graph-route.js +88 -0
  97. package/dist/src/rules/graph-route.js.map +1 -0
  98. package/dist/src/rules/index.d.ts +6 -0
  99. package/dist/src/rules/index.d.ts.map +1 -1
  100. package/dist/src/rules/index.js +6 -0
  101. package/dist/src/rules/index.js.map +1 -1
  102. package/dist/src/rules/namespace.d.ts +3 -0
  103. package/dist/src/rules/namespace.d.ts.map +1 -0
  104. package/dist/src/rules/namespace.js +58 -0
  105. package/dist/src/rules/namespace.js.map +1 -0
  106. package/dist/src/rules/required-for-create.d.ts +2 -0
  107. package/dist/src/rules/required-for-create.d.ts.map +1 -0
  108. package/dist/src/rules/required-for-create.js +40 -0
  109. package/dist/src/rules/required-for-create.js.map +1 -0
  110. package/dist/src/utils.d.ts +3 -0
  111. package/dist/src/utils.d.ts.map +1 -1
  112. package/dist/src/utils.js +73 -21
  113. package/dist/src/utils.js.map +1 -1
  114. package/lib/decorators.tsp +102 -56
  115. package/lib/deployment.tsp +1 -1
  116. package/lib/lib.tsp +5 -16
  117. package/lib/porcelain.tsp +4 -4
  118. package/lib/responses.tsp +6 -6
  119. package/lib/shared-models.tsp +4 -3
  120. package/package.json +11 -12
@@ -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,IAAI,EAAE,uBAAuB;IAC7B,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;gBACf,IAAI,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE;oBAC3C,OAAO;iBACR;gBAED,OAAO,KAAK,CAAC,SAAS,EAAE;oBACtB,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC;oBACxB,IAAI,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE;wBAC3C,OAAO;qBACR;iBACF;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,8BAA8B;oBACpC,MAAM,EAAE,KAAK;oBACb,SAAS,EAAE,uBAAuB;oBAClC,MAAM,EAAE;wBACN,KAAK,EAAE,KAAK,CAAC,IAAI;qBAClB;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,8BAA8B,GAAG,UAAU,CAAC;IACvD,IAAI,EAAE,+BAA+B;IACrC,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;gBACvB,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE;oBAC3C,OAAO;iBACR;gBAED,0DAA0D;gBAC1D,wDAAwD;gBACxD,MAAM,cAAc,GAAG,yBAAyB,CAAC;gBACjD,MAAM,mBAAmB,GAAG,sBAAsB,CAAC,OAAO,EAAE,SAAS,CAAE,CAAC;gBAExE,IAAI,mBAAmB,KAAK,iBAAiB,IAAI,cAAc,CAAC,IAAI,CAAC,mBAAmB,CAAC,EAAE;oBACzF,OAAO;iBACR;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,SAAS;oBACjB,SAAS,EAAE,4BAA4B;oBACvC,MAAM,EAAE;wBACN,SAAS,EAAE,oBAAoB,CAAC,SAAS,CAAC;qBAC3C;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const requiredRequestParametersRule: import("@typespec/lint").LintRule;
2
+ //# sourceMappingURL=required-for-create.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,40 @@
1
+ import { createRule } from "@typespec/lint";
2
+ import { isComputed, isRequiredForCreate } from "../index.js";
3
+ import { getIdForType, isTypeNullable } from "../utils.js";
4
+ import { getOperationVerb } from "@typespec/http";
5
+ import { reportDiagnostic } from "../lib.js";
6
+ export const requiredRequestParametersRule = createRule({
7
+ name: "required-request-parameters",
8
+ create({ program }) {
9
+ return {
10
+ interface: (theInterface) => {
11
+ const postOperations = [...theInterface.operations]
12
+ .map(([_, operation]) => operation)
13
+ .filter((operation) => getOperationVerb(program, operation) === "post");
14
+ postOperations.forEach((operation) => {
15
+ if (operation.parameters.properties.has("body")) {
16
+ const body = operation.parameters.properties.get("body");
17
+ const model = body.type;
18
+ [...model.properties].forEach(([_, property]) => {
19
+ if (!(isRequiredForCreate(program, property) ||
20
+ isTypeNullable(program, property.type) ||
21
+ isComputed(program, property) ||
22
+ property.default)) {
23
+ reportDiagnostic(program, {
24
+ code: "element-missing-dependencies",
25
+ target: property,
26
+ messageId: "propertyRequiredForCreate",
27
+ format: {
28
+ property: property.name,
29
+ model: getIdForType(program, property.model),
30
+ },
31
+ });
32
+ }
33
+ });
34
+ }
35
+ });
36
+ },
37
+ };
38
+ },
39
+ });
40
+ //# sourceMappingURL=required-for-create.js.map
@@ -0,0 +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,GAAG,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;wBACzD,MAAM,KAAK,GAAU,IAAK,CAAC,IAAI,CAAC;wBAChC,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,EAAE;4BAC9C,IACE,CAAC,CACC,mBAAmB,CAAC,OAAO,EAAE,QAAQ,CAAC;gCACtC,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC;gCACtC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC;gCAC7B,QAAQ,CAAC,OAAO,CACjB,EACD;gCACA,gBAAgB,CAAC,OAAO,EAAE;oCACxB,IAAI,EAAE,8BAA8B;oCACpC,MAAM,EAAE,QAAQ;oCAChB,SAAS,EAAE,2BAA2B;oCACtC,MAAM,EAAE;wCACN,QAAQ,EAAE,QAAQ,CAAC,IAAI;wCACvB,KAAK,EAAE,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAM,CAAC;qCAC9C;iCACF,CAAC,CAAC;6BACJ;wBACH,CAAC,CAAC,CAAC;qBACJ;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -2,9 +2,11 @@ import { Enum, Interface, Model, ModelProperty, Namespace, Operation, Program, S
2
2
  export interface MsGraphInterface {
3
3
  theInterface: Interface;
4
4
  operations: Operation[];
5
+ path: string;
5
6
  }
6
7
  export declare function getNameForType(program: Program, type: Type): string;
7
8
  export declare function getNameForModelType(program: Program, type: Model | Scalar): string;
9
+ export declare function getCSDLPrimitiveType(typespecType: string): string;
8
10
  export declare function getIdForType(program: Program, type: Type): string;
9
11
  export declare function getNavigationTypeId(program: Program, getOperation: Operation): string;
10
12
  export declare function getInterfacesOfKinds(program: Program, navigationSources: Map<string, Interface>, kinds: string[]): Map<string, MsGraphInterface>;
@@ -37,6 +39,7 @@ export declare function isExcludedCoreType(program: Program, type: Model | Scala
37
39
  export declare function isExcludedLibraryType(program: Program, type: Model | Scalar | Operation | ModelProperty | Interface | Namespace | Enum): boolean;
38
40
  export declare function isNavigationProperty(program: Program, property: ModelProperty): boolean;
39
41
  export declare function isNavigationSource(theInterface: Interface): boolean;
42
+ export declare function isTopLevelNavigationSource(program: Program, theInterface: MsGraphInterface): boolean;
40
43
  export declare function getInterfaceNavigationSourceType(program: Program, theInterface: Interface): Model | undefined;
41
44
  export declare function getNavigationSourceType(program: Program, operation: Operation): Model | undefined;
42
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;AAI5B,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,SAAS,CAAC;IACxB,UAAU,EAAE,SAAS,EAAE,CAAC;CACzB;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,CAqBnE;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,GAAG,MAAM,UAuCzE;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,CAkBjE;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,GAAG,MAAM,CAOrF;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE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,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,6 +1,5 @@
1
1
  import { getNamespaceFullName, isArrayModelType, } from "@typespec/compiler";
2
- import { getEntity, isEntity } from "./decorators/index.js";
3
- import { getRoutePath } from "@typespec/http";
2
+ import { getEntity, getGraphRoutePaths, getPublicNamespaceName, hasPublicNamespace, isEntity } from "./decorators/index.js";
4
3
  export function getNameForType(program, type) {
5
4
  switch (type.kind) {
6
5
  case "Union":
@@ -53,6 +52,8 @@ export function getNameForModelType(program, type) {
53
52
  return "Edm.Boolean";
54
53
  case "stream":
55
54
  return "Edm.Stream";
55
+ case "guid":
56
+ return "Edm.Guid";
56
57
  default:
57
58
  break;
58
59
  }
@@ -61,21 +62,63 @@ export function getNameForModelType(program, type) {
61
62
  }
62
63
  return `Collection(${getPropertyTypeName(program, type.indexer.value)})`;
63
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
+ }
64
103
  export function getIdForType(program, type) {
65
104
  switch (type.kind) {
66
105
  case "Namespace":
67
- return getNamespaceFullName(type);
106
+ return hasPublicNamespace(program, type)
107
+ ? getPublicNamespaceName(program, type)
108
+ : getNamespaceFullName(type);
68
109
  case "Model":
69
110
  case "Enum":
70
111
  case "Operation":
71
112
  case "Interface":
72
- return `${getNamespaceFullName(type.namespace)}.${type.name}`;
113
+ return `${getIdForType(program, type.namespace)}.${type.name}`;
73
114
  case "String":
74
115
  case "Number":
75
116
  case "Boolean":
76
117
  return `${type.value}`;
77
118
  case "Union":
78
119
  return getIdForUnion(program, type);
120
+ case "Scalar":
121
+ return getNameForModelType(program, type);
79
122
  default:
80
123
  return type.kind;
81
124
  }
@@ -91,26 +134,32 @@ export function getNavigationTypeId(program, getOperation) {
91
134
  export function getInterfacesOfKinds(program, navigationSources, kinds) {
92
135
  const interfaces = new Map();
93
136
  navigationSources.forEach((theInterface) => {
94
- if (!theInterface.sourceInterfaces.some(s => kinds.includes(s.name))) {
137
+ if (!theInterface.sourceInterfaces.some((s) => kinds.includes(s.name))) {
95
138
  // if source interfaces DO NOT have the kinds.
96
139
  return;
97
140
  }
98
- const routePath = getRoutePath(program, theInterface);
99
- if (!routePath) {
141
+ const graphRoutePaths = getGraphRoutePaths(program, theInterface);
142
+ if (!graphRoutePaths) {
100
143
  return;
101
144
  }
102
- const path = removeRoutePathParams(routePath.path);
103
- if (!path) {
145
+ if (!graphRoutePaths.length) {
104
146
  return;
105
147
  }
106
- let operations = [...theInterface.operations.values()];
107
- if (interfaces.has(path)) {
108
- const existing = interfaces.get(path);
109
- operations = [...operations, ...existing.operations];
110
- }
111
- interfaces.set(path, {
112
- theInterface: theInterface,
113
- operations: operations,
148
+ graphRoutePaths.forEach((graphRoute) => {
149
+ const path = removeRoutePathParams(graphRoute);
150
+ if (!path) {
151
+ return;
152
+ }
153
+ let operations = [...theInterface.operations.values()];
154
+ if (interfaces.has(path)) {
155
+ const existing = interfaces.get(path);
156
+ operations = [...operations, ...existing.operations];
157
+ }
158
+ interfaces.set(path, {
159
+ theInterface: theInterface,
160
+ operations: operations,
161
+ path: graphRoute
162
+ });
114
163
  });
115
164
  });
116
165
  return interfaces;
@@ -215,12 +264,12 @@ export function isExcludedCoreType(program, type) {
215
264
  // https://github.com/Azure/typespec-azure/issues/801#issuecomment-1194454247
216
265
  //
217
266
  const nsName = getNamespaceName(program, type);
218
- const excludedNamespaces = ["TypeSpec"];
267
+ const excludedNamespaces = ["TypeSpec", "MsGraph"];
219
268
  return excludedNamespaces.find((ns) => nsName.startsWith(ns)) !== undefined;
220
269
  }
221
270
  export function isExcludedLibraryType(program, type) {
222
271
  const nsName = getNamespaceName(program, type);
223
- const excludedNamespaces = ["TypeSpec", "MicrosoftGraph"];
272
+ const excludedNamespaces = ["TypeSpec", "MsGraph"];
224
273
  return excludedNamespaces.find((ns) => nsName.startsWith(ns)) !== undefined;
225
274
  }
226
275
  export function isNavigationProperty(program, property) {
@@ -247,8 +296,11 @@ export function isNavigationProperty(program, property) {
247
296
  export function isNavigationSource(theInterface) {
248
297
  return findNavigationSource(theInterface) !== undefined;
249
298
  }
299
+ export function isTopLevelNavigationSource(program, theInterface) {
300
+ return removeRoutePathParams(theInterface.path).split("/").length === 1;
301
+ }
250
302
  // Get the type returned by all operations in an interface representing a navigation source.
251
- // This is the 'T' in EntitySet<T> and friends.
303
+ // This is the 'T' in Collection<T> and friends.
252
304
  export function getInterfaceNavigationSourceType(program, theInterface) {
253
305
  var _a;
254
306
  const navSource = findNavigationSource(theInterface);
@@ -265,7 +317,7 @@ export function getNavigationSourceType(program, operation) {
265
317
  }
266
318
  function findNavigationSource(theInterface) {
267
319
  for (const baseInterface of theInterface.sourceInterfaces) {
268
- if (baseInterface.name === "SingleNavigationSource" || baseInterface.name === "CollectionNavigationSource") {
320
+ if (baseInterface.name === "Resource" || baseInterface.name === "Collection") {
269
321
  return baseInterface;
270
322
  }
271
323
  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,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"}
@@ -7,6 +7,38 @@ using TypeSpec.Reflection;
7
7
  */
8
8
  extern dec abstract(target: Model);
9
9
 
10
+ /**
11
+ * `@action` - mark an operation as an action
12
+ *
13
+ * `@action` can only be applied to operations.
14
+ */
15
+ extern dec action(target: Operation, name?: valueof string);
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
+
10
42
  /**
11
43
  * `@alternateKey` - mark a model property as an alternateKey
12
44
  *
@@ -42,6 +74,13 @@ extern dec contains(target: ModelProperty);
42
74
  */
43
75
  extern dec count(target: Operation);
44
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
+
45
84
  /**
46
85
  * `@deprecatedDefinition` - Allow us create a reusable deprecation definition.
47
86
  * `@deprecatedDefinition` - Applies only to namespaces.
@@ -71,6 +110,16 @@ extern dec entity(target: Model);
71
110
  */
72
111
  extern dec expand(target: Operation, property: valueof string, ...otherProperties: valueof string[]);
73
112
 
113
+ /**
114
+ * `@filter` - Applies to: get operations that return collections of @entity or @complex models.
115
+ * Indicates that the get operation supports OData $filter query parameter.
116
+ *
117
+ * `properties` - array of property names in the model returned
118
+ * from the get operation that can be used in $filter query parameter.
119
+ */
120
+ extern dec filter(target: Operation, property: valueof string, ...properties: valueof string[]);
121
+
122
+
74
123
  /**
75
124
  * `@flags` - mark an enumeration type as a flag.
76
125
  *
@@ -85,6 +134,16 @@ extern dec flags(target: Enum);
85
134
  */
86
135
  extern dec function(target: Operation, name?: valueof string);
87
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
+
88
147
  /**
89
148
  * `@hasStream` - indicates that an `@entity` model has a stream.
90
149
  *
@@ -92,6 +151,13 @@ extern dec function(target: Operation, name?: valueof string);
92
151
  */
93
152
  extern dec hasStream(target: Model, ...mediaTypes: valueof string[]);
94
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
+
95
161
  /**
96
162
  * `@open` - mark a model type as open
97
163
  *
@@ -117,6 +183,13 @@ extern dec operationParameters(target: Model);
117
183
  */
118
184
  extern dec orderBy(target: Operation, property: valueof string, ...otherProperties: valueof string[]);
119
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
+
120
193
  /**
121
194
  * `@privatePreview` - Allow us define a privatePreview element.
122
195
  * `@privatePreview` - Applies to models, model properties, enums, enum members, namespaces and operations.
@@ -135,20 +208,22 @@ extern dec privatePreviewDefinition(
135
208
  name: valueof string,
136
209
  announcementDate: valueof string,
137
210
  removalDate: valueof string,
138
- owner: valueof string
211
+ owner?: valueof string
139
212
  );
140
213
 
141
214
  /**
142
- * `@search` - Applies to: get operations that return collections.
143
- * 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.
144
218
  */
145
- extern dec search(target: Operation);
219
+ extern dec privileged(target: Model | ModelProperty | Enum | EnumMember | Operation | Namespace);
146
220
 
147
221
  /**
148
- * `@skip` - Applies to: get operations that return collections.
149
- * 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.
150
225
  */
151
- extern dec skip(target: Operation);
226
+ extern dec publicNamespace(target: Namespace, name: valueof string);
152
227
 
153
228
  /**
154
229
  * `@readOnly` - mark a model property as readOnly property
@@ -164,6 +239,26 @@ extern dec readOnly(target: ModelProperty);
164
239
  */
165
240
  extern dec references(target: ModelProperty);
166
241
 
242
+ /**
243
+ * `@requiredForCreate` - mark a model property as required when a request is made to
244
+ * Graph to create or update a resource.
245
+ *
246
+ * `@requiredForCreate` can only be applied to model properties.
247
+ */
248
+ extern dec requiredForCreate(target: ModelProperty);
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
+
167
262
  /**
168
263
  * `@top` - Applies to: get operations that return collections.
169
264
  * Indicates that the get operation supports the OData $top query parameter.
@@ -177,24 +272,6 @@ extern dec top(target: Operation);
177
272
  */
178
273
  extern dec writeOnly(target: ModelProperty);
179
274
 
180
- /**
181
- * `@additionalQueryParameters` - Appends a key=value pair to the query string of the mapped internal URL for all models defined within the namespace.
182
- *
183
- * `@additionalQueryParameters` can only be applied to namespaces
184
- */
185
- extern dec additionalQueryParameters(target: Namespace, name: valueof string, value: valueof string);
186
-
187
- /**
188
- * `@agsAttribute` - Allows all AGS CSDL extensions that are not yet modelled explicitly in TypeSpec to be maintained
189
- *
190
- * `@agsAttribute` - Applies to models.
191
- */
192
- extern dec agsAttribute(
193
- target: Model | ModelProperty | Enum | EnumMember | Operation | Interface,
194
- name: valueof string,
195
- value: valueof string
196
- );
197
-
198
275
  /**
199
276
  * `@isOwner` - specify that this workload is the primary owner of this entity model
200
277
  *
@@ -202,13 +279,6 @@ extern dec agsAttribute(
202
279
  */
203
280
  extern dec isOwner(target: Model | ModelProperty);
204
281
 
205
- /**
206
- * `@privileged` - mark the entity as privileged
207
- *
208
- * `@privileged` can be applied to Model, ModelProperty, Enum, EnumMember, Operation, Namespace.
209
- */
210
- extern dec privileged(target: Model | ModelProperty | Enum | EnumMember | Operation | Namespace);
211
-
212
282
  /**
213
283
  * `@workloadName` - specifies the name used by the underlying workload
214
284
  *
@@ -228,27 +298,3 @@ extern dec workloadNameMsa(
228
298
  target: Model | ModelProperty | Enum | EnumMember,
229
299
  workloadNameMsa: valueof string
230
300
  );
231
-
232
- /**
233
- * `@pagedCollection` - mark a model as representing a paged collection.
234
- *
235
- * `@pagedCollection` can only be applied to models.
236
- */
237
- extern dec pagedCollection(target: Model);
238
-
239
- /**
240
- * `@deltaCollection` - mark a model as representing a delta paged collection.
241
- *
242
- * `@deltaCollection` can only be applied to models.
243
- */
244
- extern dec deltaCollection(target: Model);
245
-
246
- /**
247
- * `@graphRoute` - mark an interface or operation with an HTTP route.
248
- *
249
- * `@graphRoute` - can only be applied to interfaces or operations.
250
- */
251
- // TODO: Using @graphRoute on an operation currently does not work due to the following TypeSpec core issue
252
- // https://github.com/microsoft/typespec/issues/2106
253
- // Disabling all related features while we await the outcome.
254
- extern dec graphRoute(target: Interface /* | Operation */, path: valueof string);
@@ -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,29 +2,18 @@ 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
 
9
9
  scalar stream;
10
10
 
11
+ scalar guid extends string;
12
+
11
13
  model EmptyParameters {}
12
14
 
13
15
  // --- Base interfaces for all interfaces that contain operations returning entities.
14
- interface SingleNavigationSource<T> {}
15
- interface CollectionNavigationSource<T> {}
16
-
17
- interface Resource<T> extends SingleNavigationSource<T> {
18
- }
19
-
20
- interface Collection<T> extends CollectionNavigationSource<T> {
21
- }
22
-
23
- interface Singleton<T> extends SingleNavigationSource<T> {
24
- }
25
16
 
26
- interface EntitySet<T> extends CollectionNavigationSource<T> {
27
- }
17
+ interface Resource<T> {}
28
18
 
29
- interface EntitySetResource<T> extends SingleNavigationSource<T> {
30
- }
19
+ interface Collection<T> {}
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