diff --git a/spectral/scripts/rules.sh b/spectral/scripts/rules.sh index 94abe06..0e5fc76 100755 --- a/spectral/scripts/rules.sh +++ b/spectral/scripts/rules.sh @@ -1,5 +1,8 @@ ## This script tests and validates rules APIs +spectral_version=`cat "../spectral.version"` +spectral --version || npm install -g --force @stoplight/spectral-cli@$spectral_version + ## Fetch current managed services APIS from sdk repository ## This apis can be used for testing ## Script needs to run in the test working directory @@ -11,17 +14,17 @@ file='kas-fleet-manager.yaml' wget -P $folder ${baseUrl}${file} echo "linting $file OAS file" -yarn spectral lint $folder/$file -v -r $spectralConfig +spectral lint $folder/$file -v -r $spectralConfig file='srs-fleet-manager.json' wget -P $folder ${baseUrl}${file} echo "linting $file OAS file" -yarn spectral lint $folder/$file -v -r $spectralConfig +spectral lint $folder/$file -v -r $spectralConfig file='connector_mgmt.yaml' wget -P $folder ${baseUrl}${file} echo "linting $file OAS file" -yarn spectral lint $folder/$file -v -r $spectralConfig +spectral lint $folder/$file -v -r $spectralConfig ## Updates made to the following need to be refected in their respective .openapi OAS files before the linting can pass and added to CI