Skip to content

Commit 525e1bf

Browse files
authored
Merge pull request #48 from dimakis/add_more_apis_to_ci
chore: Add more apis to ci
2 parents e29eec9 + 66cdd71 commit 525e1bf

File tree

3 files changed

+36
-10
lines changed

3 files changed

+36
-10
lines changed

.github/workflows/build.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727
run: yarn build
2828
- working-directory: ./spectral
2929
run: yarn lint
30-
# Disabled until we have single API passing tests.
3130
- working-directory: ./spectral
3231
run: yarn cli-integration-tests
3332

spectral/scripts/rules.sh

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,35 @@
44
## This apis can be used for testing
55
## Script needs to run in the test working directory
66

7+
spectralConfig="./examples/.spectral-local.yaml"
8+
baseUrl='https://raw.githubusercontent.com/redhat-developer/app-services-sdk-js/main/.openapi/'
9+
folder=".openapi"
10+
file='kas-fleet-manager.yaml'
711

8-
echo "fetching kas-fleet-manager from main"
9-
wget -P .openapi https://raw.githubusercontent.com/redhat-developer/app-services-sdk-js/main/.openapi/kas-fleet-manager.yaml
12+
wget -P $folder ${baseUrl}${file}
13+
echo "linting $file OAS file"
14+
yarn spectral lint $folder/$file -v -r $spectralConfig
1015

11-
## TODO add more apis
16+
file='srs-fleet-manager.json'
17+
wget -P $folder ${baseUrl}${file}
18+
echo "linting $file OAS file"
19+
yarn spectral lint $folder/$file -v -r $spectralConfig
1220

13-
yarn spectral lint .openapi/kas-fleet-manager.yaml -v -r ./examples/.spectral-local.yaml
21+
## Updates made to the following need to be refected in their respective .openapi OAS files before the linting can pass and added to CI
22+
23+
# file='connector_mgmt.yaml'
24+
# wget -P $folder ${baseUrl}${file}
25+
# echo "linting $file OAS file"
26+
# yarn spectral lint $folder/$file -v -r $spectralConfig
27+
28+
# file='smartevents.yaml'
29+
# wget -P $folder ${baseUrl}${file}
30+
# echo "linting $file OAS file"
31+
# yarn spectral lint $folder/$file -v -r $spectralConfig
32+
33+
# file='kafka-admin.yaml'
34+
# wget -P $folder ${baseUrl}${file}
35+
# echo "linting $file OAS file"
36+
# yarn spectral lint $folder/$file -v -r $spectralConfig
37+
38+
## TODO add more apis as they are onboarded

spectral/src/functions/infoLicenseApache2.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,22 @@ export default (targetVal: any, _: any, context: any): IFunctionResult[] => {
1515

1616
const results: IFunctionResult[] = [];
1717
const expectName = 'Apache 2.0'
18-
p = context.path[1];
18+
if (context.path[1] != undefined) {
19+
p = context.path[1];
20+
}
1921
if (targetVal?.name != expectName) {
2022
results.push({
2123
message: '`name` must be "' + expectName + '"',
22-
path: [...p, 'license']
24+
path: p
2325
})
24-
}
26+
}
2527
const expectUrl = 'https://www.apache.org/licenses/LICENSE-2.0';
2628
if (targetVal?.url !== expectUrl) {
2729
results.push({
2830
message: '`url` must be "' + expectUrl + '" not "' + targetVal?.url + '"',
29-
path: [...p, 'license']
31+
path: p
3032
})
31-
}
33+
}
3234

3335
return results
3436
}

0 commit comments

Comments
 (0)