-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Theo Truong <[email protected]>
- Loading branch information
Showing
3 changed files
with
43 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Validate spec folder | ||
|
||
on: | ||
push: | ||
branches: ['**'] | ||
paths: | ||
- 'spec/**' | ||
- 'tools/linter/**' | ||
pull_request: | ||
branches: ['**'] | ||
paths: | ||
- 'spec/**' | ||
- 'tools/linter/**' | ||
|
||
jobs: | ||
lint-spec: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: tools | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.10.0 | ||
- run: npm install | ||
- run: npm run lint -- ../spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
import SpecValidator from "./SpecValidator"; | ||
|
||
|
||
const validator = new SpecValidator('../spec'); | ||
const root_folder = process.argv[2] || '../spec'; | ||
const validator = new SpecValidator(root_folder); | ||
const errors = validator.validate(); | ||
errors.forEach(e => console.error(e)); | ||
console.log('\nTotal errors:', errors.length) | ||
|
||
if(errors.length === 0) { | ||
console.log('No errors found.'); | ||
process.exit(0); | ||
} else { | ||
console.log('Errors found:\n'); | ||
errors.forEach(e => console.error(e)); | ||
console.log('\nTotal errors:', errors.length) | ||
process.exit(1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
import OpenApiMerger from "./OpenApiMerger"; | ||
|
||
|
||
async function main() { | ||
const root_path: string = process.argv[2]; // '../spec/opensearch-openapi.yaml' | ||
const output_path: string = process.argv[3]; // '../build/opensearch-openapi.yaml' | ||
const merger = new OpenApiMerger(root_path); | ||
merger.merge(output_path); | ||
} | ||
|
||
main(); | ||
const root_path: string = process.argv[2] || '../spec/opensearch-openapi.yaml' | ||
const output_path: string = process.argv[3] || '../opensearch-openapi.yaml' | ||
const merger = new OpenApiMerger(root_path); | ||
merger.merge(output_path); |