Skip to content

Commit

Permalink
fixed logs of file path input and input param value
Browse files Browse the repository at this point in the history
  • Loading branch information
thiyagu06 committed Sep 4, 2022
1 parent b4a000c commit 7ab8f77
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/verify-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
- name: openapi-github-action
uses: ./
with:
file-path: './schemas/openapiv3.yml'
filepath: './schemas/openapiv3.yml'
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This action validates whether the OpenAPI/Swagger schema file is valid or not

## Inputs

### `file-path`
### `filepath`

**Required** Path of the OpenAPI schema file. Default is `"openapi.yaml"` at root. Path starts root of github repo.
For example, if your schema is in `schemas` folder.
Expand All @@ -17,13 +17,13 @@ root
└── package-lock.json
```

You should use `file_path: './schemas/file-path.yaml'`
You should use `filepath: './schemas/openapi.yaml'`

## Example usage

```
- name: 'validate openapi schema'
uses: thiyagu08/validate-github-action@v1
uses: thiyagu06/validate-github-action@v1
with:
filepath: 'openapi.yaml'
```
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'openapi-validator-action'
author: 'Thiyagu GK'
description: 'This action validates if the OpenAPI/Swagger schema file is valid or not.'
inputs:
file-path:
filepath:
description: 'Path of openapi schema file'
required: true
default: 'openapi.yaml'
Expand Down
9 changes: 4 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18157,8 +18157,8 @@ const dir = process.env.GITHUB_WORKSPACE || __dirname
const fullPath = path.resolve(dir, filePath)
console.log(`schema file full path:${fullPath}`)
try {
const SwaggerParser = __nccwpck_require__(2980);
let api = await SwaggerParser.validate(fullPath, {continueOnError:true, validate:{spec: false}});
const SwaggerParser = __nccwpck_require__(2980)
let api = await SwaggerParser.validate(fullPath, {continueOnError:true})
console.log("API specification is valid ")
}
catch(err) {
Expand Down Expand Up @@ -18416,9 +18416,8 @@ const core = __nccwpck_require__(4247);
const validate = __nccwpck_require__(282)

try {
// const filePath = core.getInput('file-path');
const filePath = "openapiv3.yml"
console.log(`file path ${filePath}!`);
const filePath = core.getInput('filepath');
console.log(`file path ${filePath}`);
validate(filePath)
} catch (error) {
core.setFailed(error.message);
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ const core = require('@actions/core');
const validate = require('./validator')

try {
const filePath = core.getInput('file-path');
console.log(`file path ${filePath}!`);
const filePath = core.getInput('filepath');
console.log(`file path ${filePath}`);
validate(filePath)
} catch (error) {
core.setFailed(error.message);
Expand Down
4 changes: 2 additions & 2 deletions validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const dir = process.env.GITHUB_WORKSPACE || __dirname
const fullPath = path.resolve(dir, filePath)
console.log(`schema file full path:${fullPath}`)
try {
const SwaggerParser = require("@apidevtools/swagger-parser");
let api = await SwaggerParser.validate(fullPath, {continueOnError:true, validate:{spec: false}});
const SwaggerParser = require("@apidevtools/swagger-parser")
let api = await SwaggerParser.validate(fullPath, {continueOnError:true})
console.log("API specification is valid ")
}
catch(err) {
Expand Down

0 comments on commit 7ab8f77

Please sign in to comment.