hurl icon indicating copy to clipboard operation
hurl copied to clipboard

Support --error-format=json

Open hsanson opened this issue 1 year ago • 2 comments

Problem to solve

Current error formats short and long are too complex to parse. Would be nice to have the output formatted in JSON so is easier to parse.

Proposal

Output compatible with vim's quickfix list would be best:

[
  {  
    "filename": "/absolute/path/to/file.hurl", 
    "lnum": 20, 
    "end_lnum": 20,
    "col": 1,
    "end_col": 25,
    "text":  "Undefined Variable: you must set the variable post_id" ,
    "type": "E"
  }
]

Additional context and resources

Trying to improve the hurl.nvim plugin.

Tasks to complete

  • [ ] ...

hsanson avatar Mar 10 '24 09:03 hsanson

Hi @hsanson

Sorry for the delay!

Yes, it's make totally sens to add --error-format=json.

Just a small note, the JSON format will certainly be a little different from vim's. Partly because we already serialise error with --json but also because I think we'll add specific HTTP fields (like body response, headers etc...). Of course, we'll have every field necessary to display an error: filename, error start and end position, textual description so it should be easy to map to a vim's error JSON.

It's okay with you?

jcamiel avatar Mar 14 '24 16:03 jcamiel

As long as it is json format, I can parse, modify, and present it whichever way is best for my editor.

hsanson avatar Mar 15 '24 01:03 hsanson