cardinalby / schema-validator-action

JSON Schema validator Action
MIT License
11 stars 2 forks source link

Issue with json files that have extra commas #6

Closed DarrenHongTelus closed 1 year ago

DarrenHongTelus commented 1 year ago

Hi there,

Thanks for building out this action that I use but I'm coming across one issue with it passing a tests that has invalid json files that have a extra comma in it:

{
  "test1": "test1",
  "test2": "test2",
}

Where it's supposed to be :

{
  "test1": "test1",
  "test2": "test2"
}

Is it possible to resolve this?

cardinalby commented 1 year ago

Hi! Thanks for pointing out to this behaviour.

Actually, it happens because your file gets parsed as valid yaml, not json. I also believe it's not a proper behaviour and have just released v3 version of the action to address this issue.

Now by default if your file has .json extension, it will be parsed as JSON and cause an error for extra commas. To have more control over parsing see fileParser input

Let me know if it solves the issue :)

DarrenHongTelus commented 1 year ago

Hi @cardinalby,

Thanks for the fast work! I've just confirmed that v3 of the action works as intended and solves the lingering issue I had. Not sure if it's officially released as I see lingering v2 notices within the action homepage: https://github.com/marketplace/actions/schema-validation-action