@speclynx/apidom-ls 2.11.6 → 2.12.0
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/CHANGELOG.md +14 -0
- package/dist/apidom-ls.browser.min.js +3 -3
- package/package.json +35 -30
- package/src/config/arazzo/JSONSchema/{description--no-script-tags.cjs → lint/description--no-script-tags.cjs} +2 -2
- package/src/config/arazzo/JSONSchema/{description--no-script-tags.mjs → lint/description--no-script-tags.mjs} +2 -2
- package/src/config/arazzo/JSONSchema/lint/index.cjs +81 -0
- package/src/config/arazzo/JSONSchema/lint/index.mjs +72 -0
- package/src/config/arazzo/JSONSchema/{title--no-script-tags.cjs → lint/title--no-script-tags.cjs} +2 -2
- package/src/config/arazzo/JSONSchema/{title--no-script-tags.mjs → lint/title--no-script-tags.mjs} +2 -2
- package/src/config/arazzo/JSONSchema/meta.cjs +2 -2
- package/src/config/arazzo/JSONSchema/meta.mjs +1 -1
- package/src/config/arazzo/arazzoSpecification1/lint/$self--format-uri.cjs +23 -0
- package/src/config/arazzo/arazzoSpecification1/lint/$self--format-uri.mjs +16 -0
- package/src/config/arazzo/arazzoSpecification1/lint/$self--no-fragment.cjs +23 -0
- package/src/config/arazzo/arazzoSpecification1/lint/$self--no-fragment.mjs +16 -0
- package/src/config/{ads/info/lint/title--type.cjs → arazzo/arazzoSpecification1/lint/$self--type.cjs} +8 -6
- package/src/config/{ads/info/lint/description--type.mjs → arazzo/arazzoSpecification1/lint/$self--type.mjs} +8 -6
- package/src/config/arazzo/arazzoSpecification1/lint/{allowed-fields.cjs → allowed-fields-1-0.cjs} +4 -3
- package/src/config/arazzo/arazzoSpecification1/lint/{allowed-fields.mjs → allowed-fields-1-0.mjs} +4 -4
- package/src/config/arazzo/{failureAction/lint/allowed-fields.cjs → arazzoSpecification1/lint/allowed-fields-1-1.cjs} +4 -4
- package/src/config/arazzo/arazzoSpecification1/lint/allowed-fields-1-1.mjs +14 -0
- package/src/config/arazzo/arazzoSpecification1/lint/arazzo--pattern.cjs +2 -2
- package/src/config/arazzo/arazzoSpecification1/lint/arazzo--pattern.mjs +2 -2
- package/src/config/arazzo/arazzoSpecification1/lint/index.cjs +6 -2
- package/src/config/arazzo/arazzoSpecification1/lint/index.mjs +6 -2
- package/src/config/arazzo/config.cjs +6 -4
- package/src/config/arazzo/config.mjs +4 -2
- package/src/config/arazzo/criterion/lint/type--equals.cjs +1 -1
- package/src/config/arazzo/criterion/lint/type--equals.mjs +1 -1
- package/src/config/arazzo/{criterionExpressionType → expressionType}/lint/index.cjs +7 -3
- package/src/config/arazzo/expressionType/lint/index.mjs +12 -0
- package/src/config/arazzo/{criterionExpressionType/lint/type--equals.cjs → expressionType/lint/type--equals-1-0.cjs} +5 -4
- package/src/config/arazzo/{criterionExpressionType/lint/type--equals.mjs → expressionType/lint/type--equals-1-0.mjs} +5 -5
- package/src/config/arazzo/expressionType/lint/type--equals-1-1.cjs +23 -0
- package/src/config/arazzo/expressionType/lint/type--equals-1-1.mjs +16 -0
- package/src/config/arazzo/{criterionExpressionType → expressionType}/lint/type--required.cjs +1 -1
- package/src/config/arazzo/{criterionExpressionType → expressionType}/lint/type--required.mjs +1 -1
- package/src/config/arazzo/{criterionExpressionType → expressionType}/lint/type--type.cjs +1 -1
- package/src/config/arazzo/{criterionExpressionType → expressionType}/lint/type--type.mjs +1 -1
- package/src/config/arazzo/expressionType/lint/version--equals-jsonpath.cjs +30 -0
- package/src/config/arazzo/expressionType/lint/version--equals-jsonpath.mjs +23 -0
- package/src/config/arazzo/expressionType/lint/version--equals-jsonpointer.cjs +30 -0
- package/src/config/arazzo/expressionType/lint/version--equals-jsonpointer.mjs +23 -0
- package/src/config/arazzo/expressionType/lint/version--equals-xpath.cjs +30 -0
- package/src/config/arazzo/expressionType/lint/version--equals-xpath.mjs +23 -0
- package/src/config/arazzo/{criterionExpressionType/lint/version--required.cjs → expressionType/lint/version--required-1-0.cjs} +9 -4
- package/src/config/arazzo/expressionType/lint/version--required-1-0.mjs +26 -0
- package/src/config/arazzo/{criterionExpressionType → expressionType}/lint/version--type.cjs +1 -1
- package/src/config/arazzo/{criterionExpressionType → expressionType}/lint/version--type.mjs +1 -1
- package/src/config/arazzo/failureAction/lint/allowed-fields-1-0.cjs +27 -0
- package/src/config/arazzo/failureAction/lint/allowed-fields-1-0.mjs +19 -0
- package/src/config/arazzo/failureAction/lint/allowed-fields-1-1.cjs +25 -0
- package/src/config/arazzo/failureAction/lint/{allowed-fields.mjs → allowed-fields-1-1.mjs} +9 -5
- package/src/config/arazzo/failureAction/lint/index.cjs +8 -2
- package/src/config/arazzo/failureAction/lint/index.mjs +8 -2
- package/src/config/arazzo/failureAction/lint/name--required.cjs +4 -0
- package/src/config/arazzo/failureAction/lint/name--required.mjs +4 -0
- package/src/config/arazzo/failureAction/lint/parameters--only-workflow-id.cjs +28 -0
- package/src/config/arazzo/failureAction/lint/parameters--only-workflow-id.mjs +21 -0
- package/src/config/arazzo/failureAction/lint/parameters--type.cjs +23 -0
- package/src/config/arazzo/failureAction/lint/parameters--type.mjs +16 -0
- package/src/config/arazzo/failureAction/lint/step-id--pattern.cjs +26 -0
- package/src/config/arazzo/failureAction/lint/step-id--pattern.mjs +18 -0
- package/src/config/arazzo/failureAction/lint/type--required.cjs +4 -0
- package/src/config/arazzo/failureAction/lint/type--required.mjs +4 -0
- package/src/config/arazzo/failureAction/lint/workflow-id--pattern.cjs +35 -0
- package/src/config/arazzo/failureAction/lint/workflow-id--pattern.mjs +27 -0
- package/src/config/arazzo/failureAction/lint/workflow-id--source-type-consistency.cjs +23 -0
- package/src/config/arazzo/failureAction/lint/workflow-id--source-type-consistency.mjs +16 -0
- package/src/config/arazzo/parameter/lint/allowed-fields.cjs +4 -0
- package/src/config/arazzo/parameter/lint/allowed-fields.mjs +4 -0
- package/src/config/arazzo/parameter/lint/name--required.cjs +4 -0
- package/src/config/arazzo/parameter/lint/name--required.mjs +4 -0
- package/src/config/arazzo/parameter/lint/value--required.cjs +4 -0
- package/src/config/arazzo/parameter/lint/value--required.mjs +4 -0
- package/src/config/arazzo/payloadReplacement/lint/allowed-fields-1-0.cjs +23 -0
- package/src/config/arazzo/payloadReplacement/lint/allowed-fields-1-0.mjs +15 -0
- package/src/config/arazzo/{successAction/lint/allowed-fields.cjs → payloadReplacement/lint/allowed-fields-1-1.cjs} +4 -4
- package/src/config/arazzo/{successAction/lint/allowed-fields.mjs → payloadReplacement/lint/allowed-fields-1-1.mjs} +5 -5
- package/src/config/arazzo/payloadReplacement/lint/index.cjs +5 -2
- package/src/config/arazzo/payloadReplacement/lint/index.mjs +5 -2
- package/src/config/arazzo/payloadReplacement/lint/target-selector-type--equals.cjs +30 -0
- package/src/config/arazzo/payloadReplacement/lint/target-selector-type--equals.mjs +23 -0
- package/src/config/arazzo/payloadReplacement/lint/target-selector-type--type.cjs +31 -0
- package/src/config/arazzo/payloadReplacement/lint/target-selector-type--type.mjs +24 -0
- package/src/config/arazzo/{payloadReplacement → selector}/lint/allowed-fields.cjs +2 -2
- package/src/config/arazzo/{payloadReplacement → selector}/lint/allowed-fields.mjs +3 -3
- package/src/config/arazzo/selector/lint/context--type.cjs +23 -0
- package/src/config/arazzo/selector/lint/context--type.mjs +16 -0
- package/src/config/arazzo/selector/lint/index.cjs +18 -0
- package/src/config/arazzo/selector/lint/index.mjs +10 -0
- package/src/config/arazzo/selector/lint/selector--type.cjs +23 -0
- package/src/config/arazzo/selector/lint/selector--type.mjs +16 -0
- package/src/config/arazzo/selector/lint/type--equals.cjs +30 -0
- package/src/config/arazzo/selector/lint/type--equals.mjs +23 -0
- package/src/config/arazzo/selector/lint/type--type.cjs +31 -0
- package/src/config/arazzo/selector/lint/type--type.mjs +24 -0
- package/src/config/{ads/info → arazzo/selector}/meta.cjs +1 -5
- package/src/config/arazzo/selector/meta.mjs +5 -0
- package/src/config/arazzo/sourceDescription/lint/index.cjs +3 -2
- package/src/config/arazzo/sourceDescription/lint/index.mjs +3 -2
- package/src/config/arazzo/sourceDescription/lint/name--pattern.cjs +2 -2
- package/src/config/arazzo/sourceDescription/lint/name--pattern.mjs +2 -2
- package/src/config/arazzo/sourceDescription/lint/{type--equals.cjs → type--equals-1-0.cjs} +3 -3
- package/src/config/arazzo/sourceDescription/lint/{type--equals.mjs → type--equals-1-0.mjs} +4 -4
- package/src/config/arazzo/sourceDescription/lint/type--equals-1-1.cjs +23 -0
- package/src/config/arazzo/sourceDescription/lint/type--equals-1-1.mjs +16 -0
- package/src/config/arazzo/step/lint/action--equals.cjs +23 -0
- package/src/config/arazzo/step/lint/action--equals.mjs +16 -0
- package/src/config/{ads/info/lint/description--type.cjs → arazzo/step/lint/action--type.cjs} +8 -6
- package/src/config/arazzo/step/lint/action--type.mjs +16 -0
- package/src/config/arazzo/step/lint/{allowed-fields.cjs → allowed-fields-1-0.cjs} +5 -3
- package/src/config/arazzo/step/lint/{allowed-fields.mjs → allowed-fields-1-0.mjs} +5 -4
- package/src/config/arazzo/step/lint/allowed-fields-1-1.cjs +21 -0
- package/src/config/arazzo/step/lint/allowed-fields-1-1.mjs +14 -0
- package/src/config/arazzo/step/lint/channel-path--mutually-exclusive.cjs +28 -0
- package/src/config/arazzo/step/lint/channel-path--mutually-exclusive.mjs +21 -0
- package/src/config/arazzo/step/lint/channel-path--type.cjs +23 -0
- package/src/config/arazzo/step/lint/channel-path--type.mjs +16 -0
- package/src/config/arazzo/step/lint/correlation-id--only-action-receive.cjs +34 -0
- package/src/config/arazzo/step/lint/correlation-id--only-action-receive.mjs +26 -0
- package/src/config/arazzo/step/lint/correlation-id--requires-action.cjs +30 -0
- package/src/config/arazzo/step/lint/correlation-id--requires-action.mjs +22 -0
- package/src/config/arazzo/step/lint/depends-on--resolved.cjs +32 -0
- package/src/config/arazzo/step/lint/depends-on--resolved.mjs +24 -0
- package/src/config/arazzo/step/lint/depends-on--source-type-consistency.cjs +23 -0
- package/src/config/arazzo/step/lint/depends-on--source-type-consistency.mjs +16 -0
- package/src/config/arazzo/step/lint/depends-on--type.cjs +23 -0
- package/src/config/arazzo/step/lint/depends-on--type.mjs +16 -0
- package/src/config/arazzo/step/lint/depends-on--unique.cjs +23 -0
- package/src/config/arazzo/step/lint/depends-on--unique.mjs +16 -0
- package/src/config/arazzo/step/lint/index.cjs +20 -3
- package/src/config/arazzo/step/lint/index.mjs +20 -3
- package/src/config/arazzo/step/lint/operation-id--mutually-exclusive.cjs +2 -2
- package/src/config/arazzo/step/lint/operation-id--mutually-exclusive.mjs +2 -2
- package/src/config/arazzo/step/lint/operation-id--source-type-consistency-1-0.cjs +25 -0
- package/src/config/arazzo/step/lint/operation-id--source-type-consistency-1-0.mjs +17 -0
- package/src/config/arazzo/step/lint/operation-id--source-type-consistency-1-1.cjs +23 -0
- package/src/config/arazzo/step/lint/operation-id--source-type-consistency-1-1.mjs +16 -0
- package/src/config/arazzo/step/lint/operation-path--mutually-exclusive.cjs +2 -2
- package/src/config/arazzo/step/lint/operation-path--mutually-exclusive.mjs +2 -2
- package/src/config/arazzo/step/lint/{outputs--values-type.cjs → outputs--values-type-1-0.cjs} +5 -3
- package/src/config/arazzo/step/lint/{outputs--values-type.mjs → outputs--values-type-1-0.mjs} +5 -4
- package/src/config/arazzo/step/lint/outputs--values-type-1-1.cjs +24 -0
- package/src/config/arazzo/step/lint/outputs--values-type-1-1.mjs +16 -0
- package/src/config/arazzo/step/lint/step-id--pattern.cjs +2 -2
- package/src/config/arazzo/step/lint/step-id--pattern.mjs +2 -2
- package/src/config/arazzo/step/lint/timeout--type.cjs +23 -0
- package/src/config/arazzo/step/lint/timeout--type.mjs +16 -0
- package/src/config/arazzo/step/lint/workflow-id--mutually-exclusive.cjs +2 -2
- package/src/config/arazzo/step/lint/workflow-id--mutually-exclusive.mjs +2 -2
- package/src/config/arazzo/step/lint/workflow-id--pattern.cjs +34 -0
- package/src/config/arazzo/step/lint/workflow-id--pattern.mjs +26 -0
- package/src/config/arazzo/step/lint/workflow-id--source-type-consistency.cjs +23 -0
- package/src/config/arazzo/step/lint/workflow-id--source-type-consistency.mjs +16 -0
- package/src/config/arazzo/successAction/lint/allowed-fields-1-0.cjs +27 -0
- package/src/config/arazzo/successAction/lint/allowed-fields-1-0.mjs +19 -0
- package/src/config/arazzo/successAction/lint/allowed-fields-1-1.cjs +25 -0
- package/src/config/arazzo/successAction/lint/allowed-fields-1-1.mjs +18 -0
- package/src/config/arazzo/successAction/lint/index.cjs +8 -2
- package/src/config/arazzo/successAction/lint/index.mjs +8 -2
- package/src/config/arazzo/successAction/lint/name--required.cjs +4 -0
- package/src/config/arazzo/successAction/lint/name--required.mjs +4 -0
- package/src/config/arazzo/successAction/lint/parameters--only-workflow-id.cjs +28 -0
- package/src/config/arazzo/successAction/lint/parameters--only-workflow-id.mjs +21 -0
- package/src/config/arazzo/successAction/lint/parameters--type.cjs +23 -0
- package/src/config/arazzo/successAction/lint/parameters--type.mjs +16 -0
- package/src/config/arazzo/successAction/lint/step-id--pattern.cjs +26 -0
- package/src/config/arazzo/successAction/lint/step-id--pattern.mjs +18 -0
- package/src/config/arazzo/successAction/lint/type--required.cjs +4 -0
- package/src/config/arazzo/successAction/lint/type--required.mjs +4 -0
- package/src/config/arazzo/successAction/lint/workflow-id--pattern.cjs +35 -0
- package/src/config/arazzo/successAction/lint/workflow-id--pattern.mjs +27 -0
- package/src/config/arazzo/successAction/lint/workflow-id--source-type-consistency.cjs +23 -0
- package/src/config/arazzo/successAction/lint/workflow-id--source-type-consistency.mjs +16 -0
- package/src/config/arazzo/target-specs.cjs +33 -5
- package/src/config/arazzo/target-specs.mjs +32 -4
- package/src/config/arazzo/workflow/lint/depends-on--source-type-consistency.cjs +23 -0
- package/src/config/arazzo/workflow/lint/depends-on--source-type-consistency.mjs +16 -0
- package/src/config/arazzo/workflow/lint/index.cjs +4 -2
- package/src/config/arazzo/workflow/lint/index.mjs +4 -2
- package/src/config/arazzo/workflow/lint/{outputs--values-type.cjs → outputs--values-type-1-0.cjs} +5 -3
- package/src/config/arazzo/workflow/lint/{outputs--values-type.mjs → outputs--values-type-1-0.mjs} +5 -4
- package/src/config/arazzo/workflow/lint/outputs--values-type-1-1.cjs +24 -0
- package/src/config/arazzo/workflow/lint/outputs--values-type-1-1.mjs +16 -0
- package/src/config/arazzo/workflow/lint/workflow-id--pattern.cjs +2 -2
- package/src/config/arazzo/workflow/lint/workflow-id--pattern.mjs +2 -2
- package/src/config/codes.cjs +50 -17
- package/src/config/codes.mjs +50 -17
- package/src/config/config.cjs +6 -8
- package/src/config/config.mjs +0 -2
- package/src/config/openapi/schema/lint.cjs +5 -1
- package/src/config/openapi/schema/lint.mjs +5 -1
- package/src/config/symbols.cjs +3 -4
- package/src/config/symbols.mjs +1 -2
- package/src/config/tokens.cjs +5 -6
- package/src/config/tokens.mjs +1 -2
- package/src/index.cjs +7 -0
- package/src/index.mjs +1 -0
- package/src/services/completion/completion-service.cjs +1 -1
- package/src/services/completion/completion-service.mjs +1 -1
- package/src/services/hover/hover-service.cjs +1 -1
- package/src/services/hover/hover-service.mjs +1 -1
- package/src/services/validation/linter-functions.cjs +150 -1
- package/src/services/validation/linter-functions.mjs +151 -2
- package/src/services/validation/providers/arazzo-11-json-schema-validation-provider.cjs +852 -0
- package/src/services/validation/providers/arazzo-11-json-schema-validation-provider.mjs +845 -0
- package/src/services/validation/validation-service.cjs +12 -4
- package/src/services/validation/validation-service.mjs +12 -4
- package/src/utils/utils.cjs +5 -1
- package/src/utils/utils.mjs +5 -1
- package/types/apidom-ls.d.ts +82 -17
- package/src/config/ads/config.cjs +0 -25
- package/src/config/ads/config.mjs +0 -18
- package/src/config/ads/info/completion.cjs +0 -31
- package/src/config/ads/info/completion.mjs +0 -25
- package/src/config/ads/info/documentation.cjs +0 -14
- package/src/config/ads/info/documentation.mjs +0 -8
- package/src/config/ads/info/lint/allowed-fields.cjs +0 -19
- package/src/config/ads/info/lint/allowed-fields.mjs +0 -12
- package/src/config/ads/info/lint/index.cjs +0 -13
- package/src/config/ads/info/lint/index.mjs +0 -6
- package/src/config/ads/info/lint/title--required.cjs +0 -27
- package/src/config/ads/info/lint/title--required.mjs +0 -20
- package/src/config/ads/info/lint/title--type.mjs +0 -14
- package/src/config/ads/info/meta.mjs +0 -9
- package/src/config/ads/main/completion.cjs +0 -72
- package/src/config/ads/main/completion.mjs +0 -66
- package/src/config/ads/main/documentation.cjs +0 -23
- package/src/config/ads/main/documentation.mjs +0 -17
- package/src/config/ads/main/lint/allowed-fields.cjs +0 -19
- package/src/config/ads/main/lint/allowed-fields.mjs +0 -12
- package/src/config/ads/main/lint/index.cjs +0 -14
- package/src/config/ads/main/lint/index.mjs +0 -7
- package/src/config/ads/main/lint/info--required.cjs +0 -27
- package/src/config/ads/main/lint/info--required.mjs +0 -20
- package/src/config/ads/main/lint/info--type.cjs +0 -21
- package/src/config/ads/main/lint/info--type.mjs +0 -14
- package/src/config/ads/main/lint/version--pattern.cjs +0 -27
- package/src/config/ads/main/lint/version--pattern.mjs +0 -20
- package/src/config/ads/main/lint/version--required.cjs +0 -27
- package/src/config/ads/main/lint/version--required.mjs +0 -20
- package/src/config/ads/main/meta.cjs +0 -16
- package/src/config/ads/main/meta.mjs +0 -9
- package/src/config/ads/symbols.cjs +0 -8
- package/src/config/ads/symbols.mjs +0 -2
- package/src/config/ads/tokens.cjs +0 -8
- package/src/config/ads/tokens.mjs +0 -2
- package/src/config/arazzo/JSONSchema/lint.cjs +0 -77
- package/src/config/arazzo/JSONSchema/lint.mjs +0 -68
- package/src/config/arazzo/criterionExpressionType/lint/index.mjs +0 -8
- package/src/config/arazzo/criterionExpressionType/lint/version--required.mjs +0 -22
- /package/src/config/arazzo/{criterionExpressionType → expressionType}/lint/allowed-fields.cjs +0 -0
- /package/src/config/arazzo/{criterionExpressionType → expressionType}/lint/allowed-fields.mjs +0 -0
- /package/src/config/arazzo/{criterionExpressionType → expressionType}/meta.cjs +0 -0
- /package/src/config/arazzo/{criterionExpressionType → expressionType}/meta.mjs +0 -0
package/src/config/config.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import configAsyncAPI from "./asyncapi/config.mjs";
|
|
2
2
|
import configOpenAPI from "./openapi/config.mjs";
|
|
3
|
-
import configADS from "./ads/config.mjs";
|
|
4
3
|
import configJSONSchema202012 from "./json-schema/2020-12/config.mjs";
|
|
5
4
|
import configArazzo from "./arazzo/config.mjs";
|
|
6
5
|
import configOverlay from "./overlay/config.mjs";
|
|
@@ -16,7 +15,6 @@ export function config() {
|
|
|
16
15
|
metadataMaps: {
|
|
17
16
|
openapi: configOpenAPI,
|
|
18
17
|
asyncapi: configAsyncAPI,
|
|
19
|
-
ads: configADS,
|
|
20
18
|
arazzo: configArazzo,
|
|
21
19
|
overlay: configOverlay,
|
|
22
20
|
'json-schema-2020-12': configJSONSchema202012
|
|
@@ -86,7 +86,11 @@ var _writeOnlyType = _interopRequireDefault(require("../../common/schema/lint/wr
|
|
|
86
86
|
var _exampleDeprecated = _interopRequireDefault(require("../../common/schema/lint/example--deprecated.cjs"));
|
|
87
87
|
var _typeArrayNonItems = _interopRequireDefault(require("../../common/schema/lint/type--array-non-items.cjs"));
|
|
88
88
|
var _targetSpecs2 = require("../target-specs.cjs");
|
|
89
|
-
// below are older rule variants that need to be replaced
|
|
89
|
+
// below are older rule variants that need to be replaced.
|
|
90
|
+
// $id and $ref are deliberately absent: the composed JSON Schema 2020-12 rules
|
|
91
|
+
// above already cover them (codes 8030100 / 8030300). importing the
|
|
92
|
+
// common/schema equivalents ($id--format-uri, $ref--valid) adds functionally
|
|
93
|
+
// identical rules and yields duplicate diagnostics on the same range.
|
|
90
94
|
|
|
91
95
|
const schemaLints = [...(0, _targetSpecs.compose)([_lint.default], (0, _targetSpecs.assoc)(_targetSpecs2.OpenAPI31)), _additionalItemsNonArray.default, _additionalItemsType.default, _additionalItemsTypeOpenapi31Asyncapi.default, _additionalPropertiesNonObject.default, _additionalPropertiesType.default, _allOfType.default, _allOfTypeOpenapi31Asyncapi.default, _anyOfTypeOpenapi31Asyncapi.default, _anyOfType.default, _containsNonArray.default, _containsType.default, _containsTypeOpenapi31Asyncapi.default, _descriptionType.default, _discriminatorExistInRequired.default, _discriminatorTypeOpenapi.default, _elseNonIf.default, _elseType.default, _enumUnique.default, _examplesType.default, _exclusiveMaximumTypeNumber.default, _exclusiveMaximumTypeBoolean.default, _exclusiveMinimumTypeNumber.default, _exclusiveMinimumTypeBoolean.default, _xmlType.default, _externalDocsType.default, _formatType.default, _ifNonThen.default, _ifType.default, _itemsNonArray.default, _itemsType.default, _maxItemsNonArray.default, _maxItemsType.default, _maxLengthNonString.default, _maxLengthType.default, _maxPropertiesNonObject.default, _maxPropertiesType.default, _maximumType.default, _minItemsNonArray.default, _minItemsType.default, _minLengthNonString.default, _minLengthType.default, _minPropertiesNonObject.default, _minPropertiesType.default, _minimumType.default, _missingCoreFieldsOpenapi.default, _multipleOfType.default, _notType.default, _notTypeOpenapi31Asyncapi.default, _nullableType.default, _nullableNotRecommended.default, _oneOfType.default, _oneOfTypeOpenapi31Asyncapi.default, _patternType.default, _patternPropertiesKeysRegexp.default, _patternPropertiesNonObject.default, _patternPropertiesType.default, _patternPropertiesValuesType.default, _propertiesNonObject.default, _propertiesType.default, _propertiesValuesType.default, _propertiesValuesTypeOpenapi31Asyncapi.default, _propertyNamesNonObject.default, _propertyNamesType.default, _readOnlyType.default, _requiredDefined.default, _requiredNonObject.default, _requiredType.default, _thenNonIf.default, _thenType.default, _titleType.default, _typeType.default, _typeEquals.default, _typeEqualsOpenapi31Asyncapi.default, _uniqueItemsNonArray.default, _uniqueItemsType.default, _writeOnlyType.default, _exampleDeprecated.default, _typeArrayNonItems.default];
|
|
92
96
|
var _default = exports.default = schemaLints;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import jsonSchema202012Lint from "../../json-schema/2020-12/json-schema/lint.mjs";
|
|
2
|
-
import { compose, assoc } from "../../json-schema/2020-12/target-specs.mjs"; // below are older rule variants that need to be replaced
|
|
2
|
+
import { compose, assoc } from "../../json-schema/2020-12/target-specs.mjs"; // below are older rule variants that need to be replaced.
|
|
3
|
+
// $id and $ref are deliberately absent: the composed JSON Schema 2020-12 rules
|
|
4
|
+
// above already cover them (codes 8030100 / 8030300). importing the
|
|
5
|
+
// common/schema equivalents ($id--format-uri, $ref--valid) adds functionally
|
|
6
|
+
// identical rules and yields duplicate diagnostics on the same range.
|
|
3
7
|
import additionalItemsNonArrayLint from "../../common/schema/lint/additional-items--non-array.mjs";
|
|
4
8
|
import additionalItemsTypeLint from "../../common/schema/lint/additional-items--type.mjs";
|
|
5
9
|
import additionalItemsTypeOpenAPI3_1__AsyncAPI2Lint from "../../common/schema/lint/additional-items--type-openapi-3-1--asyncapi-2.mjs";
|
package/src/config/symbols.cjs
CHANGED
|
@@ -5,9 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _symbols = _interopRequireDefault(require("./
|
|
9
|
-
var _symbols2 = _interopRequireDefault(require("./
|
|
10
|
-
var _symbols3 = _interopRequireDefault(require("./openapi/symbols.cjs"));
|
|
8
|
+
var _symbols = _interopRequireDefault(require("./asyncapi/symbols.cjs"));
|
|
9
|
+
var _symbols2 = _interopRequireDefault(require("./openapi/symbols.cjs"));
|
|
11
10
|
// creating list of unique symbols
|
|
12
|
-
const symbols = Array.from(new Set([..._symbols.default, ..._symbols2.default
|
|
11
|
+
const symbols = Array.from(new Set([..._symbols.default, ..._symbols2.default]));
|
|
13
12
|
var _default = exports.default = symbols;
|
package/src/config/symbols.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import adsSymbols from "./ads/symbols.mjs";
|
|
2
1
|
import asyncapiSymbols from "./asyncapi/symbols.mjs";
|
|
3
2
|
import openapiSymbols from "./openapi/symbols.mjs"; // creating list of unique symbols
|
|
4
|
-
const symbols = Array.from(new Set([...
|
|
3
|
+
const symbols = Array.from(new Set([...asyncapiSymbols, ...openapiSymbols]));
|
|
5
4
|
export default symbols;
|
package/src/config/tokens.cjs
CHANGED
|
@@ -5,11 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _tokens = _interopRequireDefault(require("./
|
|
9
|
-
var _tokens2 = _interopRequireDefault(require("./
|
|
10
|
-
var _tokens3 = _interopRequireDefault(require("./
|
|
11
|
-
var _tokens4 = _interopRequireDefault(require("./
|
|
12
|
-
var _tokens5 = _interopRequireDefault(require("./overlay/tokens.cjs"));
|
|
8
|
+
var _tokens = _interopRequireDefault(require("./arazzo/tokens.cjs"));
|
|
9
|
+
var _tokens2 = _interopRequireDefault(require("./asyncapi/tokens.cjs"));
|
|
10
|
+
var _tokens3 = _interopRequireDefault(require("./openapi/tokens.cjs"));
|
|
11
|
+
var _tokens4 = _interopRequireDefault(require("./overlay/tokens.cjs"));
|
|
13
12
|
// creating list of unique tokens
|
|
14
|
-
const tokens = Array.from(new Set(['value', 'string', 'number', 'key', ...
|
|
13
|
+
const tokens = Array.from(new Set(['value', 'string', 'number', 'key', ..._tokens2.default, ..._tokens3.default, ..._tokens.default, ..._tokens4.default]));
|
|
15
14
|
var _default = exports.default = tokens;
|
package/src/config/tokens.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import adsTokens from "./ads/tokens.mjs";
|
|
2
1
|
import arazzoTokens from "./arazzo/tokens.mjs";
|
|
3
2
|
import asyncapiTokens from "./asyncapi/tokens.mjs";
|
|
4
3
|
import openapiTokens from "./openapi/tokens.mjs";
|
|
5
4
|
import overlayTokens from "./overlay/tokens.mjs"; // creating list of unique tokens
|
|
6
|
-
const tokens = Array.from(new Set(['value', 'string', 'number', 'key', ...
|
|
5
|
+
const tokens = Array.from(new Set(['value', 'string', 'number', 'key', ...asyncapiTokens, ...openapiTokens, ...arazzoTokens, ...overlayTokens]));
|
|
7
6
|
export default tokens;
|
package/src/index.cjs
CHANGED
|
@@ -10,6 +10,12 @@ Object.defineProperty(exports, "ApilintCodes", {
|
|
|
10
10
|
return _codes.default;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
|
+
Object.defineProperty(exports, "Arazzo11JsonSchemaValidationProvider", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _arazzo11JsonSchemaValidationProvider.Arazzo11JsonSchemaValidationProvider;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
13
19
|
Object.defineProperty(exports, "Arazzo1JsonSchemaValidationProvider", {
|
|
14
20
|
enumerable: true,
|
|
15
21
|
get: function () {
|
|
@@ -279,6 +285,7 @@ var _openapi20JsonSchemaValidationProvider = require("./services/validation/prov
|
|
|
279
285
|
var _openapi30JsonSchemaValidationProvider = require("./services/validation/providers/openapi-30-json-schema-validation-provider.cjs");
|
|
280
286
|
var _openapi31JsonSchemaValidationProvider = require("./services/validation/providers/openapi-31-json-schema-validation-provider.cjs");
|
|
281
287
|
var _arazzo1JsonSchemaValidationProvider = require("./services/validation/providers/arazzo-1-json-schema-validation-provider.cjs");
|
|
288
|
+
var _arazzo11JsonSchemaValidationProvider = require("./services/validation/providers/arazzo-11-json-schema-validation-provider.cjs");
|
|
282
289
|
var _overlay1JsonSchemaValidationProvider = require("./services/validation/providers/overlay-1-json-schema-validation-provider.cjs");
|
|
283
290
|
var _codes = _interopRequireDefault(require("./config/codes.cjs"));
|
|
284
291
|
var _utils = require("./utils/utils.cjs");
|
package/src/index.mjs
CHANGED
|
@@ -3,6 +3,7 @@ export { OpenAPi20JsonSchemaValidationProvider } from "./services/validation/pro
|
|
|
3
3
|
export { OpenAPi30JsonSchemaValidationProvider } from "./services/validation/providers/openapi-30-json-schema-validation-provider.mjs";
|
|
4
4
|
export { OpenAPi31JsonSchemaValidationProvider } from "./services/validation/providers/openapi-31-json-schema-validation-provider.mjs";
|
|
5
5
|
export { Arazzo1JsonSchemaValidationProvider } from "./services/validation/providers/arazzo-1-json-schema-validation-provider.mjs";
|
|
6
|
+
export { Arazzo11JsonSchemaValidationProvider } from "./services/validation/providers/arazzo-11-json-schema-validation-provider.mjs";
|
|
6
7
|
export { Overlay1JsonSchemaValidationProvider } from "./services/validation/providers/overlay-1-json-schema-validation-provider.mjs";
|
|
7
8
|
export { default as ApilintCodes } from "./config/codes.mjs";
|
|
8
9
|
export { perfStart, perfEnd, isJsonDoc, isJsonDocSync, isYamlDoc, getText, findNamespace } from "./utils/utils.mjs";
|
|
@@ -851,7 +851,7 @@ class DefaultCompletionService {
|
|
|
851
851
|
let func = _linterFunctions.standardLinterfunctionsMap.get(funcName);
|
|
852
852
|
// else get it from configuration
|
|
853
853
|
if (!func) {
|
|
854
|
-
func = this.settings?.metadata?.linterFunctions[docNs][funcName];
|
|
854
|
+
func = this.settings?.metadata?.linterFunctions?.[docNs]?.[funcName];
|
|
855
855
|
}
|
|
856
856
|
if (func) {
|
|
857
857
|
try {
|
|
@@ -845,7 +845,7 @@ export class DefaultCompletionService {
|
|
|
845
845
|
let func = standardLinterfunctionsMap.get(funcName);
|
|
846
846
|
// else get it from configuration
|
|
847
847
|
if (!func) {
|
|
848
|
-
func = this.settings?.metadata?.linterFunctions[docNs][funcName];
|
|
848
|
+
func = this.settings?.metadata?.linterFunctions?.[docNs]?.[funcName];
|
|
849
849
|
}
|
|
850
850
|
if (func) {
|
|
851
851
|
try {
|
|
@@ -262,7 +262,7 @@ class DefaultHoverService {
|
|
|
262
262
|
return res;
|
|
263
263
|
}
|
|
264
264
|
getMetadataPropertyDocs(node, ns, key, specVersion) {
|
|
265
|
-
const map = this.settings?.metadata?.metadataMaps[ns] || {};
|
|
265
|
+
const map = this.settings?.metadata?.metadataMaps?.[ns] || {};
|
|
266
266
|
if (node.parent && (0, _utils.isMember)(node.parent)) {
|
|
267
267
|
const containerNode = node.parent.parent;
|
|
268
268
|
const nodeKey = (0, _apidomCore.toValue)(node.parent.key);
|
|
@@ -256,7 +256,7 @@ export class DefaultHoverService {
|
|
|
256
256
|
return res;
|
|
257
257
|
}
|
|
258
258
|
getMetadataPropertyDocs(node, ns, key, specVersion) {
|
|
259
|
-
const map = this.settings?.metadata?.metadataMaps[ns] || {};
|
|
259
|
+
const map = this.settings?.metadata?.metadataMaps?.[ns] || {};
|
|
260
260
|
if (node.parent && isMember(node.parent)) {
|
|
261
261
|
const containerNode = node.parent.parent;
|
|
262
262
|
const nodeKey = toValue(node.parent.key);
|
|
@@ -132,6 +132,47 @@ const casing = (value, casingStyle, noNumbers, separatorChar, separatorAsFirstCh
|
|
|
132
132
|
}
|
|
133
133
|
return getCachedRegex(pattern).test(value);
|
|
134
134
|
};
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Looks up a Source Description Object by `name` and returns its declared `type`, or `undefined`
|
|
138
|
+
* when the source doesn't exist locally or omits `type` (it's optional per spec).
|
|
139
|
+
*/
|
|
140
|
+
const resolveArazzoSourceDescriptionType = (api, sourceName) => {
|
|
141
|
+
const sourceDescriptions = getElementsByTypeOrClass(api, 'sourceDescription');
|
|
142
|
+
const matchingSource = sourceDescriptions.find(sd => (0, _utils.isObject)(sd) && sd.hasKey('name') && (0, _apidomCore.toValue)(sd.get('name')) === sourceName);
|
|
143
|
+
if (!matchingSource || !(0, _utils.isObject)(matchingSource) || !matchingSource.hasKey('type')) {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
const declaredType = (0, _apidomCore.toValue)(matchingSource.get('type'));
|
|
147
|
+
return typeof declaredType === 'string' ? declaredType : undefined;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Shared by apilintArazzoSourceDescriptionTypeConsistency and its array variant. Non-string,
|
|
152
|
+
* non-`$sourceDescriptions.`-prefixed, or unparseable values are treated as "not this check's
|
|
153
|
+
* concern" (true) - other rules cover type/shape. Explicitly checks `=== undefined` rather than
|
|
154
|
+
* a falsy check, so a source with `type: ''` (already invalid on its own) doesn't get treated the
|
|
155
|
+
* same as a source that simply omits `type`.
|
|
156
|
+
*/
|
|
157
|
+
const isArazzoSourceDescriptionTypeConsistent = (value, expectedTypes, api) => {
|
|
158
|
+
if (typeof value !== 'string' || !value.startsWith('$sourceDescriptions.')) return true;
|
|
159
|
+
const {
|
|
160
|
+
result,
|
|
161
|
+
tree
|
|
162
|
+
} = (0, _arazzoRuntimeExpression.parse)(value);
|
|
163
|
+
if (!result.success || !tree || tree.type !== 'SourceDescriptionsExpression') return true;
|
|
164
|
+
const declaredType = resolveArazzoSourceDescriptionType(api, tree.sourceName);
|
|
165
|
+
if (declaredType === undefined) return true;
|
|
166
|
+
return expectedTypes.includes(declaredType);
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Shared by apilintArazzoWorkflowIdResolved and apilintArazzoStepDependsOnResolved: finds a
|
|
171
|
+
* `workflow` element by its `workflowId` field within an already-collected list of workflows.
|
|
172
|
+
* Takes the list rather than `api` so callers that check multiple ids (e.g. across a `dependsOn`
|
|
173
|
+
* array) can collect it once and reuse it, instead of re-walking the tree per id.
|
|
174
|
+
*/
|
|
175
|
+
const findArazzoWorkflowByWorkflowId = (workflows, workflowId) => workflows.find(w => (0, _utils.isObject)(w) && w.hasKey('workflowId') && (0, _apidomCore.toValue)(w.get('workflowId')) === workflowId);
|
|
135
176
|
const isType = (element, elementType) => {
|
|
136
177
|
switch (elementType) {
|
|
137
178
|
case 'object':
|
|
@@ -454,6 +495,22 @@ const standardLinterfunctions = exports.standardLinterfunctions = [{
|
|
|
454
495
|
}
|
|
455
496
|
return true;
|
|
456
497
|
}
|
|
498
|
+
}, {
|
|
499
|
+
functionName: 'apilintChildrenOfTypeOrElementClass',
|
|
500
|
+
function: (element, type, elementsOrClasses, nonEmpty) => {
|
|
501
|
+
if (element && (0, _utils.isObject)(element)) {
|
|
502
|
+
for (const member of element) {
|
|
503
|
+
const value = member.value;
|
|
504
|
+
if (!isType(value, type) && !apilintElementOrClass(value, elementsOrClasses)) {
|
|
505
|
+
return false;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
if (nonEmpty && element.length === 0) {
|
|
509
|
+
return false;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
return true;
|
|
513
|
+
}
|
|
457
514
|
}, {
|
|
458
515
|
functionName: 'apilintKeyIsRegex',
|
|
459
516
|
function: element => {
|
|
@@ -589,6 +646,72 @@ const standardLinterfunctions = exports.standardLinterfunctions = [{
|
|
|
589
646
|
}
|
|
590
647
|
return true;
|
|
591
648
|
}
|
|
649
|
+
}, {
|
|
650
|
+
functionName: 'apilintArazzoStepDependsOnResolved',
|
|
651
|
+
function: element => {
|
|
652
|
+
// `element` is expected to be the step object (no `target` set), so its parent is the
|
|
653
|
+
// `steps` array of the workflow it belongs to. Unlike workflowId, stepId is only unique
|
|
654
|
+
// within a workflow, so a plain entry must resolve against that workflow's own steps
|
|
655
|
+
// rather than a document-wide search.
|
|
656
|
+
//
|
|
657
|
+
// `$workflows.<workflowId>.steps.<stepId>` and the `$sourceDescriptions.<name>.<reference>`
|
|
658
|
+
// form's optional `stepsReference` are both parsed by
|
|
659
|
+
// @swaggerexpert/arazzo-runtime-expression >=3.2.0, which added grammar support for exactly
|
|
660
|
+
// this dependsOn-specific syntax (previously `$workflows.` rejected it outright, and
|
|
661
|
+
// `$sourceDescriptions.` only saw it as an opaque string). Parsing is left entirely to the
|
|
662
|
+
// grammar here rather than re-implemented locally, so this always matches whatever that
|
|
663
|
+
// shared parser considers valid - including its documented limitation that a workflowId
|
|
664
|
+
// containing a literal dot won't be recognized (its `workflow-id` production is
|
|
665
|
+
// `identifier-strict`, which excludes dots). Only document-local existence resolution
|
|
666
|
+
// happens here; a `$sourceDescriptions.` reference stays unresolved beyond its shape, since
|
|
667
|
+
// it points at an external document.
|
|
668
|
+
if (!element || !(0, _utils.isObject)(element) || !element.hasKey('dependsOn')) return true;
|
|
669
|
+
const dependsOn = element.get('dependsOn');
|
|
670
|
+
if (!dependsOn || !(0, _utils.isArray)(dependsOn)) return true;
|
|
671
|
+
const steps = element.parent;
|
|
672
|
+
if (!steps || !(0, _utils.isArray)(steps)) return true;
|
|
673
|
+
// Excludes the current step itself: a step depending on its own stepId is never
|
|
674
|
+
// meaningful, and would otherwise silently "resolve" since it's a member of its own
|
|
675
|
+
// `steps` sibling array.
|
|
676
|
+
const stepIds = new Set(steps.filter(s => s !== element && (0, _utils.isObject)(s) && s.hasKey('stepId')).map(s => (0, _apidomCore.toValue)(s.get('stepId'))));
|
|
677
|
+
let workflows;
|
|
678
|
+
const resolvesToWorkflowStep = (workflowId, stepId) => {
|
|
679
|
+
workflows ??= getElementsByTypeOrClass(root(element), 'workflow');
|
|
680
|
+
const targetWorkflow = findArazzoWorkflowByWorkflowId(workflows, workflowId);
|
|
681
|
+
if (!targetWorkflow || !(0, _utils.isObject)(targetWorkflow) || !targetWorkflow.hasKey('steps')) {
|
|
682
|
+
return false;
|
|
683
|
+
}
|
|
684
|
+
const targetSteps = targetWorkflow.get('steps');
|
|
685
|
+
if (!targetSteps || !(0, _utils.isArray)(targetSteps)) return false;
|
|
686
|
+
const targetStepIds = targetSteps.filter(s => (0, _utils.isObject)(s) && s.hasKey('stepId')).map(s => (0, _apidomCore.toValue)(s.get('stepId')));
|
|
687
|
+
return targetStepIds.includes(stepId);
|
|
688
|
+
};
|
|
689
|
+
for (const item of dependsOn) {
|
|
690
|
+
const val = (0, _apidomCore.toValue)(item);
|
|
691
|
+
if (typeof val !== 'string') continue;
|
|
692
|
+
if (val.startsWith('$workflows.')) {
|
|
693
|
+
const {
|
|
694
|
+
result,
|
|
695
|
+
tree
|
|
696
|
+
} = (0, _arazzoRuntimeExpression.parse)(val);
|
|
697
|
+
if (!result.success || !tree || tree.type !== 'WorkflowsStepsExpression') return false;
|
|
698
|
+
if (!resolvesToWorkflowStep(tree.workflowId, tree.stepId)) return false;
|
|
699
|
+
} else if (val.startsWith('$sourceDescriptions.')) {
|
|
700
|
+
const {
|
|
701
|
+
result,
|
|
702
|
+
tree
|
|
703
|
+
} = (0, _arazzoRuntimeExpression.parse)(val);
|
|
704
|
+
if (!result.success || !tree || tree.type !== 'SourceDescriptionsExpression' || !tree.stepsReference) {
|
|
705
|
+
return false;
|
|
706
|
+
}
|
|
707
|
+
} else if (val.startsWith('$')) {
|
|
708
|
+
return false;
|
|
709
|
+
} else if (!stepIds.has(val)) {
|
|
710
|
+
return false;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
return true;
|
|
714
|
+
}
|
|
592
715
|
}, {
|
|
593
716
|
functionName: 'apilintArazzoWorkflowIdResolved',
|
|
594
717
|
function: element => {
|
|
@@ -600,7 +723,33 @@ const standardLinterfunctions = exports.standardLinterfunctions = [{
|
|
|
600
723
|
if (value.startsWith('$sourceDescriptions.')) return (0, _arazzoRuntimeExpression.test)(value);
|
|
601
724
|
const api = root(element);
|
|
602
725
|
const workflows = getElementsByTypeOrClass(api, 'workflow');
|
|
603
|
-
return workflows
|
|
726
|
+
return findArazzoWorkflowByWorkflowId(workflows, value) !== undefined;
|
|
727
|
+
}
|
|
728
|
+
}, {
|
|
729
|
+
functionName: 'apilintArazzoSourceDescriptionTypeConsistency',
|
|
730
|
+
function: (element, expectedTypes) => {
|
|
731
|
+
// Best-effort cross-check: a $sourceDescriptions.<name>.<reference> value should point at
|
|
732
|
+
// a source whose declared `type` matches how the reference is being used (e.g. a
|
|
733
|
+
// workflowId reference should point at a `type: arazzo` source, not `type: openapi`). Only
|
|
734
|
+
// fires when the named source exists locally AND declares a `type` - that field is
|
|
735
|
+
// optional per spec, so a source without one gives no local signal to check against, and
|
|
736
|
+
// is silently skipped rather than guessed at.
|
|
737
|
+
if (!element || !(0, _utils.isString)(element)) return true;
|
|
738
|
+
return isArazzoSourceDescriptionTypeConsistent((0, _apidomCore.toValue)(element), expectedTypes, root(element));
|
|
739
|
+
}
|
|
740
|
+
}, {
|
|
741
|
+
functionName: 'apilintArazzoArraySourceDescriptionTypeConsistency',
|
|
742
|
+
function: (element, expectedTypes) => {
|
|
743
|
+
// Same check as apilintArazzoSourceDescriptionTypeConsistency, applied to each
|
|
744
|
+
// $sourceDescriptions.-prefixed string in an array (e.g. Workflow/Step `dependsOn`).
|
|
745
|
+
if (!element || !(0, _utils.isArray)(element)) return true;
|
|
746
|
+
const api = root(element);
|
|
747
|
+
for (const item of element) {
|
|
748
|
+
if (!isArazzoSourceDescriptionTypeConsistent((0, _apidomCore.toValue)(item), expectedTypes, api)) {
|
|
749
|
+
return false;
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
return true;
|
|
604
753
|
}
|
|
605
754
|
}, {
|
|
606
755
|
functionName: 'apilintArazzoActionStepIdResolved',
|
|
@@ -3,7 +3,7 @@ import { isStringElement, isArrayElement, includesClasses } from '@speclynx/apid
|
|
|
3
3
|
import { forEach } from '@speclynx/apidom-traverse';
|
|
4
4
|
import { toValue } from '@speclynx/apidom-core';
|
|
5
5
|
import { test as testPathTemplate, resolve as resolvePathTemplate, parse as parsePathTemplate } from 'openapi-path-templating';
|
|
6
|
-
import { test as testRuntimeExpression } from '@swaggerexpert/arazzo-runtime-expression';
|
|
6
|
+
import { test as testRuntimeExpression, parse as parseRuntimeExpression } from '@swaggerexpert/arazzo-runtime-expression';
|
|
7
7
|
import { isObject, isString, isArray, isNumber, isBoolean, isMember, processPath, getStringMetaValue, getClassesValue, getReferencedElementValue } from "../../utils/utils.mjs";
|
|
8
8
|
const regexCache = new Map();
|
|
9
9
|
const getCachedRegex = (pattern, flags) => {
|
|
@@ -122,6 +122,47 @@ const casing = (value, casingStyle, noNumbers, separatorChar, separatorAsFirstCh
|
|
|
122
122
|
}
|
|
123
123
|
return getCachedRegex(pattern).test(value);
|
|
124
124
|
};
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Looks up a Source Description Object by `name` and returns its declared `type`, or `undefined`
|
|
128
|
+
* when the source doesn't exist locally or omits `type` (it's optional per spec).
|
|
129
|
+
*/
|
|
130
|
+
const resolveArazzoSourceDescriptionType = (api, sourceName) => {
|
|
131
|
+
const sourceDescriptions = getElementsByTypeOrClass(api, 'sourceDescription');
|
|
132
|
+
const matchingSource = sourceDescriptions.find(sd => isObject(sd) && sd.hasKey('name') && toValue(sd.get('name')) === sourceName);
|
|
133
|
+
if (!matchingSource || !isObject(matchingSource) || !matchingSource.hasKey('type')) {
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
const declaredType = toValue(matchingSource.get('type'));
|
|
137
|
+
return typeof declaredType === 'string' ? declaredType : undefined;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Shared by apilintArazzoSourceDescriptionTypeConsistency and its array variant. Non-string,
|
|
142
|
+
* non-`$sourceDescriptions.`-prefixed, or unparseable values are treated as "not this check's
|
|
143
|
+
* concern" (true) - other rules cover type/shape. Explicitly checks `=== undefined` rather than
|
|
144
|
+
* a falsy check, so a source with `type: ''` (already invalid on its own) doesn't get treated the
|
|
145
|
+
* same as a source that simply omits `type`.
|
|
146
|
+
*/
|
|
147
|
+
const isArazzoSourceDescriptionTypeConsistent = (value, expectedTypes, api) => {
|
|
148
|
+
if (typeof value !== 'string' || !value.startsWith('$sourceDescriptions.')) return true;
|
|
149
|
+
const {
|
|
150
|
+
result,
|
|
151
|
+
tree
|
|
152
|
+
} = parseRuntimeExpression(value);
|
|
153
|
+
if (!result.success || !tree || tree.type !== 'SourceDescriptionsExpression') return true;
|
|
154
|
+
const declaredType = resolveArazzoSourceDescriptionType(api, tree.sourceName);
|
|
155
|
+
if (declaredType === undefined) return true;
|
|
156
|
+
return expectedTypes.includes(declaredType);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Shared by apilintArazzoWorkflowIdResolved and apilintArazzoStepDependsOnResolved: finds a
|
|
161
|
+
* `workflow` element by its `workflowId` field within an already-collected list of workflows.
|
|
162
|
+
* Takes the list rather than `api` so callers that check multiple ids (e.g. across a `dependsOn`
|
|
163
|
+
* array) can collect it once and reuse it, instead of re-walking the tree per id.
|
|
164
|
+
*/
|
|
165
|
+
const findArazzoWorkflowByWorkflowId = (workflows, workflowId) => workflows.find(w => isObject(w) && w.hasKey('workflowId') && toValue(w.get('workflowId')) === workflowId);
|
|
125
166
|
const isType = (element, elementType) => {
|
|
126
167
|
switch (elementType) {
|
|
127
168
|
case 'object':
|
|
@@ -444,6 +485,22 @@ export const standardLinterfunctions = [{
|
|
|
444
485
|
}
|
|
445
486
|
return true;
|
|
446
487
|
}
|
|
488
|
+
}, {
|
|
489
|
+
functionName: 'apilintChildrenOfTypeOrElementClass',
|
|
490
|
+
function: (element, type, elementsOrClasses, nonEmpty) => {
|
|
491
|
+
if (element && isObject(element)) {
|
|
492
|
+
for (const member of element) {
|
|
493
|
+
const value = member.value;
|
|
494
|
+
if (!isType(value, type) && !apilintElementOrClass(value, elementsOrClasses)) {
|
|
495
|
+
return false;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
if (nonEmpty && element.length === 0) {
|
|
499
|
+
return false;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
return true;
|
|
503
|
+
}
|
|
447
504
|
}, {
|
|
448
505
|
functionName: 'apilintKeyIsRegex',
|
|
449
506
|
function: element => {
|
|
@@ -579,6 +636,72 @@ export const standardLinterfunctions = [{
|
|
|
579
636
|
}
|
|
580
637
|
return true;
|
|
581
638
|
}
|
|
639
|
+
}, {
|
|
640
|
+
functionName: 'apilintArazzoStepDependsOnResolved',
|
|
641
|
+
function: element => {
|
|
642
|
+
// `element` is expected to be the step object (no `target` set), so its parent is the
|
|
643
|
+
// `steps` array of the workflow it belongs to. Unlike workflowId, stepId is only unique
|
|
644
|
+
// within a workflow, so a plain entry must resolve against that workflow's own steps
|
|
645
|
+
// rather than a document-wide search.
|
|
646
|
+
//
|
|
647
|
+
// `$workflows.<workflowId>.steps.<stepId>` and the `$sourceDescriptions.<name>.<reference>`
|
|
648
|
+
// form's optional `stepsReference` are both parsed by
|
|
649
|
+
// @swaggerexpert/arazzo-runtime-expression >=3.2.0, which added grammar support for exactly
|
|
650
|
+
// this dependsOn-specific syntax (previously `$workflows.` rejected it outright, and
|
|
651
|
+
// `$sourceDescriptions.` only saw it as an opaque string). Parsing is left entirely to the
|
|
652
|
+
// grammar here rather than re-implemented locally, so this always matches whatever that
|
|
653
|
+
// shared parser considers valid - including its documented limitation that a workflowId
|
|
654
|
+
// containing a literal dot won't be recognized (its `workflow-id` production is
|
|
655
|
+
// `identifier-strict`, which excludes dots). Only document-local existence resolution
|
|
656
|
+
// happens here; a `$sourceDescriptions.` reference stays unresolved beyond its shape, since
|
|
657
|
+
// it points at an external document.
|
|
658
|
+
if (!element || !isObject(element) || !element.hasKey('dependsOn')) return true;
|
|
659
|
+
const dependsOn = element.get('dependsOn');
|
|
660
|
+
if (!dependsOn || !isArray(dependsOn)) return true;
|
|
661
|
+
const steps = element.parent;
|
|
662
|
+
if (!steps || !isArray(steps)) return true;
|
|
663
|
+
// Excludes the current step itself: a step depending on its own stepId is never
|
|
664
|
+
// meaningful, and would otherwise silently "resolve" since it's a member of its own
|
|
665
|
+
// `steps` sibling array.
|
|
666
|
+
const stepIds = new Set(steps.filter(s => s !== element && isObject(s) && s.hasKey('stepId')).map(s => toValue(s.get('stepId'))));
|
|
667
|
+
let workflows;
|
|
668
|
+
const resolvesToWorkflowStep = (workflowId, stepId) => {
|
|
669
|
+
workflows ??= getElementsByTypeOrClass(root(element), 'workflow');
|
|
670
|
+
const targetWorkflow = findArazzoWorkflowByWorkflowId(workflows, workflowId);
|
|
671
|
+
if (!targetWorkflow || !isObject(targetWorkflow) || !targetWorkflow.hasKey('steps')) {
|
|
672
|
+
return false;
|
|
673
|
+
}
|
|
674
|
+
const targetSteps = targetWorkflow.get('steps');
|
|
675
|
+
if (!targetSteps || !isArray(targetSteps)) return false;
|
|
676
|
+
const targetStepIds = targetSteps.filter(s => isObject(s) && s.hasKey('stepId')).map(s => toValue(s.get('stepId')));
|
|
677
|
+
return targetStepIds.includes(stepId);
|
|
678
|
+
};
|
|
679
|
+
for (const item of dependsOn) {
|
|
680
|
+
const val = toValue(item);
|
|
681
|
+
if (typeof val !== 'string') continue;
|
|
682
|
+
if (val.startsWith('$workflows.')) {
|
|
683
|
+
const {
|
|
684
|
+
result,
|
|
685
|
+
tree
|
|
686
|
+
} = parseRuntimeExpression(val);
|
|
687
|
+
if (!result.success || !tree || tree.type !== 'WorkflowsStepsExpression') return false;
|
|
688
|
+
if (!resolvesToWorkflowStep(tree.workflowId, tree.stepId)) return false;
|
|
689
|
+
} else if (val.startsWith('$sourceDescriptions.')) {
|
|
690
|
+
const {
|
|
691
|
+
result,
|
|
692
|
+
tree
|
|
693
|
+
} = parseRuntimeExpression(val);
|
|
694
|
+
if (!result.success || !tree || tree.type !== 'SourceDescriptionsExpression' || !tree.stepsReference) {
|
|
695
|
+
return false;
|
|
696
|
+
}
|
|
697
|
+
} else if (val.startsWith('$')) {
|
|
698
|
+
return false;
|
|
699
|
+
} else if (!stepIds.has(val)) {
|
|
700
|
+
return false;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
return true;
|
|
704
|
+
}
|
|
582
705
|
}, {
|
|
583
706
|
functionName: 'apilintArazzoWorkflowIdResolved',
|
|
584
707
|
function: element => {
|
|
@@ -590,7 +713,33 @@ export const standardLinterfunctions = [{
|
|
|
590
713
|
if (value.startsWith('$sourceDescriptions.')) return testRuntimeExpression(value);
|
|
591
714
|
const api = root(element);
|
|
592
715
|
const workflows = getElementsByTypeOrClass(api, 'workflow');
|
|
593
|
-
return workflows
|
|
716
|
+
return findArazzoWorkflowByWorkflowId(workflows, value) !== undefined;
|
|
717
|
+
}
|
|
718
|
+
}, {
|
|
719
|
+
functionName: 'apilintArazzoSourceDescriptionTypeConsistency',
|
|
720
|
+
function: (element, expectedTypes) => {
|
|
721
|
+
// Best-effort cross-check: a $sourceDescriptions.<name>.<reference> value should point at
|
|
722
|
+
// a source whose declared `type` matches how the reference is being used (e.g. a
|
|
723
|
+
// workflowId reference should point at a `type: arazzo` source, not `type: openapi`). Only
|
|
724
|
+
// fires when the named source exists locally AND declares a `type` - that field is
|
|
725
|
+
// optional per spec, so a source without one gives no local signal to check against, and
|
|
726
|
+
// is silently skipped rather than guessed at.
|
|
727
|
+
if (!element || !isString(element)) return true;
|
|
728
|
+
return isArazzoSourceDescriptionTypeConsistent(toValue(element), expectedTypes, root(element));
|
|
729
|
+
}
|
|
730
|
+
}, {
|
|
731
|
+
functionName: 'apilintArazzoArraySourceDescriptionTypeConsistency',
|
|
732
|
+
function: (element, expectedTypes) => {
|
|
733
|
+
// Same check as apilintArazzoSourceDescriptionTypeConsistency, applied to each
|
|
734
|
+
// $sourceDescriptions.-prefixed string in an array (e.g. Workflow/Step `dependsOn`).
|
|
735
|
+
if (!element || !isArray(element)) return true;
|
|
736
|
+
const api = root(element);
|
|
737
|
+
for (const item of element) {
|
|
738
|
+
if (!isArazzoSourceDescriptionTypeConsistent(toValue(item), expectedTypes, api)) {
|
|
739
|
+
return false;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
return true;
|
|
594
743
|
}
|
|
595
744
|
}, {
|
|
596
745
|
functionName: 'apilintArazzoActionStepIdResolved',
|