@microsoft/typespec-msgraph 0.0.1-Preview.1 → 0.0.1-Preview.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/components/acceptable-media-types-annotation.d.ts +3 -4
- package/dist/src/components/acceptable-media-types-annotation.d.ts.map +1 -1
- package/dist/src/components/acceptable-media-types-annotation.js +2 -6
- package/dist/src/components/acceptable-media-types-annotation.js.map +1 -1
- package/dist/src/components/alternate-keys-annotation.d.ts +4 -4
- package/dist/src/components/alternate-keys-annotation.d.ts.map +1 -1
- package/dist/src/components/alternate-keys-annotation.js +8 -16
- package/dist/src/components/alternate-keys-annotation.js.map +1 -1
- package/dist/src/components/annotations.d.ts +12 -0
- package/dist/src/components/annotations.d.ts.map +1 -0
- package/dist/src/components/annotations.js +63 -0
- package/dist/src/components/annotations.js.map +1 -0
- package/dist/src/components/common-elements.d.ts +15 -73
- package/dist/src/components/common-elements.d.ts.map +1 -1
- package/dist/src/components/common-elements.js +12 -26
- package/dist/src/components/common-elements.js.map +1 -1
- package/dist/src/components/computed-annotation.d.ts +3 -4
- package/dist/src/components/computed-annotation.d.ts.map +1 -1
- package/dist/src/components/computed-annotation.js +4 -10
- package/dist/src/components/computed-annotation.js.map +1 -1
- package/dist/src/components/count-restrictions-annotation.d.ts +3 -4
- package/dist/src/components/count-restrictions-annotation.d.ts.map +1 -1
- package/dist/src/components/count-restrictions-annotation.js +4 -13
- package/dist/src/components/count-restrictions-annotation.js.map +1 -1
- package/dist/src/components/description-annotation.d.ts +3 -4
- package/dist/src/components/description-annotation.d.ts.map +1 -1
- package/dist/src/components/description-annotation.js +5 -11
- package/dist/src/components/description-annotation.js.map +1 -1
- package/dist/src/components/entity-container-element.d.ts +21 -0
- package/dist/src/components/entity-container-element.d.ts.map +1 -0
- package/dist/src/components/entity-container-element.js +22 -0
- package/dist/src/components/entity-container-element.js.map +1 -0
- package/dist/src/components/enum-type-element.d.ts +6 -0
- package/dist/src/components/enum-type-element.d.ts.map +1 -0
- package/dist/src/components/enum-type-element.js +17 -0
- package/dist/src/components/enum-type-element.js.map +1 -0
- package/dist/src/components/expand-restrictions-annotation.d.ts +4 -5
- package/dist/src/components/expand-restrictions-annotation.d.ts.map +1 -1
- package/dist/src/components/expand-restrictions-annotation.js +9 -30
- package/dist/src/components/expand-restrictions-annotation.js.map +1 -1
- package/dist/src/components/filter-restrictions-annotation.d.ts +6 -0
- package/dist/src/components/filter-restrictions-annotation.d.ts.map +1 -0
- package/dist/src/components/filter-restrictions-annotation.js +10 -0
- package/dist/src/components/filter-restrictions-annotation.js.map +1 -0
- package/dist/src/components/immutable-annotation.d.ts +5 -0
- package/dist/src/components/immutable-annotation.d.ts.map +1 -0
- package/dist/src/components/immutable-annotation.js +6 -0
- package/dist/src/components/immutable-annotation.js.map +1 -0
- package/dist/src/components/index.d.ts +2 -14
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +9 -14
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/components/insert-restrictions-annotation.d.ts +6 -0
- package/dist/src/components/insert-restrictions-annotation.d.ts.map +1 -0
- package/dist/src/components/insert-restrictions-annotation.js +10 -0
- package/dist/src/components/insert-restrictions-annotation.js.map +1 -0
- package/dist/src/components/operation-element.d.ts +6 -0
- package/dist/src/components/operation-element.d.ts.map +1 -0
- package/dist/src/components/operation-element.js +70 -0
- package/dist/src/components/operation-element.js.map +1 -0
- package/dist/src/components/permissions-annotation.d.ts +3 -4
- package/dist/src/components/permissions-annotation.d.ts.map +1 -1
- package/dist/src/components/permissions-annotation.js +2 -10
- package/dist/src/components/permissions-annotation.js.map +1 -1
- package/dist/src/components/property-element.d.ts +4 -4
- package/dist/src/components/property-element.d.ts.map +1 -1
- package/dist/src/components/property-element.js +16 -32
- package/dist/src/components/property-element.js.map +1 -1
- package/dist/src/components/revisions-annotation.d.ts +4 -5
- package/dist/src/components/revisions-annotation.d.ts.map +1 -1
- package/dist/src/components/revisions-annotation.js +7 -51
- package/dist/src/components/revisions-annotation.js.map +1 -1
- package/dist/src/components/schema-element.d.ts +6 -0
- package/dist/src/components/schema-element.d.ts.map +1 -0
- package/dist/src/components/schema-element.js +42 -0
- package/dist/src/components/schema-element.js.map +1 -0
- package/dist/src/components/search-restrictions-annotation.d.ts +3 -4
- package/dist/src/components/search-restrictions-annotation.d.ts.map +1 -1
- package/dist/src/components/search-restrictions-annotation.js +4 -13
- package/dist/src/components/search-restrictions-annotation.js.map +1 -1
- package/dist/src/components/skip-supported-annotation.d.ts +3 -4
- package/dist/src/components/skip-supported-annotation.d.ts.map +1 -1
- package/dist/src/components/skip-supported-annotation.js +2 -11
- package/dist/src/components/skip-supported-annotation.js.map +1 -1
- package/dist/src/components/sort-restrictions-annotation.d.ts +4 -5
- package/dist/src/components/sort-restrictions-annotation.d.ts.map +1 -1
- package/dist/src/components/sort-restrictions-annotation.js +9 -30
- package/dist/src/components/sort-restrictions-annotation.js.map +1 -1
- package/dist/src/components/structured-type-element.d.ts +7 -4
- package/dist/src/components/structured-type-element.d.ts.map +1 -1
- package/dist/src/components/structured-type-element.js +24 -66
- package/dist/src/components/structured-type-element.js.map +1 -1
- package/dist/src/components/top-supported-annotation.d.ts +3 -4
- package/dist/src/components/top-supported-annotation.d.ts.map +1 -1
- package/dist/src/components/top-supported-annotation.js +3 -10
- package/dist/src/components/top-supported-annotation.js.map +1 -1
- package/dist/src/components/update-restrictions-annotation.d.ts +5 -0
- package/dist/src/components/update-restrictions-annotation.d.ts.map +1 -0
- package/dist/src/components/update-restrictions-annotation.js +8 -0
- package/dist/src/components/update-restrictions-annotation.js.map +1 -0
- package/dist/src/decorators/abstract.d.ts.map +1 -1
- package/dist/src/decorators/abstract.js +0 -6
- package/dist/src/decorators/abstract.js.map +1 -1
- package/dist/src/decorators/action.d.ts +10 -0
- package/dist/src/decorators/action.d.ts.map +1 -0
- package/dist/src/decorators/action.js +16 -0
- package/dist/src/decorators/action.js.map +1 -0
- package/dist/src/decorators/{handlers/custom/additional-query-parameters.d.ts → additional-query-parameters.d.ts} +3 -1
- package/dist/src/decorators/additional-query-parameters.d.ts.map +1 -0
- package/dist/src/decorators/additional-query-parameters.js +21 -0
- package/dist/src/decorators/additional-query-parameters.js.map +1 -0
- package/dist/src/decorators/ags-attribute.d.ts +14 -0
- package/dist/src/decorators/ags-attribute.d.ts.map +1 -0
- package/dist/src/decorators/ags-attribute.js +115 -0
- package/dist/src/decorators/ags-attribute.js.map +1 -0
- package/dist/src/decorators/allowed-values.d.ts +13 -0
- package/dist/src/decorators/allowed-values.d.ts.map +1 -0
- package/dist/src/decorators/allowed-values.js +35 -0
- package/dist/src/decorators/allowed-values.js.map +1 -0
- package/dist/src/decorators/complex.d.ts.map +1 -1
- package/dist/src/decorators/complex.js +0 -6
- package/dist/src/decorators/complex.js.map +1 -1
- package/dist/src/decorators/delta-collection.d.ts +8 -0
- package/dist/src/decorators/delta-collection.d.ts.map +1 -0
- package/dist/src/decorators/delta-collection.js +12 -0
- package/dist/src/decorators/delta-collection.js.map +1 -0
- package/dist/src/decorators/entity.d.ts.map +1 -1
- package/dist/src/decorators/entity.js +0 -6
- package/dist/src/decorators/entity.js.map +1 -1
- package/dist/src/decorators/filter.d.ts +11 -0
- package/dist/src/decorators/filter.d.ts.map +1 -0
- package/dist/src/decorators/filter.js +27 -0
- package/dist/src/decorators/filter.js.map +1 -0
- package/dist/src/decorators/flags.d.ts +9 -0
- package/dist/src/decorators/flags.d.ts.map +1 -0
- package/dist/src/decorators/flags.js +13 -0
- package/dist/src/decorators/flags.js.map +1 -0
- package/dist/src/decorators/function.d.ts +10 -0
- package/dist/src/decorators/function.d.ts.map +1 -0
- package/dist/src/decorators/function.js +16 -0
- package/dist/src/decorators/function.js.map +1 -0
- package/dist/src/decorators/graph-route.d.ts +17 -0
- package/dist/src/decorators/graph-route.d.ts.map +1 -0
- package/dist/src/decorators/graph-route.js +92 -0
- package/dist/src/decorators/graph-route.js.map +1 -0
- package/dist/src/decorators/has-stream.d.ts +1 -2
- package/dist/src/decorators/has-stream.d.ts.map +1 -1
- package/dist/src/decorators/has-stream.js +1 -14
- package/dist/src/decorators/has-stream.js.map +1 -1
- package/dist/src/decorators/immutable.d.ts +8 -0
- package/dist/src/decorators/immutable.d.ts.map +1 -0
- package/dist/src/decorators/immutable.js +12 -0
- package/dist/src/decorators/immutable.js.map +1 -0
- package/dist/src/decorators/index.d.ts +20 -1
- package/dist/src/decorators/index.d.ts.map +1 -1
- package/dist/src/decorators/index.js +20 -1
- package/dist/src/decorators/index.js.map +1 -1
- package/dist/src/decorators/is-owner.d.ts +10 -0
- package/dist/src/decorators/is-owner.d.ts.map +1 -0
- package/dist/src/decorators/is-owner.js +17 -0
- package/dist/src/decorators/is-owner.js.map +1 -0
- package/dist/src/decorators/open.d.ts.map +1 -1
- package/dist/src/decorators/open.js +0 -6
- package/dist/src/decorators/open.js.map +1 -1
- package/dist/src/decorators/{routed-interfaces.d.ts → operation-parameters.d.ts} +3 -11
- package/dist/src/decorators/operation-parameters.d.ts.map +1 -0
- package/dist/src/decorators/operation-parameters.js +15 -0
- package/dist/src/decorators/operation-parameters.js.map +1 -0
- package/dist/src/decorators/paged-collection.d.ts +8 -0
- package/dist/src/decorators/paged-collection.d.ts.map +1 -0
- package/dist/src/decorators/paged-collection.js +12 -0
- package/dist/src/decorators/paged-collection.js.map +1 -0
- package/dist/src/decorators/partial.d.ts +10 -0
- package/dist/src/decorators/partial.d.ts.map +1 -0
- package/dist/src/decorators/partial.js +16 -0
- package/dist/src/decorators/partial.js.map +1 -0
- package/dist/src/decorators/private-preview.d.ts.map +1 -1
- package/dist/src/decorators/private-preview.js +0 -10
- package/dist/src/decorators/private-preview.js.map +1 -1
- package/dist/src/decorators/privileged.d.ts +9 -0
- package/dist/src/decorators/privileged.d.ts.map +1 -0
- package/dist/src/decorators/privileged.js +13 -0
- package/dist/src/decorators/privileged.js.map +1 -0
- package/dist/src/decorators/public-namespace.d.ts +10 -0
- package/dist/src/decorators/public-namespace.d.ts.map +1 -0
- package/dist/src/decorators/public-namespace.js +16 -0
- package/dist/src/decorators/public-namespace.js.map +1 -0
- package/dist/src/decorators/required-for-create.d.ts +10 -0
- package/dist/src/decorators/required-for-create.d.ts.map +1 -0
- package/dist/src/decorators/required-for-create.js +14 -0
- package/dist/src/decorators/required-for-create.js.map +1 -0
- package/dist/src/decorators/workload-name-msa.d.ts +9 -0
- package/dist/src/decorators/workload-name-msa.d.ts.map +1 -0
- package/dist/src/decorators/workload-name-msa.js +13 -0
- package/dist/src/decorators/workload-name-msa.js.map +1 -0
- package/dist/src/decorators/workload-name.d.ts +9 -0
- package/dist/src/decorators/workload-name.d.ts.map +1 -0
- package/dist/src/decorators/workload-name.js +13 -0
- package/dist/src/decorators/workload-name.js.map +1 -0
- package/dist/src/emitter.d.ts +2 -1
- package/dist/src/emitter.d.ts.map +1 -1
- package/dist/src/emitter.js +7 -3
- package/dist/src/emitter.js.map +1 -1
- package/dist/src/entities/annotations.d.ts +40 -0
- package/dist/src/entities/annotations.d.ts.map +1 -0
- package/dist/src/entities/annotations.js +139 -0
- package/dist/src/entities/annotations.js.map +1 -0
- package/dist/src/entities/entity-container.d.ts +15 -0
- package/dist/src/entities/entity-container.d.ts.map +1 -0
- package/dist/src/entities/entity-container.js +44 -0
- package/dist/src/entities/entity-container.js.map +1 -0
- package/dist/src/entities/enum.d.ts +17 -0
- package/dist/src/entities/enum.d.ts.map +1 -0
- package/dist/src/entities/enum.js +24 -0
- package/dist/src/entities/enum.js.map +1 -0
- package/dist/src/entities/model.d.ts +47 -0
- package/dist/src/entities/model.d.ts.map +1 -0
- package/dist/src/entities/model.js +104 -0
- package/dist/src/entities/model.js.map +1 -0
- package/dist/src/entities/namespace.d.ts +22 -0
- package/dist/src/entities/namespace.d.ts.map +1 -0
- package/dist/src/entities/namespace.js +84 -0
- package/dist/src/entities/namespace.js.map +1 -0
- package/dist/src/entities/operation.d.ts +28 -0
- package/dist/src/entities/operation.d.ts.map +1 -0
- package/dist/src/entities/operation.js +103 -0
- package/dist/src/entities/operation.js.map +1 -0
- package/dist/src/entities/property.d.ts +3 -0
- package/dist/src/entities/property.d.ts.map +1 -0
- package/dist/src/entities/property.js +57 -0
- package/dist/src/entities/property.js.map +1 -0
- package/dist/src/entities/revision-definition.d.ts +9 -0
- package/dist/src/entities/revision-definition.d.ts.map +1 -0
- package/dist/src/entities/revision-definition.js +42 -0
- package/dist/src/entities/revision-definition.js.map +1 -0
- package/dist/src/index.d.ts +0 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +0 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts +53 -2
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +25 -1
- package/dist/src/lib.js.map +1 -1
- package/dist/src/linter.d.ts.map +1 -1
- package/dist/src/linter.js +34 -25
- package/dist/src/linter.js.map +1 -1
- package/dist/src/rules/abstract.d.ts +2 -1
- package/dist/src/rules/abstract.d.ts.map +1 -1
- package/dist/src/rules/abstract.js +8 -8
- package/dist/src/rules/abstract.js.map +1 -1
- package/dist/src/rules/allowed-values.d.ts +6 -0
- package/dist/src/rules/allowed-values.d.ts.map +1 -0
- package/dist/src/rules/allowed-values.js +59 -0
- package/dist/src/rules/allowed-values.js.map +1 -0
- package/dist/src/rules/collection-navigation-properties-not-nullable.d.ts +2 -0
- package/dist/src/rules/collection-navigation-properties-not-nullable.d.ts.map +1 -0
- package/dist/src/rules/collection-navigation-properties-not-nullable.js +28 -0
- package/dist/src/rules/collection-navigation-properties-not-nullable.js.map +1 -0
- package/dist/src/rules/count.d.ts.map +1 -1
- package/dist/src/rules/count.js +3 -1
- package/dist/src/rules/count.js.map +1 -1
- package/dist/src/rules/disallowed-typespec-decorators.d.ts +2 -0
- package/dist/src/rules/disallowed-typespec-decorators.d.ts.map +1 -0
- package/dist/src/rules/disallowed-typespec-decorators.js +33 -0
- package/dist/src/rules/disallowed-typespec-decorators.js.map +1 -0
- package/dist/src/rules/entity.d.ts +1 -0
- package/dist/src/rules/entity.d.ts.map +1 -1
- package/dist/src/rules/entity.js +43 -1
- package/dist/src/rules/entity.js.map +1 -1
- package/dist/src/rules/enum.d.ts +2 -0
- package/dist/src/rules/enum.d.ts.map +1 -0
- package/dist/src/rules/enum.js +26 -0
- package/dist/src/rules/enum.js.map +1 -0
- package/dist/src/rules/expand.d.ts.map +1 -1
- package/dist/src/rules/expand.js +5 -7
- package/dist/src/rules/expand.js.map +1 -1
- package/dist/src/rules/extends-on-same-type.d.ts +2 -0
- package/dist/src/rules/extends-on-same-type.d.ts.map +1 -0
- package/dist/src/rules/extends-on-same-type.js +38 -0
- package/dist/src/rules/extends-on-same-type.js.map +1 -0
- package/dist/src/rules/filter.d.ts +4 -0
- package/dist/src/rules/filter.d.ts.map +1 -0
- package/dist/src/rules/filter.js +92 -0
- package/dist/src/rules/filter.js.map +1 -0
- package/dist/src/rules/function.d.ts +2 -0
- package/dist/src/rules/function.d.ts.map +1 -0
- package/dist/src/rules/function.js +26 -0
- package/dist/src/rules/function.js.map +1 -0
- package/dist/src/rules/graph-route.d.ts +6 -0
- package/dist/src/rules/graph-route.d.ts.map +1 -0
- package/dist/src/rules/graph-route.js +97 -0
- package/dist/src/rules/graph-route.js.map +1 -0
- package/dist/src/rules/index.d.ts +13 -6
- package/dist/src/rules/index.d.ts.map +1 -1
- package/dist/src/rules/index.js +13 -161
- package/dist/src/rules/index.js.map +1 -1
- package/dist/src/rules/namespace.d.ts +3 -0
- package/dist/src/rules/namespace.d.ts.map +1 -0
- package/dist/src/rules/namespace.js +58 -0
- package/dist/src/rules/namespace.js.map +1 -0
- package/dist/src/rules/operation-inside-interface.d.ts +2 -0
- package/dist/src/rules/operation-inside-interface.d.ts.map +1 -0
- package/dist/src/rules/operation-inside-interface.js +25 -0
- package/dist/src/rules/operation-inside-interface.js.map +1 -0
- package/dist/src/rules/order-by.d.ts +1 -1
- package/dist/src/rules/order-by.d.ts.map +1 -1
- package/dist/src/rules/order-by.js +11 -10
- package/dist/src/rules/order-by.js.map +1 -1
- package/dist/src/rules/partial.d.ts +5 -0
- package/dist/src/rules/partial.d.ts.map +1 -0
- package/dist/src/rules/partial.js +35 -0
- package/dist/src/rules/partial.js.map +1 -0
- package/dist/src/rules/required-for-create.d.ts +2 -0
- package/dist/src/rules/required-for-create.d.ts.map +1 -0
- package/dist/src/rules/required-for-create.js +40 -0
- package/dist/src/rules/required-for-create.js.map +1 -0
- package/dist/src/rules/search.d.ts.map +1 -1
- package/dist/src/rules/search.js +3 -1
- package/dist/src/rules/search.js.map +1 -1
- package/dist/src/rules/skip.d.ts.map +1 -1
- package/dist/src/rules/skip.js +3 -1
- package/dist/src/rules/skip.js.map +1 -1
- package/dist/src/rules/top.d.ts.map +1 -1
- package/dist/src/rules/top.js +3 -1
- package/dist/src/rules/top.js.map +1 -1
- package/dist/src/utils.d.ts +22 -0
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +160 -4
- package/dist/src/utils.js.map +1 -1
- package/lib/decorators.tsp +182 -39
- package/lib/deployment.tsp +18 -0
- package/lib/lib.tsp +6 -22
- package/lib/msgraph.tsp +4 -0
- package/lib/porcelain.tsp +135 -0
- package/lib/responses.tsp +82 -0
- package/lib/shared-models.tsp +75 -0
- package/package.json +31 -20
- package/dist/src/components/program-context.d.ts +0 -4
- package/dist/src/components/program-context.d.ts.map +0 -1
- package/dist/src/components/program-context.js +0 -3
- package/dist/src/components/program-context.js.map +0 -1
- package/dist/src/csdl.d.ts +0 -8
- package/dist/src/csdl.d.ts.map +0 -1
- package/dist/src/csdl.js +0 -298
- package/dist/src/csdl.js.map +0 -1
- package/dist/src/decorators/attribute-builder.d.ts +0 -2
- package/dist/src/decorators/attribute-builder.d.ts.map +0 -1
- package/dist/src/decorators/attribute-builder.js +0 -166
- package/dist/src/decorators/attribute-builder.js.map +0 -1
- package/dist/src/decorators/attributes.d.ts +0 -57
- package/dist/src/decorators/attributes.d.ts.map +0 -1
- package/dist/src/decorators/attributes.js +0 -50
- package/dist/src/decorators/attributes.js.map +0 -1
- package/dist/src/decorators/handlers/custom/additional-query-parameters.d.ts.map +0 -1
- package/dist/src/decorators/handlers/custom/additional-query-parameters.js +0 -36
- package/dist/src/decorators/handlers/custom/additional-query-parameters.js.map +0 -1
- package/dist/src/decorators/handlers/custom/ags-attribute.d.ts +0 -7
- package/dist/src/decorators/handlers/custom/ags-attribute.d.ts.map +0 -1
- package/dist/src/decorators/handlers/custom/ags-attribute.js +0 -36
- package/dist/src/decorators/handlers/custom/ags-attribute.js.map +0 -1
- package/dist/src/decorators/handlers/custom/index.d.ts +0 -3
- package/dist/src/decorators/handlers/custom/index.d.ts.map +0 -1
- package/dist/src/decorators/handlers/custom/index.js +0 -3
- package/dist/src/decorators/handlers/custom/index.js.map +0 -1
- package/dist/src/decorators/handlers/index.d.ts +0 -30
- package/dist/src/decorators/handlers/index.d.ts.map +0 -1
- package/dist/src/decorators/handlers/index.js +0 -121
- package/dist/src/decorators/handlers/index.js.map +0 -1
- package/dist/src/decorators/routed-interfaces.d.ts.map +0 -1
- package/dist/src/decorators/routed-interfaces.js +0 -43
- package/dist/src/decorators/routed-interfaces.js.map +0 -1
package/lib/decorators.tsp
CHANGED
|
@@ -1,14 +1,43 @@
|
|
|
1
1
|
using TypeSpec.Reflection;
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* TODO: Enable this once Model type is supported. https://github.com/microsoft/typespec/issues/1655
|
|
5
|
-
*
|
|
6
4
|
* `@abstract` - mark a model type as abstract
|
|
7
5
|
*
|
|
8
6
|
* `@abstract` can only be applied to models.
|
|
9
|
-
|
|
7
|
+
*/
|
|
10
8
|
extern dec abstract(target: Model);
|
|
11
|
-
|
|
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[]);
|
|
12
41
|
|
|
13
42
|
/**
|
|
14
43
|
* `@alternateKey` - mark a model property as an alternateKey
|
|
@@ -18,14 +47,11 @@ extern dec abstract(target: Model);
|
|
|
18
47
|
extern dec alternateKey(target: ModelProperty);
|
|
19
48
|
|
|
20
49
|
/**
|
|
21
|
-
* TODO: Enable this once Model type is supported. https://github.com/microsoft/typespec/issues/1655
|
|
22
|
-
*
|
|
23
50
|
* `@complex` - mark a model as an entity type
|
|
24
51
|
*
|
|
25
52
|
* `@complex` can only be applied to models.
|
|
26
|
-
|
|
27
|
-
extern dec complex(target: Model);
|
|
28
53
|
*/
|
|
54
|
+
extern dec complex(target: Model);
|
|
29
55
|
|
|
30
56
|
/**
|
|
31
57
|
* `@computed` - mark a model property as a computed property
|
|
@@ -48,28 +74,32 @@ extern dec contains(target: ModelProperty);
|
|
|
48
74
|
*/
|
|
49
75
|
extern dec count(target: Operation);
|
|
50
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
|
+
|
|
51
84
|
/**
|
|
52
85
|
* `@deprecatedDefinition` - Allow us create a reusable deprecation definition.
|
|
53
86
|
* `@deprecatedDefinition` - Applies only to namespaces.
|
|
54
87
|
*/
|
|
55
88
|
extern dec deprecatedDefinition(
|
|
56
89
|
target: Namespace,
|
|
57
|
-
name: string,
|
|
58
|
-
category: string,
|
|
59
|
-
announcementDate: string,
|
|
60
|
-
removalDate: string,
|
|
61
|
-
description: string
|
|
90
|
+
name: valueof string,
|
|
91
|
+
category: valueof string,
|
|
92
|
+
announcementDate: valueof string,
|
|
93
|
+
removalDate: valueof string,
|
|
94
|
+
description: valueof string
|
|
62
95
|
);
|
|
63
96
|
|
|
64
97
|
/**
|
|
65
|
-
* TODO: Enable this once Model type is supported. https://github.com/microsoft/typespec/issues/1655
|
|
66
|
-
*
|
|
67
98
|
* `@entity` - mark a model as an entity type
|
|
68
99
|
*
|
|
69
100
|
* `@entity` can only be applied to models.
|
|
70
|
-
|
|
71
|
-
extern dec entity(target: Model);
|
|
72
101
|
*/
|
|
102
|
+
extern dec entity(target: Model);
|
|
73
103
|
|
|
74
104
|
/**
|
|
75
105
|
* `@expand` - Applies to: get operations that return collections or individual instances of models that contain @contains or @references properties.
|
|
@@ -78,18 +108,71 @@ extern dec entity(target: Model);
|
|
|
78
108
|
* `properties` - Property names in the model returned from the get that can be used in a $expand query parameter.
|
|
79
109
|
* At least one property must be specified.
|
|
80
110
|
*/
|
|
81
|
-
extern dec expand(target: Operation, property: string, ...otherProperties: string[]);
|
|
111
|
+
extern dec expand(target: Operation, property: valueof string, ...otherProperties: valueof string[]);
|
|
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
|
+
|
|
82
122
|
|
|
83
123
|
/**
|
|
84
|
-
*
|
|
124
|
+
* `@flags` - mark an enumeration type as a flag.
|
|
85
125
|
*
|
|
126
|
+
* `@flags` can only be applied to enums.
|
|
127
|
+
*/
|
|
128
|
+
extern dec flags(target: Enum);
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* `@function` - mark an operation as a function
|
|
132
|
+
*
|
|
133
|
+
* `@function` can only be applied to operations.
|
|
134
|
+
*/
|
|
135
|
+
extern dec function(target: Operation, name?: valueof string);
|
|
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
|
+
|
|
147
|
+
/**
|
|
86
148
|
* `@hasStream` - indicates that an `@entity` model has a stream.
|
|
87
149
|
*
|
|
88
|
-
* `mediaTypes` - list of media types supported by the stream.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
150
|
+
* `mediaTypes` - list of media types supported by the stream. If not specified, the stream supports any media type.
|
|
151
|
+
*/
|
|
152
|
+
extern dec hasStream(target: Model, ...mediaTypes: valueof string[]);
|
|
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
|
+
|
|
161
|
+
/**
|
|
162
|
+
* `@open` - mark a model type as open
|
|
163
|
+
*
|
|
164
|
+
* `@open` can only be applied to models.
|
|
92
165
|
*/
|
|
166
|
+
extern dec open(target: Model);
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* `@operationParameters` - A model with this decorator will not be generated in the CSDL
|
|
170
|
+
* and can't be reused by other models through inheritance,
|
|
171
|
+
* or any other way except through being a parameter for an action operation.
|
|
172
|
+
* The purpose of this model is only to define model parameters that would be too verbose.
|
|
173
|
+
* This decorator will be the equivalent of inlining the properties of the model into parameters of the operation.
|
|
174
|
+
*/
|
|
175
|
+
extern dec operationParameters(target: Model);
|
|
93
176
|
|
|
94
177
|
/**
|
|
95
178
|
* `@orderBy` - Applies to: get operations that return collections of @entity or @complex models.
|
|
@@ -98,19 +181,30 @@ extern dec expand(target: Operation, property: string, ...otherProperties: strin
|
|
|
98
181
|
* `properties` - List of property names in the model returned from the get operation that can be used in a $orderBy query parameter.
|
|
99
182
|
* At least one property must be specified.
|
|
100
183
|
*/
|
|
101
|
-
extern dec orderBy(target: Operation, property: string, ...otherProperties: string[]);
|
|
184
|
+
extern dec orderBy(target: Operation, property: valueof string, ...otherProperties: valueof string[]);
|
|
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);
|
|
102
192
|
|
|
103
193
|
/**
|
|
104
|
-
*
|
|
194
|
+
* `@partial` - Mark a model as partial.
|
|
105
195
|
*
|
|
196
|
+
* `@partial` can only be applied to models.
|
|
197
|
+
*/
|
|
198
|
+
extern dec partial(target: Model, value: Model);
|
|
199
|
+
|
|
200
|
+
/**
|
|
106
201
|
* `@privatePreview` - Allow us define a privatePreview element.
|
|
107
202
|
* `@privatePreview` - Applies to models, model properties, enums, enum members, namespaces and operations.
|
|
108
|
-
|
|
203
|
+
*/
|
|
109
204
|
extern dec privatePreview(
|
|
110
205
|
target: Model | ModelProperty | EnumMember | Enum | Operation | Namespace,
|
|
111
|
-
name: string
|
|
112
|
-
)
|
|
113
|
-
*/
|
|
206
|
+
name: valueof string
|
|
207
|
+
);
|
|
114
208
|
|
|
115
209
|
/**
|
|
116
210
|
* `@privatePreviewDefinition` - Allow us create a reusable private preview definition.
|
|
@@ -118,23 +212,25 @@ extern dec privatePreview(
|
|
|
118
212
|
*/
|
|
119
213
|
extern dec privatePreviewDefinition(
|
|
120
214
|
target: Namespace,
|
|
121
|
-
name: string,
|
|
122
|
-
announcementDate: string,
|
|
123
|
-
removalDate: string,
|
|
124
|
-
owner
|
|
215
|
+
name: valueof string,
|
|
216
|
+
announcementDate: valueof string,
|
|
217
|
+
removalDate: valueof string,
|
|
218
|
+
owner?: valueof string
|
|
125
219
|
);
|
|
126
220
|
|
|
127
221
|
/**
|
|
128
|
-
* `@
|
|
129
|
-
*
|
|
222
|
+
* `@privileged` - mark the entity as privileged
|
|
223
|
+
*
|
|
224
|
+
* `@privileged` can be applied to Model, ModelProperty, Enum, EnumMember, Operation, Namespace.
|
|
130
225
|
*/
|
|
131
|
-
extern dec
|
|
226
|
+
extern dec privileged(target: Model | ModelProperty | Enum | EnumMember | Operation | Namespace);
|
|
132
227
|
|
|
133
228
|
/**
|
|
134
|
-
* `@
|
|
135
|
-
*
|
|
229
|
+
* `@publicNamespace` - defines the namespace to be used in generating CSDL output for all elements contained within the namespace
|
|
230
|
+
*
|
|
231
|
+
* `@publicNamespace` can only be applied to namespaces.
|
|
136
232
|
*/
|
|
137
|
-
extern dec
|
|
233
|
+
extern dec publicNamespace(target: Namespace, name: valueof string);
|
|
138
234
|
|
|
139
235
|
/**
|
|
140
236
|
* `@readOnly` - mark a model property as readOnly property
|
|
@@ -150,6 +246,26 @@ extern dec readOnly(target: ModelProperty);
|
|
|
150
246
|
*/
|
|
151
247
|
extern dec references(target: ModelProperty);
|
|
152
248
|
|
|
249
|
+
/**
|
|
250
|
+
* `@requiredForCreate` - mark a model property as required when a request is made to
|
|
251
|
+
* Graph to create or update a resource.
|
|
252
|
+
*
|
|
253
|
+
* `@requiredForCreate` can only be applied to model properties.
|
|
254
|
+
*/
|
|
255
|
+
extern dec requiredForCreate(target: ModelProperty);
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* `@search` - Applies to: get operations that return collections.
|
|
259
|
+
* Indicates that the get operation supports the OData $search query parameter.
|
|
260
|
+
*/
|
|
261
|
+
extern dec search(target: Operation);
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* `@skip` - Applies to: get operations that return collections.
|
|
265
|
+
* Indicates that the get operation supports the OData $skip query parameter.
|
|
266
|
+
*/
|
|
267
|
+
extern dec skip(target: Operation);
|
|
268
|
+
|
|
153
269
|
/**
|
|
154
270
|
* `@top` - Applies to: get operations that return collections.
|
|
155
271
|
* Indicates that the get operation supports the OData $top query parameter.
|
|
@@ -162,3 +278,30 @@ extern dec top(target: Operation);
|
|
|
162
278
|
* `@writeOnly` can only be applied to model properties.
|
|
163
279
|
*/
|
|
164
280
|
extern dec writeOnly(target: ModelProperty);
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* `@isOwner` - specify that this workload is the primary owner of this entity model
|
|
284
|
+
*
|
|
285
|
+
* `@isOwner` can be applied to Model where the model also has an @entity decorator or a ModelProperty where it has either an @contains or @references decorator.
|
|
286
|
+
*/
|
|
287
|
+
extern dec isOwner(target: Model | ModelProperty, value?: valueof boolean);
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* `@workloadName` - specifies the name used by the underlying workload
|
|
291
|
+
*
|
|
292
|
+
* `@workloadName` can be applied to Model, ModelProperty, Enum, EnumMember.
|
|
293
|
+
*/
|
|
294
|
+
extern dec workloadName(
|
|
295
|
+
target: Model | ModelProperty | Enum | EnumMember,
|
|
296
|
+
workloadName: valueof string
|
|
297
|
+
);
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* `@workloadNameMsa` - specifies the name used by the underlying workload for consumer use cases
|
|
301
|
+
*
|
|
302
|
+
* `@workloadNameMsa` can be applied to Model, ModelProperty, Enum, EnumMember.
|
|
303
|
+
*/
|
|
304
|
+
extern dec workloadNameMsa(
|
|
305
|
+
target: Model | ModelProperty | Enum | EnumMember,
|
|
306
|
+
workloadNameMsa: valueof string
|
|
307
|
+
);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
namespace MsGraph.Deployment;
|
|
2
|
+
|
|
3
|
+
enum deploymentTargets {
|
|
4
|
+
prodBeta,
|
|
5
|
+
prodV1_0,
|
|
6
|
+
prodEdu,
|
|
7
|
+
ppeBeta,
|
|
8
|
+
ppeV1_0,
|
|
9
|
+
ppeEdu,
|
|
10
|
+
mooncakeBeta,
|
|
11
|
+
mooncakeV1_0,
|
|
12
|
+
fairfaxBeta,
|
|
13
|
+
fairfaxV1_0,
|
|
14
|
+
usNatBeta,
|
|
15
|
+
usNatV1_0,
|
|
16
|
+
usSecBeta,
|
|
17
|
+
usSecV1_0
|
|
18
|
+
}
|
package/lib/lib.tsp
CHANGED
|
@@ -1,35 +1,19 @@
|
|
|
1
1
|
import "../dist/src/index.js";
|
|
2
|
-
import "@typespec/
|
|
2
|
+
import "@typespec/http";
|
|
3
3
|
|
|
4
4
|
using TypeSpec.Http;
|
|
5
|
-
namespace
|
|
5
|
+
namespace MsGraph;
|
|
6
6
|
|
|
7
7
|
scalar date;
|
|
8
8
|
|
|
9
9
|
scalar stream;
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
scalar guid extends string;
|
|
12
12
|
|
|
13
13
|
model EmptyParameters {}
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
// --- Base interfaces for all interfaces that contain operations returning entities.
|
|
16
16
|
|
|
17
|
-
interface
|
|
18
|
-
@head _isOperation(@path id: string): T;
|
|
19
|
-
}
|
|
17
|
+
interface Resource<T> {}
|
|
20
18
|
|
|
21
|
-
interface
|
|
22
|
-
@head _isOperation(): T[];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface Singleton<T> {
|
|
26
|
-
@head _isNavigationSource(@path id: string): T;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
interface EntitySet<T> {
|
|
30
|
-
@head _isNavigationSource(): T[];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
interface EntitySetResource<T> {
|
|
34
|
-
@head _isNavigationSource(@path id: string): T[];
|
|
35
|
-
}
|
|
19
|
+
interface Collection<T> {}
|
package/lib/msgraph.tsp
CHANGED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// -------------------------------------------------
|
|
2
|
+
// porcelain.tsp
|
|
3
|
+
// Operation templates to provide a much-simplified syntax for defining standard Graph operations.
|
|
4
|
+
// -------------------------------------------------
|
|
5
|
+
import "@typespec/http";
|
|
6
|
+
import "./lib.tsp";
|
|
7
|
+
import "./shared-models.tsp";
|
|
8
|
+
import "./responses.tsp";
|
|
9
|
+
|
|
10
|
+
using TypeSpec.Http;
|
|
11
|
+
using MsGraph;
|
|
12
|
+
using MsGraph.SharedModels;
|
|
13
|
+
using MsGraph.Responses;
|
|
14
|
+
|
|
15
|
+
namespace MsGraph;
|
|
16
|
+
|
|
17
|
+
namespace Foundations {
|
|
18
|
+
|
|
19
|
+
@doc("Foundational operations for individual resources and collections.")
|
|
20
|
+
interface GraphFoundations {
|
|
21
|
+
op Operation<TParams, TResponse, TErrorResponse>(
|
|
22
|
+
...TParams
|
|
23
|
+
): TResponse | TErrorResponse;
|
|
24
|
+
|
|
25
|
+
op ResourceOperation<
|
|
26
|
+
TResource extends {},
|
|
27
|
+
TParams,
|
|
28
|
+
TResponse,
|
|
29
|
+
TErrorResponse = ResourceErrorResponse
|
|
30
|
+
> is GraphFoundations.Operation<TParams, TResponse, TErrorResponse>;
|
|
31
|
+
|
|
32
|
+
op CollectionOperation<
|
|
33
|
+
TResource extends {},
|
|
34
|
+
TParams,
|
|
35
|
+
TResponse,
|
|
36
|
+
TErrorResponse = CollectionErrorResponse
|
|
37
|
+
> is GraphFoundations.Operation<TParams, TResponse, TErrorResponse>;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@doc("Primary operation shapes for Microsoft Graph")
|
|
42
|
+
interface GraphOps {
|
|
43
|
+
|
|
44
|
+
// TODO: This is how we should make $select standard for Graph. Define a select decorator and use it here.
|
|
45
|
+
// @select("*")
|
|
46
|
+
@get op GetCollection<
|
|
47
|
+
TResource extends {} = Automatic.CalculatedResourceType,
|
|
48
|
+
TParams = {... Automatic.GraphRouteParams},
|
|
49
|
+
TResponse = CollectionResponse<TResource>,
|
|
50
|
+
TErrorResponse = CollectionErrorResponse
|
|
51
|
+
> is Foundations.GraphFoundations.CollectionOperation<
|
|
52
|
+
TResource, TParams, TResponse, TErrorResponse>;
|
|
53
|
+
|
|
54
|
+
// @select("*")
|
|
55
|
+
@get op GetPagedCollection<
|
|
56
|
+
TResource extends {} = Automatic.CalculatedResourceType,
|
|
57
|
+
TParams = {... Automatic.GraphRouteParams},
|
|
58
|
+
TResponse = PagedCollectionResponse<TResource>,
|
|
59
|
+
TErrorResponse = CollectionErrorResponse
|
|
60
|
+
> is Foundations.GraphFoundations.CollectionOperation<
|
|
61
|
+
TResource, TParams, TResponse, TErrorResponse>;
|
|
62
|
+
|
|
63
|
+
// TODO: GetDelta? FUnction etc.?
|
|
64
|
+
|
|
65
|
+
// @select("*")
|
|
66
|
+
@post op Post<
|
|
67
|
+
TResource extends {} = Automatic.CalculatedResourceType,
|
|
68
|
+
TParams = { ... Automatic.GraphRouteParams, @body body: TResource },
|
|
69
|
+
TResponse = ResourceCreatedResponse<TResource>,
|
|
70
|
+
TErrorResponse = CollectionErrorResponse
|
|
71
|
+
> is Foundations.GraphFoundations.CollectionOperation<
|
|
72
|
+
TResource, TParams, TResponse, TErrorResponse>;
|
|
73
|
+
|
|
74
|
+
// @select("*")
|
|
75
|
+
@get op GetResource<
|
|
76
|
+
TResource extends {} = Automatic.CalculatedResourceType,
|
|
77
|
+
TParams = {... Automatic.GraphRouteParams},
|
|
78
|
+
TResponse = ResourceResponse<TResource>,
|
|
79
|
+
TErrorResponse = ResourceErrorResponse
|
|
80
|
+
> is Foundations.GraphFoundations.ResourceOperation<
|
|
81
|
+
TResource, TParams, TResponse, TErrorResponse>;
|
|
82
|
+
|
|
83
|
+
@delete op Delete<
|
|
84
|
+
TResource extends {} = Automatic.CalculatedResourceType,
|
|
85
|
+
TParams = {... Automatic.GraphRouteParams},
|
|
86
|
+
TResponse = EmptyResponse,
|
|
87
|
+
TErrorResponse = ResourceErrorResponse
|
|
88
|
+
> is Foundations.GraphFoundations.ResourceOperation<
|
|
89
|
+
TResource, TParams, TResponse, TErrorResponse>;
|
|
90
|
+
|
|
91
|
+
@patch op PatchNoResponse<
|
|
92
|
+
TResource extends {} = Automatic.CalculatedResourceType,
|
|
93
|
+
TParams = {... Automatic.GraphRouteParams},
|
|
94
|
+
TResponse = EmptyResponse,
|
|
95
|
+
TErrorResponse = ResourceErrorResponse
|
|
96
|
+
> is Foundations.GraphFoundations.ResourceOperation<
|
|
97
|
+
TResource, TParams, TResponse, TErrorResponse>;
|
|
98
|
+
|
|
99
|
+
// @select("*")
|
|
100
|
+
@patch op PatchWithResponse<
|
|
101
|
+
TResource extends {} = Automatic.CalculatedResourceType,
|
|
102
|
+
TParams = {... Automatic.GraphRouteParams},
|
|
103
|
+
TResponse = ResourceResponse<TResource>,
|
|
104
|
+
TErrorResponse = ResourceErrorResponse
|
|
105
|
+
> is Foundations.GraphFoundations.ResourceOperation<
|
|
106
|
+
TResource, TParams, TResponse, TErrorResponse>;
|
|
107
|
+
|
|
108
|
+
@put op PutNoResponse<
|
|
109
|
+
TResource extends {} = Automatic.CalculatedResourceType,
|
|
110
|
+
TParams = {... Automatic.GraphRouteParams},
|
|
111
|
+
TResponse = EmptyResponse,
|
|
112
|
+
TErrorResponse = ResourceErrorResponse
|
|
113
|
+
> is Foundations.GraphFoundations.ResourceOperation<
|
|
114
|
+
TResource, TParams, TResponse, TErrorResponse>;
|
|
115
|
+
|
|
116
|
+
// @select("*")
|
|
117
|
+
@put op PutWithResponse<
|
|
118
|
+
TResource extends {} = Automatic.CalculatedResourceType,
|
|
119
|
+
TParams = {... Automatic.GraphRouteParams},
|
|
120
|
+
TResponse = ResourceResponse<TResource>,
|
|
121
|
+
TErrorResponse = ResourceErrorResponse
|
|
122
|
+
> is Foundations.GraphFoundations.ResourceOperation<
|
|
123
|
+
TResource, TParams, TResponse, TErrorResponse>;
|
|
124
|
+
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
namespace Automatic {
|
|
128
|
+
@doc("Marker type to allow injection of parameters from @route decorator.")
|
|
129
|
+
model GraphRouteParams { graphRouteParams: string }
|
|
130
|
+
|
|
131
|
+
// TODO: Needs direct support in the graphRoute decorator code to be able to make use of this.
|
|
132
|
+
@doc("Marker type to indicate to emitter that it should calculate resource from the Resource type of the containing interface's extended interface.")
|
|
133
|
+
model CalculatedResourceType {}
|
|
134
|
+
}
|
|
135
|
+
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// -------------------------------------------------
|
|
2
|
+
// responses.tsp
|
|
3
|
+
// Standard responses that Graph will return.
|
|
4
|
+
// -------------------------------------------------
|
|
5
|
+
import "@typespec/http";
|
|
6
|
+
import "@microsoft/typespec-msgraph";
|
|
7
|
+
import "./shared-models.tsp";
|
|
8
|
+
|
|
9
|
+
using TypeSpec.Http;
|
|
10
|
+
using MsGraph;
|
|
11
|
+
using MsGraph.SharedModels;
|
|
12
|
+
|
|
13
|
+
// Raw body models represent the content of the response body, without any additional metadata.
|
|
14
|
+
// Note that these are primarily marker types. CSDL has no notion of what actual body content is returned in such types,
|
|
15
|
+
// but by passing markers through, HIDI can translate to OpenAPI.
|
|
16
|
+
// The content of the types exists for other future emitters that run directly off TypeSpec.
|
|
17
|
+
namespace MsGraph.Responses.Bodies {
|
|
18
|
+
|
|
19
|
+
@error
|
|
20
|
+
model ErrorBody {
|
|
21
|
+
error: publicError;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
model ResourceBody<TResource> {
|
|
25
|
+
...TResource;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
model CollectionBody<TResource> {
|
|
29
|
+
value: TResource[];
|
|
30
|
+
`@odata.count`?: int64;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@pagedCollection
|
|
34
|
+
model PagedCollectionBody<TResource> is CollectionBody<TResource> {
|
|
35
|
+
`@odata.nextLink`?: MsGraph.SharedModels.url;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@pagedCollection
|
|
39
|
+
@deltaCollection
|
|
40
|
+
model DeltaCollectionBody<TResource> is PagedCollectionBody<TResource> {
|
|
41
|
+
`@odata.deltaLink`?: MsGraph.SharedModels.url;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Response models represent the response as a whole, including the status code, headers, and body.
|
|
46
|
+
namespace MsGraph.Responses {
|
|
47
|
+
@doc("Response to represent a Microsoft Graph collection response payload.")
|
|
48
|
+
model CollectionResponse<TResource, TStatus = 200, TBody = Bodies.CollectionBody<TResource>>
|
|
49
|
+
is Http.Response<TStatus> {
|
|
50
|
+
...Http.Body<TBody>;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@doc("Response to represent a Microsoft Graph paged collection response payload.")
|
|
54
|
+
model PagedCollectionResponse<TResource, TStatus = 200, TBody = Bodies.PagedCollectionBody<TResource>>
|
|
55
|
+
is CollectionResponse<TResource, TStatus, TBody>;
|
|
56
|
+
|
|
57
|
+
@doc("Response to represent a Microsoft Graph individual resource response payload.")
|
|
58
|
+
model ResourceResponse<TResource, TStatus = 200, TBody = Bodies.ResourceBody<TResource>>
|
|
59
|
+
is Http.Response<TStatus> {
|
|
60
|
+
...Http.Body<TBody>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@doc("Response to represent a Microsoft Graph resource creation response payload.")
|
|
64
|
+
model ResourceCreatedResponse<TResource, TStatus = 201, TBody = Bodies.ResourceBody<TResource>>
|
|
65
|
+
is ResourceResponse<TResource, TStatus, TBody> {
|
|
66
|
+
...Http.LocationHeader
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@doc("Response to represent a Microsoft Graph empty response payload.")
|
|
70
|
+
model EmptyResponse
|
|
71
|
+
is Http.Response<204>;
|
|
72
|
+
|
|
73
|
+
@doc("Response to represent a Microsoft Graph error response payload.")
|
|
74
|
+
model ErrorResponse<TStatus>
|
|
75
|
+
is Http.Response<TStatus> {
|
|
76
|
+
...Http.Body<Bodies.ErrorBody>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
alias ResourceErrorResponse = ErrorResponse<400 | 404 | 429>;
|
|
80
|
+
alias CollectionErrorResponse = ErrorResponse<400 | 429>;
|
|
81
|
+
|
|
82
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// -------------------------------------------------
|
|
2
|
+
// shared-models.tsp
|
|
3
|
+
// Common types shared among many workloads on Microsoft Graph
|
|
4
|
+
// -------------------------------------------------
|
|
5
|
+
import "@microsoft/typespec-msgraph";
|
|
6
|
+
|
|
7
|
+
using MsGraph;
|
|
8
|
+
|
|
9
|
+
@publicNamespace("microsoft.graph")
|
|
10
|
+
namespace MsGraph.SharedModels;
|
|
11
|
+
|
|
12
|
+
// TODO: Spec how to deal with specified and unspecified ultimate base entities w.r.t. AGS runtime replacement policies. See #140
|
|
13
|
+
@doc("The primary entity base model for Microsoft Graph.")
|
|
14
|
+
@entity
|
|
15
|
+
model entity {
|
|
16
|
+
@key id: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@doc("Complex type to represent an identity principal by id, when a human-readable name is also useful.")
|
|
20
|
+
@complex
|
|
21
|
+
@open
|
|
22
|
+
model identity {
|
|
23
|
+
id: string;
|
|
24
|
+
displayName: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@doc("Complex type to represent a group of identity principals used at a point in time, such as createdBy, lastModifiedBy.")
|
|
28
|
+
@complex
|
|
29
|
+
@open
|
|
30
|
+
model identitySet {
|
|
31
|
+
user: identity | null;
|
|
32
|
+
device: identity | null;
|
|
33
|
+
application: identity | null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@doc("Enum for identifying the format of a text string.")
|
|
37
|
+
enum bodyType {
|
|
38
|
+
text,
|
|
39
|
+
html
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@doc("Complex type to represent a chunk of text that could be either plain text or html.")
|
|
43
|
+
@complex
|
|
44
|
+
model itemBody {
|
|
45
|
+
contentType: bodyType;
|
|
46
|
+
content: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@doc("Scalar type for URLs that would be expected to work in the browser address bar.")
|
|
50
|
+
scalar webUrl extends string;
|
|
51
|
+
|
|
52
|
+
@doc("Scalar type for URLs that represent Graph APIs.")
|
|
53
|
+
scalar url extends string;
|
|
54
|
+
|
|
55
|
+
@doc("Complex type to represent a nested error that potentially has other recursive nested errors.")
|
|
56
|
+
@complex
|
|
57
|
+
@open
|
|
58
|
+
model innerError {
|
|
59
|
+
code: string;
|
|
60
|
+
innererror: innerError | null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@doc("""
|
|
64
|
+
Complex type to represent a standard Microsoft Graph error.
|
|
65
|
+
{code}: The error code.
|
|
66
|
+
""")
|
|
67
|
+
@complex
|
|
68
|
+
@error
|
|
69
|
+
model publicError {
|
|
70
|
+
code: string;
|
|
71
|
+
message: string;
|
|
72
|
+
target: string | null;
|
|
73
|
+
innererror: innerError | null;
|
|
74
|
+
details: publicError[];
|
|
75
|
+
}
|