Skip to content

Added possibility to export the error Response of the parser #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ node_modules/
# Editors
.vscode

# History
.history

# Logs
logs
*.log
Expand Down
9 changes: 7 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ inputs:
description: 'Path of asyncapi schema file'
required: true
default: 'asyncapi.yaml'
errorResponse:
description: 'Output the detailed response of the validation'
default: "false"
required: true
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should not be a required, but optional property.


runs:
using: 'node16'
main: 'dist/index.js'
using: 'nod24'
main: 'index.js'
branding:
icon: 'file-text'
color: 'blue'
11 changes: 9 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47357,7 +47357,7 @@ const avroSchemaParser = __nccwpck_require__(9067)
const fs = __nccwpck_require__(7147)
const path = __nccwpck_require__(1017)

parser.registerSchemaParser(avroSchemaParser);
parser.registerSchemaParser(avroSchemaParser)

const validate = async (filePath) => {
if (typeof filePath !== 'string')
Expand Down Expand Up @@ -47657,15 +47657,22 @@ const core = __nccwpck_require__(2186)
const validate = __nccwpck_require__(2450)

async function run() {
const filepath = core.getInput('filepath')
const errorResponse = core.getInput('errorResponse')

try {
const filepath = core.getInput('filepath')
console.log('filepath', filepath)
console.log('errorResponse %s (%s)', errorResponse, typeof errorResponse)

core.debug((new Date()).toTimeString())
await validate(filepath)
core.debug((new Date()).toTimeString())
}
catch (error) {
if(errorResponse == "true") {
console.log("Identified Errors: ")
console.log(JSON.stringify(error.validationErrors, null, 2))
}
core.setFailed(error.message)
}
}
Expand Down
9 changes: 8 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@ const core = require('@actions/core')
const validate = require('./validator')

async function run() {
const filepath = core.getInput('filepath')
const errorResponse = core.getInput('errorResponse')

try {
const filepath = core.getInput('filepath')
console.log('filepath', filepath)
console.log('errorResponse %s (%s)', errorResponse, typeof errorResponse)

core.debug((new Date()).toTimeString())
await validate(filepath)
core.debug((new Date()).toTimeString())
}
catch (error) {
if(errorResponse == "true") {
console.log("Identified Errors: ")
console.log(JSON.stringify(error.validationErrors, null, 2))
}
core.setFailed(error.message)
}
}
Expand Down
Loading