@microsoft/typespec-msgraph 0.0.1-Preview.8 → 1.0.0-Preview.2
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.js.map +1 -1
- package/dist/src/components/alternate-keys-annotation.js +2 -1
- package/dist/src/components/alternate-keys-annotation.js.map +1 -1
- package/dist/src/components/annotations.d.ts +6 -3
- package/dist/src/components/annotations.d.ts.map +1 -1
- package/dist/src/components/annotations.js +67 -7
- package/dist/src/components/annotations.js.map +1 -1
- package/dist/src/components/common-elements.d.ts +7 -7
- package/dist/src/components/common-elements.d.ts.map +1 -1
- package/dist/src/components/common-elements.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/entity-container-element.d.ts.map +1 -1
- package/dist/src/components/entity-container-element.js +16 -6
- package/dist/src/components/entity-container-element.js.map +1 -1
- package/dist/src/components/enum-type-element.d.ts.map +1 -1
- package/dist/src/components/enum-type-element.js +6 -3
- package/dist/src/components/enum-type-element.js.map +1 -1
- package/dist/src/components/filter-restrictions-annotation.js +1 -1
- package/dist/src/components/filter-restrictions-annotation.js.map +1 -1
- package/dist/src/components/index.js +3 -3
- package/dist/src/components/index.js.map +1 -1
- 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.map +1 -1
- package/dist/src/components/operation-element.js +30 -15
- package/dist/src/components/operation-element.js.map +1 -1
- package/dist/src/components/permissions-annotation.js.map +1 -1
- package/dist/src/components/property-element.d.ts.map +1 -1
- package/dist/src/components/property-element.js +8 -4
- 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.map +1 -1
- package/dist/src/components/revisions-annotation.js +2 -1
- package/dist/src/components/revisions-annotation.js.map +1 -1
- package/dist/src/components/schema-element.d.ts.map +1 -1
- package/dist/src/components/schema-element.js +9 -3
- package/dist/src/components/schema-element.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/structured-type-element.d.ts.map +1 -1
- package/dist/src/components/structured-type-element.js +8 -6
- 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.js +1 -1
- package/dist/src/components/top-supported-annotation.js.map +1 -1
- package/dist/src/components/update-restrictions-annotation.d.ts +2 -1
- package/dist/src/components/update-restrictions-annotation.d.ts.map +1 -1
- package/dist/src/components/update-restrictions-annotation.js +4 -4
- package/dist/src/components/update-restrictions-annotation.js.map +1 -1
- 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 -0
- package/dist/src/decorators/abstract.js.map +1 -1
- package/dist/src/decorators/action.d.ts +2 -0
- package/dist/src/decorators/action.d.ts.map +1 -1
- package/dist/src/decorators/action.js +2 -0
- package/dist/src/decorators/action.js.map +1 -1
- package/dist/src/decorators/additional-query-parameters.d.ts +2 -0
- package/dist/src/decorators/additional-query-parameters.d.ts.map +1 -1
- package/dist/src/decorators/additional-query-parameters.js +2 -0
- package/dist/src/decorators/additional-query-parameters.js.map +1 -1
- 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 +7 -3
- package/dist/src/decorators/ags-attribute.d.ts.map +1 -1
- package/dist/src/decorators/ags-attribute.js +102 -3
- package/dist/src/decorators/ags-attribute.js.map +1 -1
- 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 -0
- 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.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 +3 -0
- package/dist/src/decorators/entity.d.ts.map +1 -1
- package/dist/src/decorators/entity.js +7 -1
- 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 +3 -1
- package/dist/src/decorators/filter.d.ts.map +1 -1
- package/dist/src/decorators/filter.js +9 -7
- package/dist/src/decorators/filter.js.map +1 -1
- package/dist/src/decorators/function.d.ts +9 -2
- package/dist/src/decorators/function.d.ts.map +1 -1
- package/dist/src/decorators/function.js +7 -2
- package/dist/src/decorators/function.js.map +1 -1
- 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-partial.d.ts +12 -0
- package/dist/src/decorators/graph-partial.d.ts.map +1 -0
- package/dist/src/decorators/graph-partial.js +18 -0
- package/dist/src/decorators/graph-partial.js.map +1 -0
- package/dist/src/decorators/graph-route.d.ts +13 -2
- package/dist/src/decorators/graph-route.d.ts.map +1 -1
- package/dist/src/decorators/graph-route.js +67 -15
- package/dist/src/decorators/graph-route.js.map +1 -1
- package/dist/src/decorators/graphFlags.d.ts +11 -0
- package/dist/src/decorators/graphFlags.d.ts.map +1 -0
- package/dist/src/decorators/graphFlags.js +15 -0
- package/dist/src/decorators/graphFlags.js.map +1 -0
- package/dist/src/decorators/immutable.d.ts +2 -0
- package/dist/src/decorators/immutable.d.ts.map +1 -1
- package/dist/src/decorators/immutable.js +2 -0
- package/dist/src/decorators/immutable.js.map +1 -1
- package/dist/src/decorators/index.d.ts +23 -3
- package/dist/src/decorators/index.d.ts.map +1 -1
- package/dist/src/decorators/index.js +23 -3
- package/dist/src/decorators/index.js.map +1 -1
- package/dist/src/decorators/is-owner.d.ts +5 -2
- package/dist/src/decorators/is-owner.d.ts.map +1 -1
- package/dist/src/decorators/is-owner.js +9 -4
- package/dist/src/decorators/is-owner.js.map +1 -1
- 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 -0
- package/dist/src/decorators/open.js.map +1 -1
- package/dist/src/decorators/operation-parameters.d.ts +2 -0
- package/dist/src/decorators/operation-parameters.d.ts.map +1 -1
- package/dist/src/decorators/operation-parameters.js +2 -0
- package/dist/src/decorators/operation-parameters.js.map +1 -1
- 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/passthrough-address-url-msa.d.ts +14 -0
- package/dist/src/decorators/passthrough-address-url-msa.d.ts.map +1 -0
- package/dist/src/decorators/passthrough-address-url-msa.js +20 -0
- package/dist/src/decorators/passthrough-address-url-msa.js.map +1 -0
- package/dist/src/decorators/passthrough-address-url.d.ts +14 -0
- package/dist/src/decorators/passthrough-address-url.d.ts.map +1 -0
- package/dist/src/decorators/passthrough-address-url.js +20 -0
- package/dist/src/decorators/passthrough-address-url.js.map +1 -0
- package/dist/src/decorators/prefixed-graph-routes.d.ts +10 -0
- package/dist/src/decorators/prefixed-graph-routes.d.ts.map +1 -0
- package/dist/src/decorators/prefixed-graph-routes.js +27 -0
- package/dist/src/decorators/prefixed-graph-routes.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 -0
- package/dist/src/decorators/private-preview.js.map +1 -1
- package/dist/src/decorators/privileged.d.ts +2 -0
- package/dist/src/decorators/privileged.d.ts.map +1 -1
- package/dist/src/decorators/privileged.js +2 -0
- package/dist/src/decorators/privileged.js.map +1 -1
- 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 +2 -0
- package/dist/src/decorators/required-for-create.d.ts.map +1 -1
- package/dist/src/decorators/required-for-create.js +2 -0
- package/dist/src/decorators/required-for-create.js.map +1 -1
- 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/shared-entity.d.ts +9 -0
- package/dist/src/decorators/shared-entity.d.ts.map +1 -0
- package/dist/src/decorators/shared-entity.js +15 -0
- package/dist/src/decorators/shared-entity.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 +2 -0
- package/dist/src/decorators/workload-name-msa.d.ts.map +1 -1
- package/dist/src/decorators/workload-name-msa.js +2 -0
- package/dist/src/decorators/workload-name-msa.js.map +1 -1
- package/dist/src/decorators/workload-name.d.ts +2 -0
- package/dist/src/decorators/workload-name.d.ts.map +1 -1
- package/dist/src/decorators/workload-name.js +2 -0
- package/dist/src/decorators/workload-name.js.map +1 -1
- 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 +31 -2
- 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 +23 -4
- package/dist/src/entities/annotations.d.ts.map +1 -1
- package/dist/src/entities/annotations.js +137 -72
- package/dist/src/entities/annotations.js.map +1 -1
- package/dist/src/entities/entity-container.d.ts +21 -0
- package/dist/src/entities/entity-container.d.ts.map +1 -1
- package/dist/src/entities/entity-container.js +33 -4
- package/dist/src/entities/entity-container.js.map +1 -1
- package/dist/src/entities/enum.d.ts +3 -1
- package/dist/src/entities/enum.d.ts.map +1 -1
- package/dist/src/entities/enum.js +10 -5
- package/dist/src/entities/enum.js.map +1 -1
- package/dist/src/entities/model.d.ts +38 -9
- package/dist/src/entities/model.d.ts.map +1 -1
- package/dist/src/entities/model.js +311 -14
- package/dist/src/entities/model.js.map +1 -1
- 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 +27 -4
- package/dist/src/entities/namespace.d.ts.map +1 -1
- package/dist/src/entities/namespace.js +321 -29
- package/dist/src/entities/namespace.js.map +1 -1
- package/dist/src/entities/operation.d.ts +18 -0
- package/dist/src/entities/operation.d.ts.map +1 -1
- package/dist/src/entities/operation.js +143 -21
- package/dist/src/entities/operation.js.map +1 -1
- package/dist/src/entities/property.d.ts.map +1 -1
- package/dist/src/entities/property.js +7 -0
- package/dist/src/entities/property.js.map +1 -1
- package/dist/src/entities/revision-definition.d.ts +3 -2
- package/dist/src/entities/revision-definition.d.ts.map +1 -1
- package/dist/src/entities/revision-definition.js +17 -6
- package/dist/src/entities/revision-definition.js.map +1 -1
- 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 +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib.d.ts +139 -94
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +92 -11
- 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 +32 -38
- package/dist/src/linter.js.map +1 -1
- package/dist/src/path-tree.d.ts +16 -0
- package/dist/src/path-tree.d.ts.map +1 -0
- package/dist/src/path-tree.js +76 -0
- package/dist/src/path-tree.js.map +1 -0
- 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 +20 -0
- package/dist/src/rules/address-url.d.ts.map +1 -0
- package/dist/src/rules/address-url.js +248 -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 +2 -1
- package/dist/src/rules/collection-navigation-properties-not-nullable.d.ts.map +1 -1
- package/dist/src/rules/collection-navigation-properties-not-nullable.js +9 -9
- package/dist/src/rules/collection-navigation-properties-not-nullable.js.map +1 -1
- 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 +9 -8
- 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 +208 -0
- package/dist/src/rules/delta.js.map +1 -0
- package/dist/src/rules/disallowed-typespec-decorators.d.ts +2 -1
- package/dist/src/rules/disallowed-typespec-decorators.d.ts.map +1 -1
- package/dist/src/rules/disallowed-typespec-decorators.js +29 -25
- package/dist/src/rules/disallowed-typespec-decorators.js.map +1 -1
- package/dist/src/rules/documentation.d.ts +4 -0
- package/dist/src/rules/documentation.d.ts.map +1 -0
- package/dist/src/rules/documentation.js +91 -0
- package/dist/src/rules/documentation.js.map +1 -0
- package/dist/src/rules/entity.d.ts +9 -2
- package/dist/src/rules/entity.d.ts.map +1 -1
- package/dist/src/rules/entity.js +170 -17
- package/dist/src/rules/entity.js.map +1 -1
- package/dist/src/rules/enum.d.ts +5 -1
- package/dist/src/rules/enum.d.ts.map +1 -1
- package/dist/src/rules/enum.js +35 -6
- package/dist/src/rules/enum.js.map +1 -1
- 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 +25 -20
- package/dist/src/rules/expand.js.map +1 -1
- package/dist/src/rules/extends-on-same-type.d.ts +2 -1
- package/dist/src/rules/extends-on-same-type.d.ts.map +1 -1
- package/dist/src/rules/extends-on-same-type.js +9 -8
- package/dist/src/rules/extends-on-same-type.js.map +1 -1
- package/dist/src/rules/filter.d.ts +6 -3
- package/dist/src/rules/filter.d.ts.map +1 -1
- package/dist/src/rules/filter.js +100 -32
- package/dist/src/rules/filter.js.map +1 -1
- package/dist/src/rules/function.d.ts +3 -1
- package/dist/src/rules/function.d.ts.map +1 -1
- package/dist/src/rules/function.js +48 -9
- package/dist/src/rules/function.js.map +1 -1
- 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-partial.d.ts +9 -0
- package/dist/src/rules/graph-partial.d.ts.map +1 -0
- package/dist/src/rules/graph-partial.js +84 -0
- package/dist/src/rules/graph-partial.js.map +1 -0
- package/dist/src/rules/graph-route.d.ts +13 -1
- package/dist/src/rules/graph-route.d.ts.map +1 -1
- package/dist/src/rules/graph-route.js +375 -19
- package/dist/src/rules/graph-route.js.map +1 -1
- package/dist/src/rules/index.d.ts +18 -2
- package/dist/src/rules/index.d.ts.map +1 -1
- package/dist/src/rules/index.js +18 -2
- 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 +10 -0
- package/dist/src/rules/model.d.ts.map +1 -0
- package/dist/src/rules/model.js +131 -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 +6 -1
- package/dist/src/rules/operation-inside-interface.d.ts.map +1 -1
- package/dist/src/rules/operation-inside-interface.js +78 -7
- package/dist/src/rules/operation-inside-interface.js.map +1 -1
- 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 +19 -19
- 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 +170 -0
- package/dist/src/rules/ownerless.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 +129 -0
- package/dist/src/rules/record-t.js.map +1 -0
- package/dist/src/rules/reference-target.d.ts +6 -0
- package/dist/src/rules/reference-target.d.ts.map +1 -0
- package/dist/src/rules/reference-target.js +113 -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 +2 -1
- package/dist/src/rules/required-for-create.d.ts.map +1 -1
- package/dist/src/rules/required-for-create.js +11 -10
- package/dist/src/rules/required-for-create.js.map +1 -1
- 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 +9 -8
- package/dist/src/rules/search.js.map +1 -1
- package/dist/src/rules/shared-entity.d.ts +8 -0
- package/dist/src/rules/shared-entity.d.ts.map +1 -0
- package/dist/src/rules/shared-entity.js +176 -0
- package/dist/src/rules/shared-entity.js.map +1 -0
- 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 +9 -8
- 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 +9 -8
- 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 +69 -13
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +651 -76
- 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 +98 -0
- package/dist/src/validate.js.map +1 -0
- package/lib/bodies.tsp +71 -0
- package/lib/decorators.tsp +282 -75
- package/lib/deployment.tsp +1 -1
- package/lib/lib.tsp +4 -2
- package/lib/msgraph.tsp +1 -0
- package/lib/porcelain.tsp +82 -27
- package/lib/responses.tsp +20 -43
- package/lib/shared-models.tsp +10 -54
- package/package.json +24 -26
- package/dist/src/decorators/flags.d.ts +0 -9
- package/dist/src/decorators/flags.d.ts.map +0 -1
- package/dist/src/decorators/flags.js +0 -13
- package/dist/src/decorators/flags.js.map +0 -1
- package/dist/src/decorators/has-stream.d.ts +0 -10
- package/dist/src/decorators/has-stream.d.ts.map +0 -1
- package/dist/src/decorators/has-stream.js +0 -17
- package/dist/src/decorators/has-stream.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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rules/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oDAAoD,CAAC;AACnE,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,qCAAqC,CAAC;AACpD,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rules/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oDAAoD,CAAC;AACnE,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,qCAAqC,CAAC;AACpD,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,iCAAiC,CAAC;AAChD,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limited-charset.d.ts","sourceRoot":"","sources":["../../../src/rules/limited-charset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA0C,MAAM,oBAAoB,CAAC;AAMrF,eAAO,MAAM,gEAAgE,YAClE,OAAO,SA0CjB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { isStringType, navigateTypesInNamespace } from "@typespec/compiler";
|
|
2
|
+
import { GetDeclaredNamespaces } from "../entities/namespace.js";
|
|
3
|
+
import { supportsLimitedCharset } from "../index.js";
|
|
4
|
+
import { reportDiagnostic } from "../lib.js";
|
|
5
|
+
import { extractTypesFromUnion } from "../utils.js";
|
|
6
|
+
export const validatedLimitedCharsetOnlyAppliesToStringPropertiesOrParameters = (program) => {
|
|
7
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
8
|
+
navigateTypesInNamespace(namespace, {
|
|
9
|
+
modelProperty: (property) => {
|
|
10
|
+
if (!supportsLimitedCharset(program, property)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (isStringType(program, property.type)) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
// Nullable Properties and Parameters
|
|
17
|
+
if (property.type.kind === "Union") {
|
|
18
|
+
const types = extractTypesFromUnion(property.type);
|
|
19
|
+
if (types.some((type) => isStringType(program, type))) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
// Arrays of strings
|
|
24
|
+
if (property.type.kind === "Model" &&
|
|
25
|
+
property.type.name === "Array" &&
|
|
26
|
+
isStringType(program, property.type.indexer.value)) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
reportDiagnostic(program, {
|
|
30
|
+
code: "decorator-invalid-use",
|
|
31
|
+
target: property,
|
|
32
|
+
messageId: "wrongType",
|
|
33
|
+
format: {
|
|
34
|
+
decorator: "@limitedCharset",
|
|
35
|
+
target: "string model property, parameter or their collections",
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=limited-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C9B,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,OAAQ,CAAC,KAAK,CAAC,EACnD,CAAC;oBACD,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,iBAAiB;wBAC5B,MAAM,EAAE,uDAAuD;qBAChE;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Program } from "@typespec/compiler";
|
|
2
|
+
export declare function validateIsMediaOnlyOnEntity(program: Program): void;
|
|
3
|
+
export declare const mediaTypeValuesShouldBeMinimallyFormattedForMIMETypes: import("@typespec/compiler").LinterRuleDefinition<"media-type-values-should-be-minimally-formatted", {
|
|
4
|
+
readonly default: import("@typespec/compiler").CallableMessage<["value"]>;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const interfaceNavigationSourceShouldHaveMediaIf$ValueIsSpecified: import("@typespec/compiler").LinterRuleDefinition<"navigation-source-should-have-media-if-value-is-specified", {
|
|
7
|
+
readonly interfaceNavigationSourceShouldHaveMediaIf$ValueIsSpecifiedInRoute: import("@typespec/compiler").CallableMessage<["model", "route"]>;
|
|
8
|
+
readonly interfaceNavigationSourceShouldHaveMediaIf$ValueIsSpecifiedInParameters: import("@typespec/compiler").CallableMessage<["model"]>;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=media.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../../src/rules/media.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAsD,MAAM,oBAAoB,CAAC;AAIjG,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,QAsB3D;AAED,eAAO,MAAM,qDAAqD;;EA6BhE,CAAA;AAEF,eAAO,MAAM,2DAA2D;;;EA4DtE,CAAA"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { getMediaTypes, isMedia } from "../decorators/media.js";
|
|
2
|
+
import { getExpand, getGraphRoutePaths, hasGraphRoute, isEntity } from "../index.js";
|
|
3
|
+
import { reportDiagnostic } from "../lib.js";
|
|
4
|
+
import { createRule, navigateTypesInNamespace, paramMessage } from "@typespec/compiler";
|
|
5
|
+
import { GetDeclaredNamespaces } from "../entities/namespace.js";
|
|
6
|
+
import { getInterfaceNavigationSourceType, getNavigationSourceType } from "../utils.js";
|
|
7
|
+
export function validateIsMediaOnlyOnEntity(program) {
|
|
8
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
9
|
+
navigateTypesInNamespace(namespace, {
|
|
10
|
+
model: (model) => {
|
|
11
|
+
if (!isMedia(program, model)) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if (isEntity(program, model)) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
reportDiagnostic(program, {
|
|
18
|
+
code: "decorator-invalid-use",
|
|
19
|
+
target: model,
|
|
20
|
+
messageId: "wrongType",
|
|
21
|
+
format: {
|
|
22
|
+
decorator: "@media",
|
|
23
|
+
target: "@entity model",
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
;
|
|
31
|
+
export const mediaTypeValuesShouldBeMinimallyFormattedForMIMETypes = createRule({
|
|
32
|
+
name: "media-type-values-should-be-minimally-formatted",
|
|
33
|
+
severity: "warning",
|
|
34
|
+
description: "Media type values should be two part strings with a / separator",
|
|
35
|
+
messages: {
|
|
36
|
+
default: paramMessage `Media type value '${"value"}' should be a two part string with a \/ separator.`,
|
|
37
|
+
},
|
|
38
|
+
create(context) {
|
|
39
|
+
return {
|
|
40
|
+
model: (model) => {
|
|
41
|
+
if (!isMedia(context.program, model)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const mediaTypes = getMediaTypes(context.program, model);
|
|
45
|
+
if (mediaTypes.length > 0) {
|
|
46
|
+
for (const mediaType of mediaTypes) {
|
|
47
|
+
if (mediaType.split("/").length !== 2) {
|
|
48
|
+
context.reportDiagnostic({
|
|
49
|
+
target: model,
|
|
50
|
+
format: {
|
|
51
|
+
value: mediaType,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
export const interfaceNavigationSourceShouldHaveMediaIf$ValueIsSpecified = createRule({
|
|
62
|
+
name: "navigation-source-should-have-media-if-value-is-specified",
|
|
63
|
+
severity: "warning",
|
|
64
|
+
description: "Interface navigation source should have media if $value is specified",
|
|
65
|
+
messages: {
|
|
66
|
+
interfaceNavigationSourceShouldHaveMediaIf$ValueIsSpecifiedInRoute: paramMessage `Interface navigation source '${"model"}' should have @media if $value is specified in the interface route '${"route"}'.`,
|
|
67
|
+
interfaceNavigationSourceShouldHaveMediaIf$ValueIsSpecifiedInParameters: paramMessage `Interface navigation source '${"model"}' should have @media if $value is specified in the parameters.`,
|
|
68
|
+
},
|
|
69
|
+
create(context) {
|
|
70
|
+
return {
|
|
71
|
+
operation: (operation) => {
|
|
72
|
+
operation.decorators.forEach((decorator) => {
|
|
73
|
+
if (decorator.decorator.name === "$expand") {
|
|
74
|
+
const expanded = getExpand(context.program, operation);
|
|
75
|
+
if (expanded.includes("$value")) {
|
|
76
|
+
const navigationSource = getNavigationSourceType(context.program, operation);
|
|
77
|
+
if (!navigationSource) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (!isMedia(context.program, navigationSource)) {
|
|
81
|
+
context.reportDiagnostic({
|
|
82
|
+
target: operation,
|
|
83
|
+
format: {
|
|
84
|
+
model: navigationSource.name,
|
|
85
|
+
},
|
|
86
|
+
messageId: "interfaceNavigationSourceShouldHaveMediaIf$ValueIsSpecifiedInParameters",
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
interface: (_interface) => {
|
|
94
|
+
if (!hasGraphRoute(context.program, _interface)) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const graphRoutes = getGraphRoutePaths(context.program, _interface);
|
|
98
|
+
if (graphRoutes && graphRoutes.length > 0) {
|
|
99
|
+
for (const graphRoute of graphRoutes) {
|
|
100
|
+
if (graphRoute.includes("$value")) {
|
|
101
|
+
const navigationSource = getInterfaceNavigationSourceType(context.program, _interface);
|
|
102
|
+
if (!navigationSource) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (!isMedia(context.program, navigationSource)) {
|
|
106
|
+
context.reportDiagnostic({
|
|
107
|
+
target: _interface,
|
|
108
|
+
format: {
|
|
109
|
+
model: navigationSource.name,
|
|
110
|
+
route: graphRoute,
|
|
111
|
+
},
|
|
112
|
+
messageId: "interfaceNavigationSourceShouldHaveMediaIf$ValueIsSpecifiedInRoute"
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
//# sourceMappingURL=media.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.js","sourceRoot":"","sources":["../../../src/rules/media.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAW,U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AAC;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Program } from "@typespec/compiler";
|
|
2
|
+
export declare function validateModelShouldBeEntityOrComplexType(program: Program): void;
|
|
3
|
+
export declare const containedNavigationPropertyTypeShouldNotBeExternallyReferenced: import("@typespec/compiler").LinterRuleDefinition<"contained-navigation-property-type-should-not-be-externally-referenced", {
|
|
4
|
+
readonly default: import("@typespec/compiler").CallableMessage<["property"]>;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const operationParametersShouldHaveRequiredBeforeOptional: import("@typespec/compiler").LinterRuleDefinition<"operation-parameters-should-have-required-before-optional", {
|
|
7
|
+
readonly default: import("@typespec/compiler").CallableMessage<[]>;
|
|
8
|
+
}>;
|
|
9
|
+
export declare function validatePropertyTypeIsNotStringLiteral(program: Program): void;
|
|
10
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/rules/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,OAAO,EAIR,MAAM,oBAAoB,CAAC;AAW5B,wBAAgB,wCAAwC,CAAC,OAAO,EAAE,OAAO,QA6BxE;AAED,eAAO,MAAM,8DAA8D;;EAyBzE,CAAC;AAEH,eAAO,MAAM,mDAAmD;;EA6B9D,CAAC;AAEH,wBAAgB,sCAAsC,CAAC,OAAO,EAAE,OAAO,QA4BtE"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { createRule, navigateTypesInNamespace, paramMessage } from "@typespec/compiler";
|
|
2
|
+
import { extractTypesFromUnion, getTypeModel, isExcludedCoreType, isTypeDefinedInExternalLibrary } from "../utils.js";
|
|
3
|
+
import { isEntity, isComplex, isContains, isOperationParameters } from "../index.js";
|
|
4
|
+
import { GetDeclaredNamespaces } from "../entities/namespace.js";
|
|
5
|
+
import { reportDiagnostic } from "../lib.js";
|
|
6
|
+
export function validateModelShouldBeEntityOrComplexType(program) {
|
|
7
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
8
|
+
navigateTypesInNamespace(namespace, {
|
|
9
|
+
model: (model) => {
|
|
10
|
+
if (isExcludedCoreType(program, model) || isTypeDefinedInExternalLibrary(program, model)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (isEntity(program, model) || isComplex(program, model)) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const modelDecorators = model.decorators;
|
|
17
|
+
for (const decorator of modelDecorators) {
|
|
18
|
+
if (decorator.decorator.name === "$operationParameters") {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
reportDiagnostic(program, {
|
|
23
|
+
code: "model-invalid-use",
|
|
24
|
+
target: model,
|
|
25
|
+
format: {
|
|
26
|
+
model: model.name
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
;
|
|
34
|
+
export const containedNavigationPropertyTypeShouldNotBeExternallyReferenced = createRule({
|
|
35
|
+
name: "contained-navigation-property-type-should-not-be-externally-referenced",
|
|
36
|
+
severity: "warning",
|
|
37
|
+
description: "Contained navigation property type should not be an externally referenced type",
|
|
38
|
+
messages: {
|
|
39
|
+
default: paramMessage `Contained navigation property '${"property"}' type should not be an externally referenced type.`,
|
|
40
|
+
},
|
|
41
|
+
create(context) {
|
|
42
|
+
return {
|
|
43
|
+
model: (model) => {
|
|
44
|
+
const properties = model.properties;
|
|
45
|
+
for (const [_, property] of properties) {
|
|
46
|
+
const propertyType = getTypeModel(context.program, property.type);
|
|
47
|
+
if (propertyType && isContains(context.program, property) && isTypeDefinedInExternalLibrary(context.program, propertyType)) {
|
|
48
|
+
context.reportDiagnostic({
|
|
49
|
+
target: property,
|
|
50
|
+
format: {
|
|
51
|
+
property: property.name
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
export const operationParametersShouldHaveRequiredBeforeOptional = createRule({
|
|
61
|
+
name: "operation-parameters-should-have-required-before-optional",
|
|
62
|
+
severity: "warning",
|
|
63
|
+
description: "Operation parameters should have required parameters before optional ones",
|
|
64
|
+
messages: {
|
|
65
|
+
default: paramMessage `Required parameters should appear before optional parameters in @operationParameters.`
|
|
66
|
+
},
|
|
67
|
+
create(context) {
|
|
68
|
+
return {
|
|
69
|
+
model: (model) => {
|
|
70
|
+
if (!isOperationParameters(context.program, model)) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
let foundOptional = false;
|
|
74
|
+
for (const [_, param] of model.properties) {
|
|
75
|
+
if (param.optional) {
|
|
76
|
+
foundOptional = true;
|
|
77
|
+
}
|
|
78
|
+
else if (foundOptional) {
|
|
79
|
+
context.reportDiagnostic({
|
|
80
|
+
target: param,
|
|
81
|
+
format: {}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
export function validatePropertyTypeIsNotStringLiteral(program) {
|
|
90
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
91
|
+
navigateTypesInNamespace(namespace, {
|
|
92
|
+
modelProperty: (property) => {
|
|
93
|
+
if (!property.model || isExcludedCoreType(program, property.model)) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
// To skip cases like '@path value:"$value"', '@header contentType: "image/*"'
|
|
97
|
+
const propDecoratorToSkip = ["@path", "@header"];
|
|
98
|
+
const propDecorators = property.decorators
|
|
99
|
+
.map((decorator) => { var _a; return (_a = decorator.definition) === null || _a === void 0 ? void 0 : _a.name; });
|
|
100
|
+
if (propDecoratorToSkip.some(value => propDecorators.includes(value))) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (property.type.kind === "Union") {
|
|
104
|
+
const unionTypes = extractTypesFromUnion(property.type);
|
|
105
|
+
unionTypes.forEach(type => {
|
|
106
|
+
reportModelPropertyTypeDiagnostics(program, property, type.kind);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
reportModelPropertyTypeDiagnostics(program, property, property.type.kind);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function reportModelPropertyTypeDiagnostics(program, property, propertyTypeKind) {
|
|
117
|
+
const literalTypes = ["String", "Boolean", "Number", "Tuple"];
|
|
118
|
+
if (!literalTypes.includes(propertyTypeKind)) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
reportDiagnostic(program, {
|
|
122
|
+
code: "type-invalid-use",
|
|
123
|
+
target: property,
|
|
124
|
+
messageId: "propertyTypeCannotBeStringLiteral",
|
|
125
|
+
format: {
|
|
126
|
+
property: property.name,
|
|
127
|
+
type: propertyTypeKind.toLowerCase()
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/rules/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,UAAU,EACV,wBAAwB,EACxB,YAAY,EACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,qBAAqB,EACrB,YAAY,EACZ,kBAAkB,EAClB,8BAA8B,EAC/B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,UAAU,wCAAwC,CAAC,OAAgB;IACvE,KAAK,MAAM,SAAS,IAAI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7G,MAAM,YAAY,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC9D,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC7C,OAAO;IACT,CAAC;IAED,gBAAgB,CAAC,OAAO,EAAE;QACxB,IAAI,EAAE,kBAAkB;QACxB,MAAM,EAAE,QAAQ;QAChB,SAAS,EAAE,mCAAmC;QAC9C,MAAM,EAAE;YACN,QAAQ,EAAE,QAAQ,CAAC,IAAI;YACvB,IAAI,EAAE,gBAAgB,CAAC,WAAW,EAAE;SACrC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Program } from "@typespec/compiler";
|
|
2
|
+
export declare function validateNamespaceIsRequired(program: Program): void;
|
|
3
|
+
export declare function validatePublicNamespaceName(program: Program): void;
|
|
4
|
+
export declare function validateTopLevelNamespaceMustHavePublicNamespace(program: Program): void;
|
|
5
|
+
export declare function validateWorkloadNamespaceName(program: Program): void;
|
|
6
|
+
//# sourceMappingURL=namespace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../../../src/rules/namespace.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAkD,MAAM,oBAAoB,CAAC;AAK7F,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,QA0B3D;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,QAqB3D;AAED,wBAAgB,gDAAgD,CAAC,OAAO,EAAE,OAAO,QAkChF;AAED,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,OAAO,QAqB7D"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { reportDiagnostic } from "../lib.js";
|
|
2
|
+
import { getPublicNamespaceName, hasPublicNamespace } from "../index.js";
|
|
3
|
+
import { getNamespaceFullName, navigateTypesInNamespace } from "@typespec/compiler";
|
|
4
|
+
import { getIdForType, isExcludedCoreType, isTypeDefinedInExternalLibrary } from "../utils.js";
|
|
5
|
+
import { DEFAULT_MSGRAPH_NAMESPACE, GetDeclaredNamespaces, expandNamespaces } from "../entities/namespace.js";
|
|
6
|
+
import { getWorkloadNamespaceName, hasWorkloadNamespace } from "../decorators/workload-namespace.js";
|
|
7
|
+
export function validateNamespaceIsRequired(program) {
|
|
8
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
9
|
+
navigateTypesInNamespace(namespace, {
|
|
10
|
+
model: (model) => {
|
|
11
|
+
if (model.namespace && model.namespace.name) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
while (model.baseModel) {
|
|
15
|
+
model = model.baseModel;
|
|
16
|
+
if (model.namespace && model.namespace.name) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
reportDiagnostic(program, {
|
|
21
|
+
code: "element-missing-dependencies",
|
|
22
|
+
target: model,
|
|
23
|
+
messageId: "modelMissingNamespace",
|
|
24
|
+
format: {
|
|
25
|
+
model: model.name,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
;
|
|
33
|
+
export function validatePublicNamespaceName(program) {
|
|
34
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
35
|
+
if (!hasPublicNamespace(program, namespace)) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const publicNamespaceName = getPublicNamespaceName(program, namespace);
|
|
39
|
+
if (isValidPublicNamespaceName(publicNamespaceName)) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
reportDiagnostic(program, {
|
|
43
|
+
code: "decorator-invalid-use",
|
|
44
|
+
target: namespace,
|
|
45
|
+
messageId: "invalidPublicNamespaceName",
|
|
46
|
+
format: {
|
|
47
|
+
namespace: getNamespaceFullName(namespace),
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
;
|
|
53
|
+
export function validateTopLevelNamespaceMustHavePublicNamespace(program) {
|
|
54
|
+
const rootNamespace = program.checker.getGlobalNamespaceType();
|
|
55
|
+
for (const namespace of expandNamespaces(rootNamespace)) {
|
|
56
|
+
if (isTypeDefinedInExternalLibrary(program, namespace)) {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (isExcludedCoreType(program, namespace)) {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
// The nested namespaces will cause validation of the parent namespace.
|
|
63
|
+
if (namespace.namespaces.size > 0) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (getPublicNamespaceName(program, namespace)) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
const namespaceName = getIdForType(program, namespace);
|
|
70
|
+
if (isValidPublicNamespaceName(namespaceName)) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
reportDiagnostic(program, {
|
|
74
|
+
code: "element-missing-dependencies",
|
|
75
|
+
target: namespace,
|
|
76
|
+
messageId: "topLevelNamespaceMissingPublicNamespace",
|
|
77
|
+
format: {
|
|
78
|
+
namespace: getNamespaceFullName(namespace),
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
;
|
|
84
|
+
export function validateWorkloadNamespaceName(program) {
|
|
85
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
86
|
+
if (!hasWorkloadNamespace(program, namespace)) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const workloadNamespaceName = getWorkloadNamespaceName(program, namespace);
|
|
90
|
+
if (!isValidPublicNamespaceName(workloadNamespaceName)) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
reportDiagnostic(program, {
|
|
94
|
+
code: "decorator-invalid-use",
|
|
95
|
+
target: namespace,
|
|
96
|
+
messageId: "invalidWorkloadNamespaceName",
|
|
97
|
+
format: {
|
|
98
|
+
namespace: getNamespaceFullName(namespace),
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
;
|
|
104
|
+
function isValidPublicNamespaceName(namespace) {
|
|
105
|
+
// publicNamespace name should either be "microsoft.graph"
|
|
106
|
+
// or match the pattern "microsoft.graph.<string_token>"
|
|
107
|
+
const namespaceRegex = /microsoft\.graph\.[\w]+/;
|
|
108
|
+
return namespace === DEFAULT_MSGRAPH_NAMESPACE || namespaceRegex.test(namespace);
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=namespace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace.js","sourceRoot":"","sources":["../../../src/rules/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAW,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAC/F,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC9G,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAErG,MAAM,UAAU,2BAA2B,CAAC,OAAgB;IAC1D,KAAK,MAAM,SAAS,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAE,CAAC;QACvD,wBAAwB,CAAC,SAAS,EAAE;YAClC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;gBACf,IAAI,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;oBAC5C,OAAO;gBACT,CAAC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AAC;aAC3C;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAAA,CAAC;AAEF,SAAS,0BAA0B,CAAC,SAAiB;IACnD,0DAA0D;IAC1D,wDAAwD;IACxD,MAAM,cAAc,GAAG,yBAAyB,CAAC;IACjD,OAAO,SAAS,KAAK,yBAAyB,IAAI,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACnF,CAAC"}
|
package/dist/src/rules/open.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { Program } from "@typespec/compiler";
|
|
1
2
|
/**
|
|
2
3
|
* @open applies to either an entity or a complex type.
|
|
3
4
|
*/
|
|
4
|
-
export declare
|
|
5
|
+
export declare function validateOpenOnlyAppliesToStructuredType(program: Program): void;
|
|
5
6
|
//# sourceMappingURL=open.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open.d.ts","sourceRoot":"","sources":["../../../src/rules/open.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"open.d.ts","sourceRoot":"","sources":["../../../src/rules/open.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAA4B,MAAM,oBAAoB,CAAC;AAGvE;;GAEG;AACH,wBAAgB,uCAAuC,CAAC,OAAO,EAAE,OAAO,QAwBvE"}
|
package/dist/src/rules/open.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { createRule } from "@typespec/lint";
|
|
2
1
|
import { isComplex, isEntity, isOpen } from "../index.js";
|
|
3
2
|
import { reportDiagnostic } from "../lib.js";
|
|
3
|
+
import { navigateTypesInNamespace } from "@typespec/compiler";
|
|
4
|
+
import { GetDeclaredNamespaces } from "../entities/namespace.js";
|
|
4
5
|
/**
|
|
5
6
|
* @open applies to either an entity or a complex type.
|
|
6
7
|
*/
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return {
|
|
8
|
+
export function validateOpenOnlyAppliesToStructuredType(program) {
|
|
9
|
+
for (const namespace of GetDeclaredNamespaces(program)) {
|
|
10
|
+
navigateTypesInNamespace(namespace, {
|
|
11
11
|
model: (model) => {
|
|
12
12
|
if (!isOpen(program, model)) {
|
|
13
13
|
return;
|
|
@@ -25,7 +25,8 @@ export const openOnlyAppliesToStructuredType = createRule({
|
|
|
25
25
|
},
|
|
26
26
|
});
|
|
27
27
|
},
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
;
|
|
31
32
|
//# sourceMappingURL=open.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open.js","sourceRoot":"","sources":["../../../src/rules/open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"open.js","sourceRoot":"","sources":["../../../src/rules/open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1D,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,uCAAuC,CAAC,OAAgB;IACtE,KAAK,MAAM,SAAS,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAE,CAAC;QACvD,wBAAwB,CAAC,SAAS,EAAE;YAClC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;gBACf,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC;oBAC5B,OAAO;gBACT,CAAC;gBAED,IAAI,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC;oBAC1D,OAAO;gBACT,CAAC;gBAED,gBAAgB,CAAC,OAAO,EAAE;oBACxB,IAAI,EAAE,uBAAuB;oBAC7B,MAAM,EAAE,KAAK;oBACb,SAAS,EAAE,WAAW;oBACtB,MAAM,EAAE;wBACN,SAAS,EAAE,OAAO;wBAClB,MAAM,EAAE,gCAAgC;qBACzC;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAAA,CAAC"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { Program } from "@typespec/compiler";
|
|
2
|
+
export declare function validateOperationInsideInterface(program: Program): void;
|
|
3
|
+
export declare function validateOperationsShouldNotBeAddedToInterfaceWithPartialTypes(program: Program): void;
|
|
4
|
+
export declare const getPutPostAndPatchOperationsShouldHaveSelectDecorator: import("@typespec/compiler").LinterRuleDefinition<"get-put-post-patch-operations-should-have-select-decorator", {
|
|
5
|
+
readonly default: import("@typespec/compiler").CallableMessage<["operation"]>;
|
|
6
|
+
}>;
|
|
2
7
|
//# sourceMappingURL=operation-inside-interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-inside-interface.d.ts","sourceRoot":"","sources":["../../../src/rules/operation-inside-interface.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"operation-inside-interface.d.ts","sourceRoot":"","sources":["../../../src/rules/operation-inside-interface.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAsD,MAAM,oBAAoB,CAAC;AAIjG,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,OAAO,QAqBhE;AAED,wBAAgB,6DAA6D,CAAC,OAAO,EAAE,OAAO,QAuC7F;AAED,eAAO,MAAM,qDAAqD;;EAiChE,CAAA"}
|