github.com/solo-io/cue@v0.4.7/README.md (about) 1 <!-- 2 Copyright 2018 The CUE Authors 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 --> 16 [![Go Reference](https://pkg.go.dev/badge/cuelang.org/go.svg)](https://pkg.go.dev/cuelang.org/go) 17 [![Github](https://github.com/cuelang/cue/workflows/Test/badge.svg)](https://github.com/cuelang/cue/actions) 18 [![GolangCI](https://golangci.com/badges/github.com/cuelang/cue.svg)](https://golangci.com/r/github.com/cuelang/cue) 19 [![Go 1.14+](https://img.shields.io/badge/go-1.14-9cf.svg)](https://golang.org/dl/) 20 [![platforms](https://img.shields.io/badge/platforms-linux|windows|macos-inactive.svg)]() 21 22 23 # The CUE Data Constraint Language 24 25 _Configure, Unify, Execute_ 26 27 CUE is an open source data constraint language which aims 28 to simplify tasks involving defining and using data. 29 30 It is a superset of JSON, 31 allowing users familiar with JSON to get started quickly. 32 33 34 ### What is it for? 35 36 You can use CUE to 37 38 - define a detailed validation schema for your data (manually or automatically from data) 39 - reduce boilerplate in your data (manually or automatically from schema) 40 - extract a schema from code 41 - generate type definitions and validation code 42 - merge JSON in a principled way 43 - define and run declarative scripts 44 45 46 ### How? 47 48 CUE merges the notion of schema and data. 49 The same CUE definition can simultaneously be used for validating data 50 and act as a template to reduce boilerplate. 51 Schema definition is enriched with fine-grained value definitions 52 and default values. 53 At the same time, 54 data can be simplified by removing values implied by such detailed definitions. 55 The merging of these two concepts enables 56 many tasks to be handled in a principled way. 57 58 59 Constraints provide a simple and well-defined, yet powerful, alternative 60 to inheritance, 61 a common source of complexity with configuration languages. 62 63 64 ### CUE Scripting 65 66 The CUE scripting layer defines declarative scripting, expressed in CUE, 67 on top of data. 68 This solves three problems: 69 working around the closedness of CUE definitions (we say CUE is hermetic), 70 providing an easy way to share common scripts and workflows for using data, 71 and giving CUE the knowledge of how data is used to optimize validation. 72 73 There are many tools that interpret data or use a specialized language for 74 a specific domain (Kustomize, Ksonnet). 75 This solves dealing with data on one level, but the problem it solves may repeat 76 itself at a higher level when integrating other systems in a workflow. 77 CUE scripting is generic and allows users to define any workflow. 78 79 80 ### Tooling 81 82 CUE is designed for automation. 83 Some aspects of this are: 84 85 - convert existing YAML and JSON 86 - automatically simplify configurations 87 - rich APIs designed for automated tooling 88 - formatter 89 - arbitrary-precision arithmetic 90 - generate CUE templates from source code 91 - generate source code from CUE definitions (TODO) 92 93 94 ### Download and Install 95 96 #### Release builds 97 98 [Download](https://github.com/cuelang/cue/releases) the latest release from GitHub. 99 100 #### Install using Homebrew 101 102 Using [Homebrew](https://brew.sh), you can install using the CUE Homebrew tap: 103 104 `brew install cuelang/tap/cue` 105 106 #### Install from Source 107 108 <!-- Keep the following in sync with cmd/cue/cmd/testdata/script/install*.txt --> 109 110 If you already have Go installed, the short version is: 111 112 ``` 113 GO111MODULE=on go get cuelang.org/go/cmd/cue 114 ``` 115 116 Or, if you are using Go 1.16: 117 118 ``` 119 go install cuelang.org/go/cmd/cue@latest 120 ``` 121 122 This will install the `cue` command line tool. 123 124 For more details see [Installing CUE](./doc/install.md). 125 126 127 ### Learning CUE 128 129 The fastest way to learn the basics is to follow the 130 [tutorial on basic language constructs](./doc/tutorial/basics/Readme.md). 131 132 A more elaborate tutorial demonstrating of how to convert and restructure 133 an existing set of Kubernetes configurations is available in 134 [written form](./doc/tutorial/kubernetes/README.md). 135 136 ### References 137 138 - [Language Specification](./doc/ref/spec.md): official CUE Language specification. 139 140 - [API](https://pkg.go.dev/cuelang.org/go/cue): the API on pkg.go.dev 141 142 - [Builtin packages](https://pkg.go.dev/cuelang.org/go/pkg): builtins available from CUE programs 143 144 - [`cue` Command line reference](./doc/cmd/cue.md): the `cue` command 145 146 147 ### Contributing 148 149 Our canonical Git repository is located at https://cue.googlesource.com. 150 151 To contribute, please read the [Contribution Guide](./doc/contribute.md). 152 153 To report issues or make a feature request, use the 154 [issue tracker](https://github.com/cuelang/cue/issues). 155 156 Changes can be contributed using Gerrit or Github pull requests. 157 158 159 ### Contact 160 161 You can get in touch with the cuelang community in the following ways: 162 163 - Ask questions via [GitHub Discussions](https://github.com/cuelang/cue/discussions) 164 - Chat with us on our 165 [Slack workspace](https://join.slack.com/t/cuelang/shared_invite/enQtNzQwODc3NzYzNTA0LTAxNWQwZGU2YWFiOWFiOWQ4MjVjNGQ2ZTNlMmIxODc4MDVjMDg5YmIyOTMyMjQ2MTkzMTU5ZjA1OGE0OGE1NmE). 166 167 168 --- 169 170 Unless otherwise noted, the CUE source files are distributed 171 under the Apache 2.0 license found in the LICENSE file. 172 173 This is not an officially supported Google product. 174