cue-lang / cue

The home of the CUE language! Validate and define text-based and dynamic configuration
https://cuelang.org
Apache License 2.0
5.14k stars 294 forks source link

tooling: integrating with other programming languages - cue server #1273

Open rajrahul opened 3 years ago

rajrahul commented 3 years ago

I would like to integrate cue-lang with our java/python services, I created a REST server in golang embedding all cue-lang dependencies to achieve this. We have multiple use cases like transforming JSON documents, validations and possibly policy evaluations.

Can such a REST service be shipped with the standard cue release? It could be run as a sidecar container, and will make it easier for other language developers in getting started without a golang wrapper. I checked OPA and it includes such a docker image.

Any recommended approach to this problem?

verdverm commented 3 years ago

The main problem is that CUE's evaluator is not concurrency safe yet. This means you need to lock many of the Go functions so that separate API requests are not processing CUE at the same time.

The intention is to eventually change this.

Other options are:

rajrahul commented 3 years ago

Generating OpenAPI for validation is a good idea. For scripting there are no alternatives it looks like.

mpvl commented 3 years ago

This may indeed be useful.

It would be good to write a proposal for this, with use cases, API etc.