@microsoft/typespec-msgraph 0.0.1-Preview.2 → 0.0.1-Preview.21
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 +9 -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 +84 -0
- package/dist/src/components/annotations.js.map +1 -0
- package/dist/src/components/common-elements.d.ts +16 -74
- 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/delta-annotation.d.ts +6 -0
- package/dist/src/components/delta-annotation.d.ts.map +1 -0
- package/dist/src/components/delta-annotation.js +18 -0
- package/dist/src/components/delta-annotation.js.map +1 -0
- 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 +32 -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 +20 -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/is-url-annotation.d.ts +5 -0
- package/dist/src/components/is-url-annotation.d.ts.map +1 -0
- package/dist/src/components/is-url-annotation.js +6 -0
- package/dist/src/components/is-url-annotation.js.map +1 -0
- package/dist/src/components/open-property-type-constraint-annotation-element.d.ts +5 -0
- package/dist/src/components/open-property-type-constraint-annotation-element.d.ts.map +1 -0
- package/dist/src/components/open-property-type-constraint-annotation-element.js +7 -0
- package/dist/src/components/open-property-type-constraint-annotation-element.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 +83 -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 +20 -32
- package/dist/src/components/property-element.js.map +1 -1
- package/dist/src/components/reference-target-element.d.ts +9 -0
- package/dist/src/components/reference-target-element.d.ts.map +1 -0
- package/dist/src/components/reference-target-element.js +3 -0
- package/dist/src/components/reference-target-element.js.map +1 -0
- 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 +8 -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 +47 -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/select-supported-annotation.d.ts +5 -0
- package/dist/src/components/select-supported-annotation.d.ts.map +1 -0
- package/dist/src/components/select-supported-annotation.js +6 -0
- package/dist/src/components/select-supported-annotation.js.map +1 -0
- 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 +26 -66
- package/dist/src/components/structured-type-element.js.map +1 -1
- package/dist/src/components/term-element.d.ts +9 -0
- package/dist/src/components/term-element.d.ts.map +1 -0
- package/dist/src/components/term-element.js +8 -0
- package/dist/src/components/term-element.js.map +1 -0
- 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 +6 -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 +2 -0
- package/dist/src/decorators/abstract.d.ts.map +1 -1
- package/dist/src/decorators/abstract.js +2 -6
- package/dist/src/decorators/abstract.js.map +1 -1
- package/dist/src/decorators/action.d.ts +12 -0
- package/dist/src/decorators/action.d.ts.map +1 -0
- package/dist/src/decorators/action.js +18 -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} +5 -1
- package/dist/src/decorators/additional-query-parameters.d.ts.map +1 -0
- package/dist/src/decorators/additional-query-parameters.js +23 -0
- package/dist/src/decorators/additional-query-parameters.js.map +1 -0
- package/dist/src/decorators/address-url-msa.d.ts +14 -0
- package/dist/src/decorators/address-url-msa.d.ts.map +1 -0
- package/dist/src/decorators/address-url-msa.js +21 -0
- package/dist/src/decorators/address-url-msa.js.map +1 -0
- package/dist/src/decorators/address-url.d.ts +18 -0
- package/dist/src/decorators/address-url.d.ts.map +1 -0
- package/dist/src/decorators/address-url.js +21 -0
- package/dist/src/decorators/address-url.js.map +1 -0
- package/dist/src/decorators/ags-attribute.d.ts +17 -0
- package/dist/src/decorators/ags-attribute.d.ts.map +1 -0
- package/dist/src/decorators/ags-attribute.js +156 -0
- package/dist/src/decorators/ags-attribute.js.map +1 -0
- package/dist/src/decorators/allowed-values.d.ts +15 -0
- package/dist/src/decorators/allowed-values.d.ts.map +1 -0
- package/dist/src/decorators/allowed-values.js +37 -0
- package/dist/src/decorators/allowed-values.js.map +1 -0
- package/dist/src/decorators/complex.d.ts +2 -0
- package/dist/src/decorators/complex.d.ts.map +1 -1
- package/dist/src/decorators/complex.js +2 -6
- package/dist/src/decorators/complex.js.map +1 -1
- package/dist/src/decorators/computed.d.ts +2 -0
- package/dist/src/decorators/computed.d.ts.map +1 -1
- package/dist/src/decorators/computed.js +2 -0
- package/dist/src/decorators/computed.js.map +1 -1
- package/dist/src/decorators/contains.d.ts +2 -0
- package/dist/src/decorators/contains.d.ts.map +1 -1
- package/dist/src/decorators/contains.js +2 -0
- package/dist/src/decorators/contains.js.map +1 -1
- package/dist/src/decorators/count.d.ts +2 -0
- package/dist/src/decorators/count.d.ts.map +1 -1
- package/dist/src/decorators/count.js +2 -0
- package/dist/src/decorators/count.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/delta.d.ts +10 -0
- package/dist/src/decorators/delta.d.ts.map +1 -0
- package/dist/src/decorators/delta.js +14 -0
- package/dist/src/decorators/delta.js.map +1 -0
- package/dist/src/decorators/deprecated-definition.d.ts +2 -0
- package/dist/src/decorators/deprecated-definition.d.ts.map +1 -1
- package/dist/src/decorators/deprecated-definition.js.map +1 -1
- package/dist/src/decorators/entity.d.ts +2 -0
- package/dist/src/decorators/entity.d.ts.map +1 -1
- package/dist/src/decorators/entity.js +2 -6
- package/dist/src/decorators/entity.js.map +1 -1
- package/dist/src/decorators/expand.d.ts +3 -0
- package/dist/src/decorators/expand.d.ts.map +1 -1
- package/dist/src/decorators/expand.js +7 -1
- package/dist/src/decorators/expand.js.map +1 -1
- package/dist/src/decorators/experimental.d.ts +11 -0
- package/dist/src/decorators/experimental.d.ts.map +1 -0
- package/dist/src/decorators/experimental.js +15 -0
- package/dist/src/decorators/experimental.js.map +1 -0
- package/dist/src/decorators/filter.d.ts +13 -0
- package/dist/src/decorators/filter.d.ts.map +1 -0
- package/dist/src/decorators/filter.js +29 -0
- package/dist/src/decorators/filter.js.map +1 -0
- package/dist/src/decorators/flags.d.ts +11 -0
- package/dist/src/decorators/flags.d.ts.map +1 -0
- package/dist/src/decorators/flags.js +15 -0
- package/dist/src/decorators/flags.js.map +1 -0
- package/dist/src/decorators/function.d.ts +17 -0
- package/dist/src/decorators/function.d.ts.map +1 -0
- package/dist/src/decorators/function.js +21 -0
- package/dist/src/decorators/function.js.map +1 -0
- package/dist/src/decorators/global-operation.d.ts +11 -0
- package/dist/src/decorators/global-operation.d.ts.map +1 -0
- package/dist/src/decorators/global-operation.js +15 -0
- package/dist/src/decorators/global-operation.js.map +1 -0
- package/dist/src/decorators/graph-deprecated.d.ts +13 -0
- package/dist/src/decorators/graph-deprecated.d.ts.map +1 -0
- package/dist/src/decorators/graph-deprecated.js +21 -0
- package/dist/src/decorators/graph-deprecated.js.map +1 -0
- package/dist/src/decorators/graph-route.d.ts +20 -0
- package/dist/src/decorators/graph-route.d.ts.map +1 -0
- package/dist/src/decorators/graph-route.js +141 -0
- package/dist/src/decorators/graph-route.js.map +1 -0
- package/dist/src/decorators/immutable.d.ts +10 -0
- package/dist/src/decorators/immutable.d.ts.map +1 -0
- package/dist/src/decorators/immutable.js +14 -0
- package/dist/src/decorators/immutable.js.map +1 -0
- package/dist/src/decorators/index.d.ts +35 -1
- package/dist/src/decorators/index.d.ts.map +1 -1
- package/dist/src/decorators/index.js +35 -1
- package/dist/src/decorators/index.js.map +1 -1
- package/dist/src/decorators/is-owner.d.ts +12 -0
- package/dist/src/decorators/is-owner.d.ts.map +1 -0
- package/dist/src/decorators/is-owner.js +19 -0
- package/dist/src/decorators/is-owner.js.map +1 -0
- package/dist/src/decorators/limited-charset.d.ts +11 -0
- package/dist/src/decorators/limited-charset.d.ts.map +1 -0
- package/dist/src/decorators/limited-charset.js +15 -0
- package/dist/src/decorators/limited-charset.js.map +1 -0
- package/dist/src/decorators/media.d.ts +12 -0
- package/dist/src/decorators/media.d.ts.map +1 -0
- package/dist/src/decorators/media.js +18 -0
- package/dist/src/decorators/media.js.map +1 -0
- package/dist/src/decorators/open.d.ts +2 -0
- package/dist/src/decorators/open.d.ts.map +1 -1
- package/dist/src/decorators/open.js +2 -6
- package/dist/src/decorators/open.js.map +1 -1
- package/dist/src/decorators/{routed-interfaces.d.ts → operation-parameters.d.ts} +5 -11
- package/dist/src/decorators/operation-parameters.d.ts.map +1 -0
- package/dist/src/decorators/operation-parameters.js +17 -0
- package/dist/src/decorators/operation-parameters.js.map +1 -0
- package/dist/src/decorators/order-by.d.ts +2 -0
- package/dist/src/decorators/order-by.d.ts.map +1 -1
- package/dist/src/decorators/order-by.js +2 -0
- package/dist/src/decorators/order-by.js.map +1 -1
- package/dist/src/decorators/ownerless.d.ts +10 -0
- package/dist/src/decorators/ownerless.d.ts.map +1 -0
- package/dist/src/decorators/ownerless.js +14 -0
- package/dist/src/decorators/ownerless.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 +12 -0
- package/dist/src/decorators/partial.d.ts.map +1 -0
- package/dist/src/decorators/partial.js +18 -0
- package/dist/src/decorators/partial.js.map +1 -0
- package/dist/src/decorators/passthrough-address-url-msa.d.ts +13 -0
- package/dist/src/decorators/passthrough-address-url-msa.d.ts.map +1 -0
- package/dist/src/decorators/passthrough-address-url-msa.js +19 -0
- package/dist/src/decorators/passthrough-address-url-msa.js.map +1 -0
- package/dist/src/decorators/passthrough-address-url.d.ts +13 -0
- package/dist/src/decorators/passthrough-address-url.d.ts.map +1 -0
- package/dist/src/decorators/passthrough-address-url.js +19 -0
- package/dist/src/decorators/passthrough-address-url.js.map +1 -0
- package/dist/src/decorators/private-preview-definition.d.ts +2 -0
- package/dist/src/decorators/private-preview-definition.d.ts.map +1 -1
- package/dist/src/decorators/private-preview-definition.js +2 -0
- package/dist/src/decorators/private-preview-definition.js.map +1 -1
- package/dist/src/decorators/private-preview.d.ts +4 -2
- package/dist/src/decorators/private-preview.d.ts.map +1 -1
- package/dist/src/decorators/private-preview.js +2 -10
- package/dist/src/decorators/private-preview.js.map +1 -1
- package/dist/src/decorators/privileged.d.ts +11 -0
- package/dist/src/decorators/privileged.d.ts.map +1 -0
- package/dist/src/decorators/privileged.js +15 -0
- package/dist/src/decorators/privileged.js.map +1 -0
- package/dist/src/decorators/public-namespace.d.ts +12 -0
- package/dist/src/decorators/public-namespace.d.ts.map +1 -0
- package/dist/src/decorators/public-namespace.js +21 -0
- package/dist/src/decorators/public-namespace.js.map +1 -0
- package/dist/src/decorators/read-only.d.ts +2 -0
- package/dist/src/decorators/read-only.d.ts.map +1 -1
- package/dist/src/decorators/read-only.js +2 -0
- package/dist/src/decorators/read-only.js.map +1 -1
- package/dist/src/decorators/reference-target.d.ts +17 -0
- package/dist/src/decorators/reference-target.d.ts.map +1 -0
- package/dist/src/decorators/reference-target.js +59 -0
- package/dist/src/decorators/reference-target.js.map +1 -0
- package/dist/src/decorators/references.d.ts +2 -0
- package/dist/src/decorators/references.d.ts.map +1 -1
- package/dist/src/decorators/references.js +2 -0
- package/dist/src/decorators/references.js.map +1 -1
- package/dist/src/decorators/required-for-create.d.ts +12 -0
- package/dist/src/decorators/required-for-create.d.ts.map +1 -0
- package/dist/src/decorators/required-for-create.js +16 -0
- package/dist/src/decorators/required-for-create.js.map +1 -0
- package/dist/src/decorators/return-source.d.ts +11 -0
- package/dist/src/decorators/return-source.d.ts.map +1 -0
- package/dist/src/decorators/return-source.js +28 -0
- package/dist/src/decorators/return-source.js.map +1 -0
- package/dist/src/decorators/search.d.ts +2 -0
- package/dist/src/decorators/search.d.ts.map +1 -1
- package/dist/src/decorators/search.js +2 -0
- package/dist/src/decorators/search.js.map +1 -1
- package/dist/src/decorators/select.d.ts +11 -0
- package/dist/src/decorators/select.d.ts.map +1 -0
- package/dist/src/decorators/select.js +15 -0
- package/dist/src/decorators/select.js.map +1 -0
- package/dist/src/decorators/skip.d.ts +2 -0
- package/dist/src/decorators/skip.d.ts.map +1 -1
- package/dist/src/decorators/skip.js +2 -0
- package/dist/src/decorators/skip.js.map +1 -1
- package/dist/src/decorators/term.d.ts +13 -0
- package/dist/src/decorators/term.d.ts.map +1 -0
- package/dist/src/decorators/term.js +14 -0
- package/dist/src/decorators/term.js.map +1 -0
- package/dist/src/decorators/top.d.ts +2 -0
- package/dist/src/decorators/top.d.ts.map +1 -1
- package/dist/src/decorators/top.js +2 -0
- package/dist/src/decorators/top.js.map +1 -1
- package/dist/src/decorators/workload-name-msa.d.ts +11 -0
- package/dist/src/decorators/workload-name-msa.d.ts.map +1 -0
- package/dist/src/decorators/workload-name-msa.js +15 -0
- package/dist/src/decorators/workload-name-msa.js.map +1 -0
- package/dist/src/decorators/workload-name.d.ts +11 -0
- package/dist/src/decorators/workload-name.d.ts.map +1 -0
- package/dist/src/decorators/workload-name.js +15 -0
- package/dist/src/decorators/workload-name.js.map +1 -0
- package/dist/src/decorators/workload-namespace.d.ts +12 -0
- package/dist/src/decorators/workload-namespace.d.ts.map +1 -0
- package/dist/src/decorators/workload-namespace.js +21 -0
- package/dist/src/decorators/workload-namespace.js.map +1 -0
- package/dist/src/decorators/write-only.d.ts +2 -0
- package/dist/src/decorators/write-only.d.ts.map +1 -1
- package/dist/src/decorators/write-only.js +2 -0
- package/dist/src/decorators/write-only.js.map +1 -1
- package/dist/src/dom/error-interceptor.d.ts +2 -0
- package/dist/src/dom/error-interceptor.d.ts.map +1 -0
- package/dist/src/dom/error-interceptor.js +13 -0
- package/dist/src/dom/error-interceptor.js.map +1 -0
- package/dist/src/dom/reconciler.js.map +1 -1
- package/dist/src/dom/renderer.d.ts +1 -0
- package/dist/src/dom/renderer.d.ts.map +1 -1
- package/dist/src/dom/renderer.js +1 -0
- package/dist/src/dom/renderer.js.map +1 -1
- package/dist/src/emitter.d.ts +2 -1
- package/dist/src/emitter.d.ts.map +1 -1
- package/dist/src/emitter.js +28 -3
- package/dist/src/emitter.js.map +1 -1
- package/dist/src/entities/address-url.d.ts +8 -0
- package/dist/src/entities/address-url.d.ts.map +1 -0
- package/dist/src/entities/address-url.js +47 -0
- package/dist/src/entities/address-url.js.map +1 -0
- package/dist/src/entities/annotations.d.ts +48 -0
- package/dist/src/entities/annotations.d.ts.map +1 -0
- package/dist/src/entities/annotations.js +166 -0
- package/dist/src/entities/annotations.js.map +1 -0
- package/dist/src/entities/entity-container.d.ts +36 -0
- package/dist/src/entities/entity-container.d.ts.map +1 -0
- package/dist/src/entities/entity-container.js +59 -0
- package/dist/src/entities/entity-container.js.map +1 -0
- package/dist/src/entities/enum.d.ts +19 -0
- package/dist/src/entities/enum.d.ts.map +1 -0
- package/dist/src/entities/enum.js +27 -0
- package/dist/src/entities/enum.js.map +1 -0
- package/dist/src/entities/model.d.ts +63 -0
- package/dist/src/entities/model.d.ts.map +1 -0
- package/dist/src/entities/model.js +273 -0
- package/dist/src/entities/model.js.map +1 -0
- package/dist/src/entities/ms-graph-route.d.ts +13 -0
- package/dist/src/entities/ms-graph-route.d.ts.map +1 -0
- package/dist/src/entities/ms-graph-route.js +67 -0
- package/dist/src/entities/ms-graph-route.js.map +1 -0
- package/dist/src/entities/namespace.d.ts +40 -0
- package/dist/src/entities/namespace.d.ts.map +1 -0
- package/dist/src/entities/namespace.js +351 -0
- package/dist/src/entities/namespace.js.map +1 -0
- package/dist/src/entities/operation.d.ts +41 -0
- package/dist/src/entities/operation.d.ts.map +1 -0
- package/dist/src/entities/operation.js +202 -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 +10 -0
- package/dist/src/entities/revision-definition.d.ts.map +1 -0
- package/dist/src/entities/revision-definition.js +53 -0
- package/dist/src/entities/revision-definition.js.map +1 -0
- package/dist/src/entities/term.d.ts +8 -0
- package/dist/src/entities/term.d.ts.map +1 -0
- package/dist/src/entities/term.js +14 -0
- package/dist/src/entities/term.js.map +1 -0
- package/dist/src/index.d.ts +1 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts +132 -106
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +72 -10
- package/dist/src/lib.js.map +1 -1
- package/dist/src/linter.d.ts +1 -2
- package/dist/src/linter.d.ts.map +1 -1
- package/dist/src/linter.js +23 -34
- 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/address-url.d.ts +19 -0
- package/dist/src/rules/address-url.d.ts.map +1 -0
- package/dist/src/rules/address-url.js +161 -0
- package/dist/src/rules/address-url.js.map +1 -0
- package/dist/src/rules/allowed-values.d.ts +7 -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/alternate-key.d.ts +4 -3
- package/dist/src/rules/alternate-key.d.ts.map +1 -1
- package/dist/src/rules/alternate-key.js +23 -23
- package/dist/src/rules/alternate-key.js.map +1 -1
- package/dist/src/rules/collection-navigation-properties-not-nullable.d.ts +3 -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/complex.d.ts +3 -0
- package/dist/src/rules/complex.d.ts.map +1 -0
- package/dist/src/rules/complex.js +27 -0
- package/dist/src/rules/complex.js.map +1 -0
- package/dist/src/rules/computed.d.ts +2 -3
- package/dist/src/rules/computed.d.ts.map +1 -1
- package/dist/src/rules/computed.js +14 -16
- package/dist/src/rules/computed.js.map +1 -1
- package/dist/src/rules/contains.d.ts +2 -1
- package/dist/src/rules/contains.d.ts.map +1 -1
- package/dist/src/rules/contains.js +9 -8
- package/dist/src/rules/contains.js.map +1 -1
- package/dist/src/rules/count.d.ts +2 -1
- package/dist/src/rules/count.d.ts.map +1 -1
- package/dist/src/rules/count.js +12 -9
- package/dist/src/rules/count.js.map +1 -1
- package/dist/src/rules/delta.d.ts +8 -0
- package/dist/src/rules/delta.d.ts.map +1 -0
- package/dist/src/rules/delta.js +203 -0
- package/dist/src/rules/delta.js.map +1 -0
- package/dist/src/rules/disallowed-typespec-decorators.d.ts +3 -0
- package/dist/src/rules/disallowed-typespec-decorators.d.ts.map +1 -0
- package/dist/src/rules/disallowed-typespec-decorators.js +37 -0
- package/dist/src/rules/disallowed-typespec-decorators.js.map +1 -0
- package/dist/src/rules/entity.d.ts +6 -1
- package/dist/src/rules/entity.d.ts.map +1 -1
- package/dist/src/rules/entity.js +177 -11
- package/dist/src/rules/entity.js.map +1 -1
- package/dist/src/rules/enum.d.ts +4 -0
- package/dist/src/rules/enum.d.ts.map +1 -0
- package/dist/src/rules/enum.js +29 -0
- package/dist/src/rules/enum.js.map +1 -0
- package/dist/src/rules/expand.d.ts +3 -2
- package/dist/src/rules/expand.d.ts.map +1 -1
- package/dist/src/rules/expand.js +26 -23
- package/dist/src/rules/expand.js.map +1 -1
- package/dist/src/rules/extends-on-same-type.d.ts +3 -0
- package/dist/src/rules/extends-on-same-type.d.ts.map +1 -0
- package/dist/src/rules/extends-on-same-type.js +39 -0
- package/dist/src/rules/extends-on-same-type.js.map +1 -0
- package/dist/src/rules/filter.d.ts +7 -0
- package/dist/src/rules/filter.d.ts.map +1 -0
- package/dist/src/rules/filter.js +160 -0
- package/dist/src/rules/filter.js.map +1 -0
- package/dist/src/rules/function.d.ts +4 -0
- package/dist/src/rules/function.d.ts.map +1 -0
- package/dist/src/rules/function.js +65 -0
- package/dist/src/rules/function.js.map +1 -0
- package/dist/src/rules/global-operation.d.ts +4 -0
- package/dist/src/rules/global-operation.d.ts.map +1 -0
- package/dist/src/rules/global-operation.js +60 -0
- package/dist/src/rules/global-operation.js.map +1 -0
- package/dist/src/rules/graph-deprecated.d.ts +8 -0
- package/dist/src/rules/graph-deprecated.d.ts.map +1 -0
- package/dist/src/rules/graph-deprecated.js +152 -0
- package/dist/src/rules/graph-deprecated.js.map +1 -0
- package/dist/src/rules/graph-route.d.ts +15 -0
- package/dist/src/rules/graph-route.d.ts.map +1 -0
- package/dist/src/rules/graph-route.js +296 -0
- package/dist/src/rules/graph-route.js.map +1 -0
- package/dist/src/rules/index.d.ts +25 -7
- package/dist/src/rules/index.d.ts.map +1 -1
- package/dist/src/rules/index.js +25 -162
- package/dist/src/rules/index.js.map +1 -1
- package/dist/src/rules/limited-charset.d.ts +3 -0
- package/dist/src/rules/limited-charset.d.ts.map +1 -0
- package/dist/src/rules/limited-charset.js +42 -0
- package/dist/src/rules/limited-charset.js.map +1 -0
- package/dist/src/rules/media.d.ts +10 -0
- package/dist/src/rules/media.d.ts.map +1 -0
- package/dist/src/rules/media.js +122 -0
- package/dist/src/rules/media.js.map +1 -0
- package/dist/src/rules/model.d.ts +4 -0
- package/dist/src/rules/model.d.ts.map +1 -0
- package/dist/src/rules/model.js +36 -0
- package/dist/src/rules/model.js.map +1 -0
- package/dist/src/rules/namespace.d.ts +6 -0
- package/dist/src/rules/namespace.d.ts.map +1 -0
- package/dist/src/rules/namespace.js +110 -0
- package/dist/src/rules/namespace.js.map +1 -0
- package/dist/src/rules/open.d.ts +2 -1
- package/dist/src/rules/open.d.ts.map +1 -1
- package/dist/src/rules/open.js +9 -8
- package/dist/src/rules/open.js.map +1 -1
- package/dist/src/rules/operation-inside-interface.d.ts +7 -0
- package/dist/src/rules/operation-inside-interface.d.ts.map +1 -0
- package/dist/src/rules/operation-inside-interface.js +96 -0
- package/dist/src/rules/operation-inside-interface.js.map +1 -0
- package/dist/src/rules/order-by.d.ts +3 -2
- package/dist/src/rules/order-by.d.ts.map +1 -1
- package/dist/src/rules/order-by.js +25 -24
- package/dist/src/rules/order-by.js.map +1 -1
- package/dist/src/rules/ownerless.d.ts +11 -0
- package/dist/src/rules/ownerless.d.ts.map +1 -0
- package/dist/src/rules/ownerless.js +171 -0
- package/dist/src/rules/ownerless.js.map +1 -0
- package/dist/src/rules/partial.d.ts +7 -0
- package/dist/src/rules/partial.d.ts.map +1 -0
- package/dist/src/rules/partial.js +52 -0
- package/dist/src/rules/partial.js.map +1 -0
- package/dist/src/rules/record-t.d.ts +11 -0
- package/dist/src/rules/record-t.d.ts.map +1 -0
- package/dist/src/rules/record-t.js +125 -0
- package/dist/src/rules/record-t.js.map +1 -0
- package/dist/src/rules/reference-target.d.ts +8 -0
- package/dist/src/rules/reference-target.d.ts.map +1 -0
- package/dist/src/rules/reference-target.js +118 -0
- package/dist/src/rules/reference-target.js.map +1 -0
- package/dist/src/rules/references.d.ts +2 -1
- package/dist/src/rules/references.d.ts.map +1 -1
- package/dist/src/rules/references.js +9 -8
- package/dist/src/rules/references.js.map +1 -1
- package/dist/src/rules/required-for-create.d.ts +3 -0
- package/dist/src/rules/required-for-create.d.ts.map +1 -0
- package/dist/src/rules/required-for-create.js +42 -0
- package/dist/src/rules/required-for-create.js.map +1 -0
- package/dist/src/rules/return-source.d.ts +3 -0
- package/dist/src/rules/return-source.d.ts.map +1 -0
- package/dist/src/rules/return-source.js +27 -0
- package/dist/src/rules/return-source.js.map +1 -0
- package/dist/src/rules/search.d.ts +2 -1
- package/dist/src/rules/search.d.ts.map +1 -1
- package/dist/src/rules/search.js +12 -9
- package/dist/src/rules/search.js.map +1 -1
- package/dist/src/rules/skip.d.ts +2 -1
- package/dist/src/rules/skip.d.ts.map +1 -1
- package/dist/src/rules/skip.js +12 -9
- package/dist/src/rules/skip.js.map +1 -1
- package/dist/src/rules/top.d.ts +2 -1
- package/dist/src/rules/top.d.ts.map +1 -1
- package/dist/src/rules/top.js +12 -9
- package/dist/src/rules/top.js.map +1 -1
- package/dist/src/testing/index.d.ts +1 -0
- package/dist/src/testing/index.d.ts.map +1 -1
- package/dist/src/testing/index.js +21 -0
- package/dist/src/testing/index.js.map +1 -1
- package/dist/src/utils.d.ts +75 -2
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +706 -12
- package/dist/src/utils.js.map +1 -1
- package/dist/src/validate.d.ts +3 -0
- package/dist/src/validate.d.ts.map +1 -0
- package/dist/src/validate.js +83 -0
- package/dist/src/validate.js.map +1 -0
- package/lib/bodies.tsp +71 -0
- package/lib/decorators.tsp +350 -40
- package/lib/deployment.tsp +18 -0
- package/lib/lib.tsp +9 -23
- package/lib/msgraph.tsp +5 -0
- package/lib/porcelain.tsp +190 -0
- package/lib/responses.tsp +59 -0
- package/lib/shared-models.tsp +30 -0
- package/package.json +41 -32
- 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/has-stream.d.ts +0 -11
- package/dist/src/decorators/has-stream.d.ts.map +0 -1
- package/dist/src/decorators/has-stream.js +0 -30
- package/dist/src/decorators/has-stream.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/dist/src/rules/has-stream.d.ts +0 -2
- package/dist/src/rules/has-stream.d.ts.map +0 -1
- package/dist/src/rules/has-stream.js +0 -29
- package/dist/src/rules/has-stream.js.map +0 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { navigateTypesInNamespace } from "@typespec/compiler";
|
|
2
|
+
import { getPartialReferenceModel, isComplex, isPartial } from "../index.js";
|
|
3
|
+
import { reportDiagnostic } from "../lib.js";
|
|
4
|
+
import { GetDeclaredNamespaces } from "../entities/namespace.js";
|
|
5
|
+
/**
|
|
6
|
+
* @partial applies to a model.
|
|
7
|
+
*/
|
|
8
|
+
export function validateExtendedModelBaseShouldMatchPartialBaseModel(program) {
|
|
9
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
10
|
+
navigateTypesInNamespace(namespace, {
|
|
11
|
+
model: (model) => {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
if (!isPartial(program, model)) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (!(model === null || model === void 0 ? void 0 : model.baseModel)) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const partialReference = getPartialReferenceModel(program, model);
|
|
20
|
+
if (((_a = partialReference === null || partialReference === void 0 ? void 0 : partialReference.baseModel) === null || _a === void 0 ? void 0 : _a.name) !== ((_b = model === null || model === void 0 ? void 0 : model.baseModel) === null || _b === void 0 ? void 0 : _b.name)) {
|
|
21
|
+
reportDiagnostic(program, {
|
|
22
|
+
code: "decorator-invalid-use",
|
|
23
|
+
target: model,
|
|
24
|
+
messageId: "partial",
|
|
25
|
+
format: {
|
|
26
|
+
decorator: "@partial",
|
|
27
|
+
target: "model",
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
;
|
|
36
|
+
export function validateComplexTypeShouldNotBeDecoratedWithPartial(program) {
|
|
37
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
38
|
+
navigateTypesInNamespace(namespace, {
|
|
39
|
+
model: (model) => {
|
|
40
|
+
if (isComplex(program, model) && isPartial(program, model)) {
|
|
41
|
+
reportDiagnostic(program, {
|
|
42
|
+
code: "decorator-invalid-use",
|
|
43
|
+
target: model,
|
|
44
|
+
messageId: "complexCannotBeDecoratedWithPartial",
|
|
45
|
+
format: {},
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
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AAO;yBAChB;qBACF,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAAA,CAAC;AAEF,MAAM,UAAU,kDAAkD,CAAC,OAAgB;IACjF,KAAK,MAAM,SAAS,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAC,CAAC;QACtD,wBAAwB,CAAC,SAAS,EAAE;YAClC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;gBACf,IAAG,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,EAAC,CAAC;oBACzD,gBAAgB,CAAC,OAAO,EAAE;wBACxB,IAAI,EAAE,uBAAuB;wBAC7B,MAAM,EAAE,KAAK;wBACb,SAAS,EAAE,qCAAqC;wBAChD,MAAM,EAAE,EAAE;qBACX,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC,CAAA;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Program } from "@typespec/compiler";
|
|
2
|
+
export declare function validateRecordsCannotBePrepopulated(program: Program): void;
|
|
3
|
+
export declare function validateRecordTypeCannotBeNull(program: Program): void;
|
|
4
|
+
export declare function validateRecordTypeCannotBeUsedInLine(program: Program): void;
|
|
5
|
+
export declare const useRecordTypeInsteadOfDictionary: import("@typespec/compiler").LinterRuleDefinition<"use-record-type-instead-of-dictionary", {
|
|
6
|
+
readonly default: import("@typespec/compiler").CallableMessage<[]>;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const dictionaryTypeIsMostlyUsedWithRecordType: import("@typespec/compiler").LinterRuleDefinition<"dictionary-type-is-mostly-used-with-record-type", {
|
|
9
|
+
readonly default: import("@typespec/compiler").CallableMessage<[]>;
|
|
10
|
+
}>;
|
|
11
|
+
//# sourceMappingURL=record-t.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-t.d.ts","sourceRoot":"","sources":["../../../src/rules/record-t.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,OAAO,EAA0E,MAAM,oBAAoB,CAAC;AAM5H,wBAAgB,mCAAmC,CAAC,OAAO,EAAE,OAAO,QAyBnE;AAED,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,OAAO,QA4B9D;AAED,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,OAAO,QAiBpE;AAED,eAAO,MAAM,gCAAgC;;EAsB3C,CAAA;AAEF,eAAO,MAAM,wCAAwC;;EAsBnD,CAAA"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { createRule, getLocationContext, navigateTypesInNamespace, paramMessage } from "@typespec/compiler";
|
|
2
|
+
import { reportDiagnostic } from "../lib.js";
|
|
3
|
+
import { GetDeclaredNamespaces } from "../entities/namespace.js";
|
|
4
|
+
import { extractTypesFromUnion, isNullType } from "../utils.js";
|
|
5
|
+
import { isComplex, isEntity } from "../index.js";
|
|
6
|
+
export function validateRecordsCannotBePrepopulated(program) {
|
|
7
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
8
|
+
navigateTypesInNamespace(namespace, {
|
|
9
|
+
model: (model) => {
|
|
10
|
+
var _a;
|
|
11
|
+
if (getLocationContext(program, model).type === "library") {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if ((_a = model.indexer) === null || _a === void 0 ? void 0 : _a.value) {
|
|
15
|
+
if (model.properties.size > 0) {
|
|
16
|
+
const firstProperty = model.properties.values().next().value;
|
|
17
|
+
reportDiagnostic(program, {
|
|
18
|
+
code: "type-invalid-use",
|
|
19
|
+
target: firstProperty,
|
|
20
|
+
messageId: "recordTypeCannotBePrepopulated",
|
|
21
|
+
format: {
|
|
22
|
+
type: model.name
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export function validateRecordTypeCannotBeNull(program) {
|
|
32
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
33
|
+
navigateTypesInNamespace(namespace, {
|
|
34
|
+
model: (model) => {
|
|
35
|
+
var _a;
|
|
36
|
+
if (getLocationContext(program, model).type === "library") {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if ((_a = model.indexer) === null || _a === void 0 ? void 0 : _a.value) {
|
|
40
|
+
const indexer = model.indexer.value;
|
|
41
|
+
if (indexer.kind === "Union") {
|
|
42
|
+
const unionTypes = extractTypesFromUnion(indexer);
|
|
43
|
+
unionTypes.forEach(type => {
|
|
44
|
+
if (isNullType(type)) {
|
|
45
|
+
reportDiagnostic(program, {
|
|
46
|
+
code: "type-invalid-use",
|
|
47
|
+
target: indexer,
|
|
48
|
+
messageId: "recordTypeCannotBeNull",
|
|
49
|
+
format: {
|
|
50
|
+
type: model.name
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export function validateRecordTypeCannotBeUsedInLine(program) {
|
|
62
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
63
|
+
navigateTypesInNamespace(namespace, {
|
|
64
|
+
modelProperty: (property) => {
|
|
65
|
+
if (property.type.name === 'Record') {
|
|
66
|
+
reportDiagnostic(program, {
|
|
67
|
+
code: "type-invalid-use",
|
|
68
|
+
target: property,
|
|
69
|
+
messageId: "recordTypeCannotBeUsedInLine",
|
|
70
|
+
format: {
|
|
71
|
+
type: property.name
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export const useRecordTypeInsteadOfDictionary = createRule({
|
|
80
|
+
name: "use-record-type-instead-of-dictionary",
|
|
81
|
+
severity: "warning",
|
|
82
|
+
description: "Use Record type instead of a self declaration of Dictionary complex type",
|
|
83
|
+
messages: {
|
|
84
|
+
default: paramMessage `Use Record type instead of a self declaration of Dictionary complex type`
|
|
85
|
+
},
|
|
86
|
+
create(context) {
|
|
87
|
+
return {
|
|
88
|
+
model: (model) => {
|
|
89
|
+
if (getLocationContext(context.program, model).type === "library") {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (isComplex(context.program, model) && model.name === "Dictionary") {
|
|
93
|
+
context.reportDiagnostic({
|
|
94
|
+
target: model,
|
|
95
|
+
format: {}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
export const dictionaryTypeIsMostlyUsedWithRecordType = createRule({
|
|
103
|
+
name: "dictionary-type-is-mostly-used-with-record-type",
|
|
104
|
+
severity: "warning",
|
|
105
|
+
description: "Dictionary type is mostly used with Record<T> complex types",
|
|
106
|
+
messages: {
|
|
107
|
+
default: paramMessage `Using Dictionary as an entity model type might clash with a Dictionary complex type that is emitted when there is a Record<T> in the TypeSpec`
|
|
108
|
+
},
|
|
109
|
+
create(context) {
|
|
110
|
+
return {
|
|
111
|
+
model: (model) => {
|
|
112
|
+
if (getLocationContext(context.program, model).type === "library") {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (isEntity(context.program, model) && model.name === "Dictionary") {
|
|
116
|
+
context.reportDiagnostic({
|
|
117
|
+
target: model,
|
|
118
|
+
format: {}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
//# sourceMappingURL=record-t.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-t.js","sourceRoot":"","sources":["../../../src/rules/record-t.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,UAAU,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAA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C;wBACvB,MAAM,EAAE,KAAK;wBACb,MAAM,EAAE,EAAE;qBACX,CAAC,CAAA;gBACJ,CAAC;YACH,CAAC;SACF,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Program } from "@typespec/compiler";
|
|
2
|
+
export declare function validateReferenceTargetInterfaceHasGraphRoutes(program: Program): void;
|
|
3
|
+
export declare function validateReferenceTargetUsedOnlyOnceOnInterface(program: Program): void;
|
|
4
|
+
export declare function validateTargetPathShouldNotHaveParameters(program: Program): void;
|
|
5
|
+
export declare const singletonOrEntitySetHostingBindingsShouldExist: import("@typespec/compiler").LinterRuleDefinition<"singleton-or-entityset-hosting-bindings-should-exist", {
|
|
6
|
+
readonly default: import("@typespec/compiler").CallableMessage<[string, string]>;
|
|
7
|
+
}>;
|
|
8
|
+
//# sourceMappingURL=reference-target.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference-target.d.ts","sourceRoot":"","sources":["../../../src/rules/reference-target.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAsD,MAAM,oBAAoB,CAAC;AAMjG,wBAAgB,8CAA8C,CAAC,OAAO,EAAE,OAAO,QAsB9E;AAED,wBAAgB,8CAA8C,CAAC,OAAO,EAAE,OAAO,QAsB9E;AAED,wBAAgB,yCAAyC,CAAC,OAAO,EAAE,OAAO,QA0BzE;AAED,eAAO,MAAM,8CAA8C;;EAwCzD,CAAA"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { createRule, navigateTypesInNamespace, paramMessage } from "@typespec/compiler";
|
|
2
|
+
import { GetDeclaredNamespaces, GetMsGraphNamespaces } from "../entities/namespace.js";
|
|
3
|
+
import { reportDiagnostic } from "../lib.js";
|
|
4
|
+
import { getGraphRoutePaths, getReferenceTarget, hasReferenceTarget } from "../index.js";
|
|
5
|
+
import { removeRoutePathParams } from "../utils.js";
|
|
6
|
+
export function validateReferenceTargetInterfaceHasGraphRoutes(program) {
|
|
7
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
8
|
+
navigateTypesInNamespace(namespace, {
|
|
9
|
+
interface: ($interface) => {
|
|
10
|
+
if (!hasReferenceTarget(program, $interface)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const decorators = $interface.decorators;
|
|
14
|
+
const hasGraphRoute = decorators === null || decorators === void 0 ? void 0 : decorators.some(d => { var _a; return ((_a = d.definition) === null || _a === void 0 ? void 0 : _a.name) === "@graphRoute"; });
|
|
15
|
+
if (!hasGraphRoute) {
|
|
16
|
+
reportDiagnostic(program, {
|
|
17
|
+
code: "decorator-invalid-use",
|
|
18
|
+
target: $interface,
|
|
19
|
+
messageId: "referenceTargetInterfaceMustHaveGraphRoute",
|
|
20
|
+
format: {
|
|
21
|
+
decorator: "@referenceTarget"
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export function validateReferenceTargetUsedOnlyOnceOnInterface(program) {
|
|
30
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
31
|
+
navigateTypesInNamespace(namespace, {
|
|
32
|
+
interface: ($interface) => {
|
|
33
|
+
if (!hasReferenceTarget(program, $interface)) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const decorators = $interface.decorators;
|
|
37
|
+
const referenceTargetDecorators = decorators === null || decorators === void 0 ? void 0 : decorators.filter(d => { var _a; return ((_a = d.definition) === null || _a === void 0 ? void 0 : _a.name) === "@referenceTarget"; });
|
|
38
|
+
if (referenceTargetDecorators && referenceTargetDecorators.length > 1) {
|
|
39
|
+
reportDiagnostic(program, {
|
|
40
|
+
code: "decorator-invalid-use",
|
|
41
|
+
target: $interface,
|
|
42
|
+
messageId: "referenceTargetMustOnlyBeUsedOnceOnInterface",
|
|
43
|
+
format: {
|
|
44
|
+
decorator: "@referenceTarget"
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export function validateTargetPathShouldNotHaveParameters(program) {
|
|
53
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
54
|
+
navigateTypesInNamespace(namespace, {
|
|
55
|
+
interface: ($interface) => {
|
|
56
|
+
if (!hasReferenceTarget(program, $interface)) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const target = getReferenceTarget(program, $interface);
|
|
60
|
+
const targetParts = target.split("/");
|
|
61
|
+
const targetWithoutRouteParams = removeRoutePathParams(target);
|
|
62
|
+
const targetWithoutRouteParamsParts = targetWithoutRouteParams.split("/");
|
|
63
|
+
if (targetParts.length !== targetWithoutRouteParamsParts.length) {
|
|
64
|
+
reportDiagnostic(program, {
|
|
65
|
+
code: "decorator-invalid-use",
|
|
66
|
+
target: $interface,
|
|
67
|
+
messageId: "referenceTargetPathShouldNotHaveParameters",
|
|
68
|
+
format: {
|
|
69
|
+
decorator: "@referenceTarget",
|
|
70
|
+
target: target
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export const singletonOrEntitySetHostingBindingsShouldExist = createRule({
|
|
79
|
+
name: "singleton-or-entityset-hosting-bindings-should-exist",
|
|
80
|
+
severity: "warning",
|
|
81
|
+
description: "enforce singleton or entityset hosting bindings should exist",
|
|
82
|
+
messages: {
|
|
83
|
+
default: paramMessage `A singleton or entityset definition should exist to bind "${"firstSegment"}" to "${"target"}".`,
|
|
84
|
+
},
|
|
85
|
+
create(context) {
|
|
86
|
+
return {
|
|
87
|
+
interface: ($interface) => {
|
|
88
|
+
if (!hasReferenceTarget(context.program, $interface)) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const graphRoutes = getGraphRoutePaths(context.program, $interface);
|
|
92
|
+
if (graphRoutes) {
|
|
93
|
+
graphRoutes.forEach(graphRoute => {
|
|
94
|
+
const firstSegment = graphRoute.split("/")[0];
|
|
95
|
+
const localNamespace = GetMsGraphNamespaces(context.program).find(namespace => namespace.key !== "library");
|
|
96
|
+
const target = getReferenceTarget(context.program, $interface);
|
|
97
|
+
if (localNamespace) {
|
|
98
|
+
const entitySet = localNamespace.EntitySets.get(firstSegment);
|
|
99
|
+
const singleton = localNamespace.Singletons.get(firstSegment);
|
|
100
|
+
if (entitySet || singleton) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
context.reportDiagnostic({
|
|
104
|
+
target: $interface,
|
|
105
|
+
format: {
|
|
106
|
+
decorator: "@referenceTarget",
|
|
107
|
+
firstSegment: firstSegment,
|
|
108
|
+
target: target
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
//# sourceMappingURL=reference-target.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference-target.js","sourceRoot":"","sources":["../../../src/rules/reference-target.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,UAAU,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACjG,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,UAAU,8CAA8C,CAAC,OAAgB;IAC7E,KAAM,MAAM,SAAS,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAC,CAAC;QACvD,wBAAwB,C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,EAAE,MAAM;iCACf;6BACF,CAAC,CAAA;wBACJ,CAAC;oBACH,CAAC,CAAC,CAAA;gBACJ,CAAC;YAEH,CAAC;SACF,CAAA;IACH,CAAC;CACF,CAAC,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { Program } from "@typespec/compiler";
|
|
1
2
|
/**
|
|
2
3
|
* @references applies to a navigation property.
|
|
3
4
|
*/
|
|
4
|
-
export declare
|
|
5
|
+
export declare function validateReferencesOnlyAppliesToNavigationProperty(program: Program): void;
|
|
5
6
|
//# sourceMappingURL=references.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../../src/rules/references.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../../src/rules/references.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAA4B,MAAM,oBAAoB,CAAC;AAGvE;;GAEG;AACH,wBAAgB,iDAAiD,CAAC,OAAO,EAAE,OAAO,QAwBjF"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { createRule } from "@typespec/lint";
|
|
2
1
|
import { isReferences } from "../index.js";
|
|
3
2
|
import { reportDiagnostic } from "../lib.js";
|
|
4
3
|
import { isNavigationProperty } from "../utils.js";
|
|
4
|
+
import { navigateTypesInNamespace } from "@typespec/compiler";
|
|
5
|
+
import { GetDeclaredNamespaces } from "../entities/namespace.js";
|
|
5
6
|
/**
|
|
6
7
|
* @references applies to a navigation property.
|
|
7
8
|
*/
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return {
|
|
9
|
+
export function validateReferencesOnlyAppliesToNavigationProperty(program) {
|
|
10
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
11
|
+
navigateTypesInNamespace(namespace, {
|
|
12
12
|
modelProperty: (property) => {
|
|
13
13
|
if (!isReferences(program, property)) {
|
|
14
14
|
return;
|
|
@@ -26,7 +26,8 @@ export const referencesOnlyAppliesToNavigationPropertyRule = createRule({
|
|
|
26
26
|
},
|
|
27
27
|
});
|
|
28
28
|
},
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
;
|
|
32
33
|
//# sourceMappingURL=references.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"references.js","sourceRoot":"","sources":["../../../src/rules/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"references.js","sourceRoot":"","sources":["../../../src/rules/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAW,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE;;GAEG;AACH,MAAM,UAAU,iDAAiD,CAAC,OAAgB;IAChF,KAAK,MAAM,SAAS,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAE,CAAC;QACvD,wBAAwB,CAAC,SAAS,EAAE;YAClC,aAAa,EAAE,CAAC,QAAQ,EAAE,EAAE;gBAC1B,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC;oBACrC,OAAO;gBACT,CAAC;gBAED,IAAI,oBAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC;oBAC5C,OAAO;gBACT,CAAC;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,QAAQ;oBAChB,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE;wBACN,SAAS,EAAE,aAAa;wBACxB,MAAM,EAAE,wCAAwC;qBACjD;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAAA,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"required-for-create.d.ts","sourceRoot":"","sources":["../../../src/rules/required-for-create.ts"],"names":[],"mappings":"AAGA,OAAO,EAAS,OAAO,EAA4B,MAAM,oBAAoB,CAAC;AAI9E,wBAAgB,iCAAiC,CAAC,OAAO,EAAE,OAAO,QAuCjE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { isComputed, isContains, isReferences, isRequiredForCreate } from "../index.js";
|
|
2
|
+
import { getIdForType, isTypeNullable } from "../utils.js";
|
|
3
|
+
import { getOperationVerb } from "@typespec/http";
|
|
4
|
+
import { navigateTypesInNamespace } from "@typespec/compiler";
|
|
5
|
+
import { reportDiagnostic } from "../lib.js";
|
|
6
|
+
import { GetDeclaredNamespaces } from "../entities/namespace.js";
|
|
7
|
+
export function validateRequiredRequestParameters(program) {
|
|
8
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
9
|
+
navigateTypesInNamespace(namespace, {
|
|
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
|
+
isReferences(program, property) ||
|
|
22
|
+
isContains(program, property) ||
|
|
23
|
+
isComputed(program, property) ||
|
|
24
|
+
property.default)) {
|
|
25
|
+
reportDiagnostic(program, {
|
|
26
|
+
code: "element-missing-dependencies",
|
|
27
|
+
target: property,
|
|
28
|
+
messageId: "propertyRequiredForCreate",
|
|
29
|
+
format: {
|
|
30
|
+
property: property.name,
|
|
31
|
+
model: getIdForType(program, property.model),
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# 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,UAAU,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAkB,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,MAAM,UAAU,iCAAiC,CAAC,OAAgB;IAChE,KAAK,MAAM,SAAS,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAE,CAAC;QACvD,wBAAwB,CAAC,SAAS,EAAE;YAClC,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,C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vE,wBAAgB,oDAAoD,CAAC,OAAO,EAAE,OAAO,QAqBpF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { GetDeclaredNamespaces } from "../entities/namespace.js";
|
|
2
|
+
import { hasReturnSource } from "../index.js";
|
|
3
|
+
import { reportDiagnostic } from "../lib.js";
|
|
4
|
+
import { navigateTypesInNamespace } from "@typespec/compiler";
|
|
5
|
+
export function validateReturnSourceOnlyAppliesToActionsAndFunctions(program) {
|
|
6
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
7
|
+
navigateTypesInNamespace(namespace, {
|
|
8
|
+
operation: (theOperation) => {
|
|
9
|
+
if (!hasReturnSource(program, theOperation)) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (theOperation.decorators.some(theDecorator => { var _a; return ((_a = theDecorator.definition) === null || _a === void 0 ? void 0 : _a.name) === "@returnSource"; })) {
|
|
13
|
+
if (theOperation.decorators.some(theDecorator => { var _a, _b; return ((_a = theDecorator.definition) === null || _a === void 0 ? void 0 : _a.name) === "@function" || ((_b = theDecorator.definition) === null || _b === void 0 ? void 0 : _b.name) === "@action"; })) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
reportDiagnostic(program, {
|
|
17
|
+
code: "decorator-invalid-use",
|
|
18
|
+
target: theOperation,
|
|
19
|
+
messageId: "returnSourceOnlyAppliesToActionsAndFunctions",
|
|
20
|
+
format: {},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=return-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"return-source.js","sourceRoot":"","sources":["../../../src/rules/return-source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAW,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAGvE,MAAM,UAAU,oDAAoD,CAAC,OAAgB;IACnF,KAAK,MAAM,SAAS,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAE,CAAC;QACvD,wBAAwB,CAAC,SAAS,EAAE;YAClC,SAAS,EAAE,CAAC,YAAY,EAAE,EAAE;gBAC1B,IAAG,CAAC,eAAe,CAAC,OAAO,EAAE,YAAY,CAAC,EAAC,CAAC;oBAC1C,OAAO;gBACT,CAAC;gBACD,IAAI,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,WAAC,OAAA,CAAA,MAAA,YAAY,CAAC,UAAU,0CAAE,IAAI,MAAK,eAAe,CAAA,EAAA,CAAC,EAAE,CAAC;oBACpG,IAAG,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,eAAC,OAAA,CAAA,MAAA,YAAY,CAAC,UAAU,0CAAE,IAAI,MAAK,WAAW,IAAI,CAAA,MAAA,YAAY,CAAC,UAAU,0CAAE,IAAI,MAAK,SAAS,CAAA,EAAA,CAAC,EAAC,CAAC;wBAC7I,OAAO;oBACT,CAAC;oBACD,gBAAgB,CAAC,OAAO,EAAE;wBACxB,IAAI,EAAE,uBAAuB;wBAC7B,MAAM,EAAE,YAAY;wBACpB,SAAS,EAAE,8CAA8C;wBACzD,MAAM,EAAE,EAAE;qBACX,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { Program } from "@typespec/compiler";
|
|
1
2
|
/**
|
|
2
3
|
* @search applies to get operations that return collections.
|
|
3
4
|
*/
|
|
4
|
-
export declare
|
|
5
|
+
export declare function validateSearchAppliesToGetOperationsThatReturnCollections(program: Program): void;
|
|
5
6
|
//# sourceMappingURL=search.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/rules/search.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/rules/search.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAA4B,MAAM,oBAAoB,CAAC;AAGvE;;GAEG;AACH,wBAAgB,yDAAyD,CAAC,OAAO,EAAE,OAAO,QA4BzF"}
|
package/dist/src/rules/search.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import { createRule } from "@typespec/lint";
|
|
2
1
|
import { getOperationVerb } from "@typespec/http";
|
|
3
2
|
import { isSearch } from "../index.js";
|
|
3
|
+
import { isTypeCollection } from "../utils.js";
|
|
4
4
|
import { reportDiagnostic } from "../lib.js";
|
|
5
|
+
import { navigateTypesInNamespace } from "@typespec/compiler";
|
|
6
|
+
import { GetDeclaredNamespaces } from "../entities/namespace.js";
|
|
5
7
|
/**
|
|
6
8
|
* @search applies to get operations that return collections.
|
|
7
9
|
*/
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return {
|
|
10
|
+
export function validateSearchAppliesToGetOperationsThatReturnCollections(program) {
|
|
11
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
12
|
+
navigateTypesInNamespace(namespace, {
|
|
12
13
|
operation: (operation) => {
|
|
13
14
|
if (!isSearch(program, operation)) {
|
|
14
15
|
return;
|
|
15
16
|
}
|
|
16
17
|
if (getOperationVerb(program, operation) === "get") {
|
|
17
18
|
const returnType = operation.returnType;
|
|
18
|
-
|
|
19
|
+
const isCollection = isTypeCollection(program, returnType);
|
|
20
|
+
if (isCollection) {
|
|
19
21
|
return;
|
|
20
22
|
}
|
|
21
23
|
}
|
|
@@ -29,7 +31,8 @@ export const searchAppliesToGetOperationsThatReturnCollectionsRule = createRule(
|
|
|
29
31
|
},
|
|
30
32
|
});
|
|
31
33
|
},
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
;
|
|
35
38
|
//# sourceMappingURL=search.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../src/rules/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../src/rules/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAW,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE;;GAEG;AACH,MAAM,UAAU,yDAAyD,CAAC,OAAgB;IACxF,KAAK,MAAM,SAAS,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAE,CAAC;QACvD,wBAAwB,CAAC,SAAS,EAAE;YAClC,SAAS,EAAE,CAAC,SAAS,EAAE,EAAE;gBACvB,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,CAAC;oBAClC,OAAO;gBACT,CAAC;gBAED,IAAI,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,KAAK,KAAK,EAAE,CAAC;oBACnD,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC;oBACxC,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;oBAC3D,IAAI,YAAY,EAAE,CAAC;wBACjB,OAAO;oBACT,CAAC;gBACH,CAAC;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,SAAS;oBACjB,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE;wBACN,SAAS,EAAE,SAAS;wBACpB,MAAM,EAAE,yCAAyC;qBAClD;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAAA,CAAC"}
|
package/dist/src/rules/skip.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { Program } from "@typespec/compiler";
|
|
1
2
|
/**
|
|
2
3
|
* @skip applies to get operations that return collections.
|
|
3
4
|
*/
|
|
4
|
-
export declare
|
|
5
|
+
export declare function validateSkipAppliesToGetOperationsThatReturnCollections(program: Program): void;
|
|
5
6
|
//# sourceMappingURL=skip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skip.d.ts","sourceRoot":"","sources":["../../../src/rules/skip.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"skip.d.ts","sourceRoot":"","sources":["../../../src/rules/skip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA4B,MAAM,oBAAoB,CAAC;AAOvE;;GAEG;AACH,wBAAgB,uDAAuD,CAAC,OAAO,EAAE,OAAO,QA4BvF"}
|
package/dist/src/rules/skip.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { navigateTypesInNamespace } from "@typespec/compiler";
|
|
2
2
|
import { getOperationVerb } from "@typespec/http";
|
|
3
3
|
import { isSkip } from "../index.js";
|
|
4
|
+
import { isTypeCollection } from "../utils.js";
|
|
4
5
|
import { reportDiagnostic } from "../lib.js";
|
|
6
|
+
import { GetDeclaredNamespaces } from "../entities/namespace.js";
|
|
5
7
|
/**
|
|
6
8
|
* @skip applies to get operations that return collections.
|
|
7
9
|
*/
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return {
|
|
10
|
+
export function validateSkipAppliesToGetOperationsThatReturnCollections(program) {
|
|
11
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
12
|
+
navigateTypesInNamespace(namespace, {
|
|
12
13
|
operation: (operation) => {
|
|
13
14
|
if (!isSkip(program, operation)) {
|
|
14
15
|
return;
|
|
15
16
|
}
|
|
16
17
|
if (getOperationVerb(program, operation) === "get") {
|
|
17
18
|
const returnType = operation.returnType;
|
|
18
|
-
|
|
19
|
+
const isCollection = isTypeCollection(program, returnType);
|
|
20
|
+
if (isCollection) {
|
|
19
21
|
return;
|
|
20
22
|
}
|
|
21
23
|
}
|
|
@@ -29,7 +31,8 @@ export const skipAppliesToGetOperationsThatReturnCollectionsRule = createRule({
|
|
|
29
31
|
},
|
|
30
32
|
});
|
|
31
33
|
},
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
;
|
|
35
38
|
//# sourceMappingURL=skip.js.map
|