-
I would like to export the concrete parts of a value as Json, without triggering an error on incomplete parts. Any incomplete values in the tree should simply be ignored. Currently I think I remember that an earlier version of Am I missing something obvious? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
As far as I remember, non-concrete values were always forbidden in JSON. But this does seem reasonable. In fact, this touches upon a proposal I've been trying to get more feedback on :), one of the few remaining proposals for a backwards-incompatible language change: Introduce
This addresses several issues:
With the current proposal, the use of This would be mostly compatible with the old semantics, but makes |
Beta Was this translation helpful? Give feedback.
-
This discussion has been migrated to cue-lang/cue#441. For more details about CUE's migration to a new home, please see cue-lang/cue#1078. |
Beta Was this translation helpful? Give feedback.
As far as I remember, non-concrete values were always forbidden in JSON.
But this does seem reasonable.
In fact, this touches upon a proposal I've been trying to get more feedback on :), one of the few remaining proposals for a backwards-incompatible language change:
Introduce
!
as a field marker, and introduce the following rules, w.r.t. exporting:field: int
: export only if concretefield!: int
: optional, but needs to be explicitly declared for a complete schema to be valid.field?: 1
: always optional, don't export, even if concrete.This addresses several issues:
It is currently not possible to require a field to be explicitly declared for lists and structs. A user may want to decl…