Replies: 2 comments 9 replies
-
oops, i swear i searched the issue list before posting, but after poking around just a little bit more, i think i see evidence you all took a pass at this in #1382, but ran into issues making use of it - is getting position info working for external formats on anyone's radar at the moment? |
Beta Was this translation helpful? Give feedback.
-
Hello @pjjw, I know this may come in late if you have already comitted to CUE, but FYI position information from serialized content is coming for TOML (#1949) and there is a clear path forward for YAML, and thus JSON (just using the YAML parser, as this is a superset of JSON), see Ethiraric/yaml-rust2#27 (whether it's upstreamed or not doesn't matter - we can still replicate the change locally if this doesn't make it in the parent crate fast enough). The release after the next one (1.7.0 is coming this week, so that will be 1.8.0 in approximately 6 weeks) will thus most likely have span information for TOML, YAML and JSON. |
Beta Was this translation helpful? Give feedback.
-
tl;dr how possible is it to add line number references for records imported from json?
use case is this- we have a number of uh "organically evolved" json inputs in our environment used to describe, generally, service deployment configurations, currently only validated at runtime. over time, they've become rather beastly.
there's now a need to open these up to editing by a much larger audience, so we need to put some guardrails/validation on these json blobs. there was a first attempt using cue, and it works, but the error messages are absolutely atrocious. i'm trying to make the argument that we should use nickel for contract validation at first, using nickel itself to express these definitions eventually. i got to putting together a contract definition, and this works great- being able to customize error messages is quite nice.
however, we'll need to keep the format-of-record json for quite a while, and i've noticed that while nickel is happy to import json into a record, all line number information gets stripped off, making contract validation error messages not super useful. below is an example of output from a service definition with an intentional error:
nice to know what the problem is, but not easy to run down where the problem is without extra information and a bit of a hunt. this is a lot nicer when importing a record from a .ncl file, with line numbers and everything:
if nickel provided line info for the imported json when reporting a contract issue, i think there'd be a pretty compelling argument to use it over the other things we've been trying. how difficult would this be?
Beta Was this translation helpful? Give feedback.
All reactions