Replies: 1 comment 3 replies
-
Hi @jbcpollak - welcome to the CUE project! Splitting your question into two parts: the loading of the CUE schema, and the loading of the JSON. Loading of the CUE schemaExactly as you observed, you ultimately have a choice: "hardcode" the CUE in the server binary, or load at runtime. There are actually options within those two options, and a nuance based on the current state of package management. Hardcoding could be literally hardcoding as a string, or it could be via something like Loading a package path at runtime will generally require the server binary to be running in the context of a CUE module. CUE modules are used to resolve CUE package paths, and this all happens via Note also that for now (until #851 or a variation of it lands) package/module, module resolution is limited to those modules that are either the main module itself, or modules vendored within the Loading the JSONThis is much simpler story, not least because it sounds like you will be receiving a Combining the twoYou can then use the In the context of your server program: you can keep the Your bullet points
As of today, no. Per my comments above, the working directory for
Please correct me if I'm wrong, but it sounds like you want to resolve |
Beta Was this translation helpful? Give feedback.
-
I'd like to write a tool that effectively wraps and executes cue programmatically, say from a server. Ideally there'd be a function that takes the unique name of a module and a byte-stream of json, and returns cue's output from running vet.
For example on the command line I can do this an capture the output:
How can I do this? I was able to hard code the cue and json data to a string and use
Context.CompileString()
, but now I want to make the cue data be loaded from a module and the json data be from a separate source. It feels like I should be able to do this withBuildInstance()
, but I'd have to assemble the entire instance myself?And a few related follow ups:
cue vet my-module/ path/to/my/config.json
I getcannot find package "my-module"
?cue vet example.com/my-cue-module my-data.json
?Thanks.
Beta Was this translation helpful? Give feedback.
All reactions