[X] I have checked existing issues and there are no existing ones with the same request.
Feature description
Diagnostics source using the redocly CLI for validating OpenAPI documents.
Help
Yes
Implementation help
I have an implementation of this in my personal dotfiles, so I will drop that here in case someone else wants to use it as a base for patching it into null-ls.
If not, I plan on carving out some time to add this patch.
This borrows portions of the codeclimate output handler from a different diagnostics source in null-ls.
{
name = "redocly",
method = require("null-ls.methods").internal.DIAGNOSTICS,
filetypes = { "raml" },
generator = null_ls.generator {
command = "redocly",
args = { "lint", "$FILENAME", "--format", "codeclimate" },
format = "json",
to_stdin = false,
ignore_stderr = true,
to_temp_file = true,
on_output = function(params)
local h = require("null-ls.helpers")
local severities = {
blocker = h.diagnostics.severities.error,
critical = h.diagnostics.severities.error,
major = h.diagnostics.severities.error,
minor = h.diagnostics.severities.warning,
info = h.diagnostics.severities.information,
}
params.messages = {}
for _, message in ipairs(params.output) do
local col = nil
local row = message.location.lines.begin
if type(row) == "table" then
row = row.line
col = row.column
end
table.insert(params.messages, {
row = row,
col = col,
message = message.description,
severity = severities[message.severity],
filename = params.bufname,
})
end
return params.messages
end,
},
},
Note, I used this with a .raml file, but it should handle yaml files as well, and have a runtime_condition config to check to see if it is actually an openapi document.
Issues
Feature description
Diagnostics source using the redocly CLI for validating OpenAPI documents.
Help
Yes
Implementation help
I have an implementation of this in my personal dotfiles, so I will drop that here in case someone else wants to use it as a base for patching it into null-ls.
If not, I plan on carving out some time to add this patch.
This borrows portions of the codeclimate output handler from a different diagnostics source in null-ls.