[PUP-8984] Add JSON output option to `puppet parser validate` Created: 2017/05/08 Updated: 2019/07/06 Resolved: 2019/06/12
|Fix Version/s:||PUP 6.5.0|
|Reporter:||James Pogran||Assignee:||Jesse Scott|
|Remaining Estimate:||Not Specified|
|Time Spent:||Not Specified|
|Original Estimate:||Not Specified|
|Epic Link:||PDK Maintenance|
|Team:||Puppet Developer Experience|
|Release Notes Summary:|| The `puppet parser validate` subcommand now supports a `--render-as=json` option to output validate errors in a machine readable JSON format.
Additionally, when passed multiple target files, `puppet parser validate` will now continue validating additional files after a parse error instead of halting immediately on the first error encountered. (Note: It will still only return a maximum of one parse error per file.)
|QA Risk Assessment:||Needs Assessment|
Running the following works, but still outputs plain text even though json is requested:
This is important as some downstream tooling (i.e. our VSCode extension) would like to have structured input to parse. While the above example is one line, other errors span multiple, making parsing a brittle affair.
A suggestion was to use puppet's loggin facility to log to a file and then parse that, but puppet parser validate does not recognize the --logdir paramter.
|Comment by Henrik Lindberg [ 2017/05/09 ]|
Structured JSON output is supported as output, but the puppet parser command has no way of switching to using that.
|Comment by Jesse Scott [ 2018/07/03 ]|
I have a proof of concept for JSON output done, do folks have strong feelings about --render-as vs --format for the flag? --render-as seems to be used a lot of places in puppet but `puppet parser dump` already implements a --format option.
|Comment by Kris Bosland [ 2019/04/29 ]|
Merged into master at bae2d75.
|Comment by Jesse Scott [ 2019/06/12 ]|
Josh Cooper I added release notes this afternoon so this is ready to resolve as far as I know.