You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
One possible, and minimally invasive usage of Nickel, is to use it to apply schemas to existing configuration that isn't necessarily written in Nickel (e.g. YAML). While the CLI currently supports passing files that aren't Nickel, such as nickel export foo.json bar.json baz.ncl, this only implements merging, which isn't exactly equivalent to contract application, even for record contracts (for example merging won't complain about extra fields).
Describe the solution you'd like
Add a --contract schema.ncl argument to evaluation commands, so that one can apply a contract to a file directly from the CLI without having to modify said files (when it's even possible), such as nickel eval foo.json --contract myschema.ncl or nickel export data.ncl --contract contract.ncl. We could support many contracts arguments, that would just be applied in order.
Describe alternatives you've considered
A current work-around is to do something like nickel eval <<< '(import "data.json") | (import "contract.ncl")' which is heavier and might have escaping subtleties. It also doesn't really scale to several contracts (it's still doable, but worse).
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
One possible, and minimally invasive usage of Nickel, is to use it to apply schemas to existing configuration that isn't necessarily written in Nickel (e.g. YAML). While the CLI currently supports passing files that aren't Nickel, such as
nickel export foo.json bar.json baz.ncl
, this only implements merging, which isn't exactly equivalent to contract application, even for record contracts (for example merging won't complain about extra fields).Describe the solution you'd like
Add a
--contract schema.ncl
argument to evaluation commands, so that one can apply a contract to a file directly from the CLI without having to modify said files (when it's even possible), such asnickel eval foo.json --contract myschema.ncl
ornickel export data.ncl --contract contract.ncl
. We could support many contracts arguments, that would just be applied in order.Describe alternatives you've considered
A current work-around is to do something like
nickel eval <<< '(import "data.json") | (import "contract.ncl")'
which is heavier and might have escaping subtleties. It also doesn't really scale to several contracts (it's still doable, but worse).The text was updated successfully, but these errors were encountered: