-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow import declaration to load jsonschema #438
Comments
Original reply by @proppy in cuelang/cue#438 (comment) quick and dirty proof of concept: https://cue-review.googlesource.com/c/cue/+/6541 |
Original reply by @mpvl in cuelang/cue#438 (comment) A few remarks:
|
Original reply by @proppy in cuelang/cue#438 (comment)
Do you have a template for the project I could use?
Are you referring to https://github.com/cuelang/cue/blob/master/cmd/cue/cmd/import.go, I don't see much logic in there that's not specific to command line argument, are you suggestion that we generalize it so that the same parameters (interpretation/mode) can be passed in the import directive?
👍
Do you have more details on how root module relative imports work? I couldn't find them mentioned in https://cuelang.org/docs/concepts/packages/
I wonder if defining a package layout for jsonschema (and other foreign data) would make sense (similar to what's done w/ |
@proppy just skimming over this again whilst browsing through old issues, I note there is no mention here of a planned embedding proposal that effectively supersedes this issue in that it would be far more powerful. The proposal is yet to be written, but it will be analogous to the |
I'm going to close this issue in favour of #2031. We are just about to publish a proposal for the embed part of that issue, along with an experimental implementation. As you will see from #2031, we explored the prospect of extending imports to support more than just CUE, but the approach using embed ended up being cleaner, more easily suited to different use cases, and very much in-line with existing support for multiple file types and interpretations. |
Originally opened by @proppy in cuelang/cue#438
Is your feature request related to a problem? Please describe.
Currently one has to rely on
cue import
to bulk convert JSON schema into CUE package in order to consume them from other.cue
files.Describe the solution you'd like
Instead it would be nice to be able to
import path/to/some.schema.json
.Describe alternatives you've considered
Using a dedicated
cue tool
(or maybecue.mod/gen
?) it ma ybe be possible convert JSON schema on the fly before importing them, but since the command line already support evaluation of JSON schema argument, it could make sense for cue to support native JSON schema import as well.Additional context
This might be beneficial for project relying on a large corpus of existing (or third-party) schemas, who wants to validate/transform/compose them using CUE without the overhead of maintaining a separate imported copy.
The text was updated successfully, but these errors were encountered: