IBM/openapi-validator

[feature request] new output format for Code Climate

Opened this issue · 5 comments

For the integration of the validation results in other software, it would be nice to have the possibility to get the output as json as specified by Code Climate. Especially the integration in gitlab-ci requires this format.

https://github.com/codeclimate/platform/blob/master/spec/analyzers/SPEC.md#data-types

@Blaimi Are you using the validator as a Node module within JavaScript code or as a CLI tool?

I want to use it in a gitlab-pipeline [1]. gitlab requires the code climate output format for integration in code quality reports [2].

[1] https://gitlab.com/biletado/apidocs/-/blob/0dfa977c8cc38282dada77f50c8db151f5e6926d/.gitlab-ci.yml#L6
[2] https://docs.gitlab.com/ee/ci/testing/code_quality.html#implementing-a-custom-tool

I see. So it's not sufficient just to have JSON output, you need an entirely new output structure?

@Blaimi in our official 1.0.0 release of the validator, we have defined a json schema that describes the JSON output produced by the validator. Perhaps a way to solve this would be to use a tool such as jq to post-process the validator's JSON output to produce the correct format needed by Code Climate.

Blaimi commented

Yes, I considered jq for a few moments, but when I remember correct, the structures are too different for an easy and maintainable solution. It's probably easier to write a small node tool or wrapper in a oop language which transforms the output.

Would you accept a PR on this topic with an implementation? e.g. with outputFormat: codeclimate/--codeclimate?