Skip to content

Commit c891137

Browse files
committed
encoding: adopt naming convention for conversions
Change-Id: I626753fdc2a8b8ffb03d3a64ec5514f7cb6d06bf Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2440 Reviewed-by: Marcel van Lohuizen <[email protected]>
1 parent f23a596 commit c891137

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

encoding/doc.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,23 @@
1414

1515
// Package encoding contains subpackages to convert CUE to and from byte-level
1616
// and textual representations.
17+
//
18+
// For some packages, CUE can be mapped to both concrete values and higher-level
19+
// definitions. For instance, a Go value can be mapped based on its concrete
20+
// values or on its underlying type. Similarly, the protobuf package can extract
21+
// CUE definitions from .proto definitions files, but also convert proto
22+
// messages to concrete values.
23+
//
24+
// To clarify between these cases, we adopt the following naming convention:
25+
//
26+
// Name Direction Level Example
27+
// Decode x -> CUE Value Convert an incoming proto message to CUE
28+
// Encode CUE -> x Value Convert CUE to JSON
29+
// Extract x -> CUE Type Extract CUE definition from .proto file
30+
// Generate CUE -> x Type Generate OpenAPI definition from CUE
31+
//
32+
// To be more precise, Decoders and Encoders deal with concrete values only.
33+
//
34+
// Unmarshal and Marshal are used if the respective Decoder and Encoder decode
35+
// and encode from and to a stream of bytes.
1736
package encoding

0 commit comments

Comments
 (0)