From a93feddd900fbd31bd9fc30a11b78390a7b68c11 Mon Sep 17 00:00:00 2001 From: Thomas Schaffter Date: Tue, 17 Sep 2024 10:15:27 -0700 Subject: [PATCH] feat(sage-monorepo): externalize the config and ruleset used by the OpenAPI validator for OpenChallenges (#2818) --- .../api-description/openapi-lint-config.yaml | 5 ----- libs/openchallenges/api-description/project.json | 8 ++++++-- tools/ibm-openapi-validator/config.yaml | 7 +++++++ .../ibm-openapi-validator}/spectral.yaml | 0 4 files changed, 13 insertions(+), 7 deletions(-) delete mode 100644 libs/openchallenges/api-description/openapi-lint-config.yaml create mode 100644 tools/ibm-openapi-validator/config.yaml rename {libs/openchallenges/api-description => tools/ibm-openapi-validator}/spectral.yaml (100%) diff --git a/libs/openchallenges/api-description/openapi-lint-config.yaml b/libs/openchallenges/api-description/openapi-lint-config.yaml deleted file mode 100644 index e619779ad6..0000000000 --- a/libs/openchallenges/api-description/openapi-lint-config.yaml +++ /dev/null @@ -1,5 +0,0 @@ -errorsOnly: true -summaryOnly: false -limits: - warnings: 25 -# ibm-accept-and-return-models diff --git a/libs/openchallenges/api-description/project.json b/libs/openchallenges/api-description/project.json index 719c1fa258..4d949d7b52 100644 --- a/libs/openchallenges/api-description/project.json +++ b/libs/openchallenges/api-description/project.json @@ -29,8 +29,12 @@ "lint": { "executor": "nx:run-commands", "options": { - "command": "lint-openapi --config openapi-lint-config.yaml --ruleset spectral.yaml build/openapi.yaml build/challenge.openapi.yaml build/organization.openapi.yaml build/image.openapi.yaml", - "cwd": "{projectRoot}" + "commands": [ + "lint-openapi --config tools/ibm-openapi-validator/config.yaml {projectRoot}/build/openapi.yaml", + "lint-openapi --config tools/ibm-openapi-validator/config.yaml {projectRoot}/build/challenge.openapi.yaml", + "lint-openapi --config tools/ibm-openapi-validator/config.yaml {projectRoot}/build/organization.openapi.yaml", + "lint-openapi --config tools/ibm-openapi-validator/config.yaml {projectRoot}/build/image.openapi.yaml" + ] }, "dependsOn": ["build"] }, diff --git a/tools/ibm-openapi-validator/config.yaml b/tools/ibm-openapi-validator/config.yaml new file mode 100644 index 0000000000..fd335d5af7 --- /dev/null +++ b/tools/ibm-openapi-validator/config.yaml @@ -0,0 +1,7 @@ +errorsOnly: true +summaryOnly: false +limits: + warnings: 25 +# This path to the spectral config file assumes that the validator's current working directory is +# set to the workspace root folder. +ruleset: tools/ibm-openapi-validator/spectral.yaml diff --git a/libs/openchallenges/api-description/spectral.yaml b/tools/ibm-openapi-validator/spectral.yaml similarity index 100% rename from libs/openchallenges/api-description/spectral.yaml rename to tools/ibm-openapi-validator/spectral.yaml