Comments (2)
This is gonna take some discussion before starting - probably needs a design doc.
from thema.
Note that this:
Line-level information about errors
is deceptively tricky. On the one hand, CUE very awesomely carries line-level traceability for validation errors by construction. But there are caveats.
Line-level error info ultimately ties back to associations between the vertices that underlie a cue.Value
and source file, specifically a token.Pos
. There are many things that can cause a cue.Value
to lack such information - e.g., if it was created by cue.Value.Unify()
, if it is the result of a comprehension.
It's not as simple as "if cue.Value.Source()
returns nil, there will be no line info in errors." That wouldn't simplify things much, anyway. But i do not know of a clean, general rule that clearly tells us in what circumstance we can expect errors coming from to have line information (a non-empty return from this). (cc @myitcv)
In addition to the pure CUE reasons that line numbers may be lacking, we'll also need to account for things the user may have done that would cause the cue.Value
contained in a Thema type to have its line numbers disappear. For example, on Instance
, Translate()
Hydrate
and Dehydrate
all manipulate a cue.Value
in a way that may make it impossible to meaningfully include line numbers in errors, as the source has undergone a transformation and the "input file" no longer exists. Similarly, composition (#8) will almost certainly include calls to cue.Value.Unify()
that...could? cause similar issues.
When i decided Thema should accept cue.Value
as the input type for various funcs like BindLineage()
or Schema.Validate()
(vs. say having them accept []byte
), it significantly simplified Thema's API, but it came with the burden of dealing with some of these error ambiguities. As a result, we have to generally expect that every error Thema emits will have both a "with line number" and "without line numbers" form. A complete error model will need to account for this difference, perhaps including explicit differentiation between cases where there are no line numbers because an original input cue.Value
lacked source context, and cases where Thema operations themselves have caused them to be unavailable. Ambiguity around error line number availability has been quite frustrating for me when working with the CUE API, and i suspect it will be just as frustrating for Thema's users.
That said, not all of this needs to be dealt with in a first pass. I'm just outlining the scope of the problem.
from thema.
Related Issues (20)
- Add a command to clean all txtar output HOT 4
- disallow if statements in schema definitions
- disallow comprehensions in schema definitions
- Emit embedded or inlined structs in Go to correspond with struct unifications in schemas HOT 2
- Bring validation error output in sync with lineage flattening
- feature request: add error return value to `Translate()` HOT 4
- feature request: improve error output with invalid `lens` configuration
- bug: inconsistently-shaped `instances` from `Translate` and `Validate` HOT 1
- feature request: add error return to `ValidateAny()` HOT 1
- Inconsistent lineage errors between thema cli and library HOT 1
- feature request: make the thema CLI go gettable
- feature request: thema version flag/subcommand/thingy
- Generate something nicer than interfaces when we use disjunctions in Go models.
- Constraints break backward-compatibility check
- Translate() may return an invalid instance
- asdada
- Evaluate scalability of main Thema operations
- Set up Thema releases
- Enforce ordering of items in `schemas` and `lenses` during `BindLineage` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from thema.