@zio.dev/zio-blocks 0.0.31 → 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/guides/query-dsl-extending.md +1 -1
- package/guides/query-dsl-fluent-builder.md +1 -1
- package/guides/query-dsl-reified-optics.md +1 -1
- package/guides/query-dsl-sql.md +1 -1
- package/guides/zio-schema-migration.md +6 -6
- package/index.md +12 -12
- package/package.json +1 -1
- package/reference/codec.md +27 -19
- package/reference/context.md +1 -1
- package/reference/docs.md +1 -1
- package/reference/dynamic-schema.md +3 -3
- package/reference/formats.md +15 -11
- package/reference/media-type.md +2 -2
- package/reference/resource-management/resource.md +2 -2
- package/reference/resource-management/scope.md +1 -1
- package/reference/resource-management/wire.md +2 -2
- package/reference/schema-evolution/as.md +4 -4
- package/reference/schema-evolution/into.md +2 -2
- package/reference/schema-expr.md +2 -2
- package/reference/type-class-derivation.md +1 -1
- package/reference/xml.md +4 -5
- package/ringbuffer.md +1 -1
- package/undocumented-report.md +5 -5
|
@@ -52,7 +52,7 @@ Since `SchemaExpr` is a sealed trait, you cannot add new cases to it. Instead, w
|
|
|
52
52
|
This guide builds on [Part 1: Expressions](./query-dsl-reified-optics.md) and [Part 2: SQL Generation](./query-dsl-sql.md). You should be comfortable building `SchemaExpr` values and translating them to SQL.
|
|
53
53
|
|
|
54
54
|
```scala
|
|
55
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.
|
|
55
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.32"
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
```scala
|
|
@@ -57,7 +57,7 @@ In this guide, we solve both problems: bridge extensions eliminate `.toExpr`, an
|
|
|
57
57
|
This guide builds on [Part 1: Expressions](./query-dsl-reified-optics.md), [Part 2: SQL Generation](./query-dsl-sql.md), and [Part 3: Extending the Expression Language](./query-dsl-extending.md).
|
|
58
58
|
|
|
59
59
|
```scala
|
|
60
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.
|
|
60
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.32"
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
## Domain Setup
|
|
@@ -43,7 +43,7 @@ In this guide, we'll solve this by using ZIO Blocks' `SchemaExpr` and reified op
|
|
|
43
43
|
Add the ZIO Blocks Schema dependency:
|
|
44
44
|
|
|
45
45
|
```scala
|
|
46
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.
|
|
46
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.32"
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
```scala
|
package/guides/query-dsl-sql.md
CHANGED
|
@@ -43,7 +43,7 @@ Since `SchemaExpr` is a sealed trait, we can write a single interpreter that tra
|
|
|
43
43
|
This guide builds on [Part 1: Expressions](./query-dsl-reified-optics.md). You should be comfortable building `SchemaExpr` values with optic operators (`===`, `>`, `&&`, etc.).
|
|
44
44
|
|
|
45
45
|
```scala
|
|
46
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.
|
|
46
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.32"
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
```scala
|
|
@@ -38,13 +38,13 @@ libraryDependencies += "dev.zio" %% "zio-schema-avro" % "1.x.x"
|
|
|
38
38
|
**After (ZIO Blocks Schema):**
|
|
39
39
|
|
|
40
40
|
```scala
|
|
41
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.
|
|
41
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.32"
|
|
42
42
|
// Optional codec modules:
|
|
43
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema-avro" % "0.0.
|
|
44
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema-thrift" % "0.0.
|
|
45
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema-bson" % "0.0.
|
|
46
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema-messagepack" % "0.0.
|
|
47
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema-toon" % "0.0.
|
|
43
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema-avro" % "0.0.32"
|
|
44
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema-thrift" % "0.0.32"
|
|
45
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema-bson" % "0.0.32"
|
|
46
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema-messagepack" % "0.0.32"
|
|
47
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema-toon" % "0.0.32"
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
Key points:
|
package/index.md
CHANGED
|
@@ -82,14 +82,14 @@ val thriftCodec = Schema[Person].derive(ThriftFormat) // Thrift
|
|
|
82
82
|
### Installation
|
|
83
83
|
|
|
84
84
|
```scala
|
|
85
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.
|
|
85
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.32"
|
|
86
86
|
|
|
87
87
|
// Optional format modules:
|
|
88
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema-avro" % "0.0.
|
|
89
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema-toon" % "0.0.
|
|
90
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema-messagepack" % "0.0.
|
|
91
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema-thrift" % "0.0.
|
|
92
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema-bson" % "0.0.
|
|
88
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema-avro" % "0.0.32"
|
|
89
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema-toon" % "0.0.32"
|
|
90
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema-messagepack" % "0.0.32"
|
|
91
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema-thrift" % "0.0.32"
|
|
92
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema-bson" % "0.0.32"
|
|
93
93
|
```
|
|
94
94
|
|
|
95
95
|
### Example: Optics
|
|
@@ -144,7 +144,7 @@ Chunk is designed for:
|
|
|
144
144
|
### Installation
|
|
145
145
|
|
|
146
146
|
```scala
|
|
147
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-chunk" % "0.0.
|
|
147
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-chunk" % "0.0.32"
|
|
148
148
|
```
|
|
149
149
|
|
|
150
150
|
### Example
|
|
@@ -233,7 +233,7 @@ Scope.global.scoped { scope =>
|
|
|
233
233
|
### Installation
|
|
234
234
|
|
|
235
235
|
```scala
|
|
236
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-scope" % "0.0.
|
|
236
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-scope" % "0.0.32"
|
|
237
237
|
```
|
|
238
238
|
|
|
239
239
|
### Example: Basic Resource Management
|
|
@@ -342,7 +342,7 @@ Generating documentation, README files, or any Markdown content programmatically
|
|
|
342
342
|
### Installation
|
|
343
343
|
|
|
344
344
|
```scala
|
|
345
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-docs" % "0.0.
|
|
345
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-docs" % "0.0.32"
|
|
346
346
|
```
|
|
347
347
|
|
|
348
348
|
### Example
|
|
@@ -426,7 +426,7 @@ Compile-time type identity with rich metadata. TypeId captures comprehensive inf
|
|
|
426
426
|
### Installation
|
|
427
427
|
|
|
428
428
|
```scala
|
|
429
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-typeid" % "0.0.
|
|
429
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-typeid" % "0.0.32"
|
|
430
430
|
```
|
|
431
431
|
|
|
432
432
|
### Example
|
|
@@ -469,7 +469,7 @@ A type-indexed heterogeneous collection that stores values by their types with c
|
|
|
469
469
|
### Installation
|
|
470
470
|
|
|
471
471
|
```scala
|
|
472
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-context" % "0.0.
|
|
472
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-context" % "0.0.32"
|
|
473
473
|
```
|
|
474
474
|
|
|
475
475
|
### Example
|
|
@@ -521,7 +521,7 @@ Standard `java.util.concurrent` queues use node allocation (`ConcurrentLinkedQue
|
|
|
521
521
|
### Installation
|
|
522
522
|
|
|
523
523
|
```scala
|
|
524
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-ringbuffer" % "0.0.
|
|
524
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-ringbuffer" % "0.0.32"
|
|
525
525
|
```
|
|
526
526
|
|
|
527
527
|
### Example
|
package/package.json
CHANGED
package/reference/codec.md
CHANGED
|
@@ -19,7 +19,7 @@ abstract class Codec[DecodeInput, EncodeOutput, Value] {
|
|
|
19
19
|
- **`encode`** writes the encoded form of `value` into `output`. The output parameter is typically a mutable buffer (`ByteBuffer`, `CharBuffer`) that the caller provides.
|
|
20
20
|
- **`decode`** reads from `input` and returns either a `SchemaError` describing the failure or the decoded value.
|
|
21
21
|
|
|
22
|
-
End users rarely interact with `Codec` directly. Instead, they work with format-specific subclasses like `JsonCodec[A]` or `
|
|
22
|
+
End users rarely interact with `Codec` directly. Instead, they work with format-specific subclasses like `JsonCodec[A]` or `ToonCodec[A]`, which add convenience methods for common input/output types.
|
|
23
23
|
|
|
24
24
|
Given a `Schema[A]`, you can derive a codec for any supported format by calling `Schema[A].derive(format)`, which uses the `Deriver` associated with that format to generate the appropriate codec instance. For example, to derive a JSON codec:
|
|
25
25
|
|
|
@@ -32,8 +32,8 @@ case class Person(name: String, age: Int)
|
|
|
32
32
|
object Person {
|
|
33
33
|
// Derive a schema for Person (required for codec derivation)
|
|
34
34
|
implicit val schema: Schema[Person] = Schema.derived
|
|
35
|
-
// Derive a JSON codec from the schema
|
|
36
|
-
|
|
35
|
+
// Derive a JSON codec from the schema
|
|
36
|
+
val codec: JsonCodec[Person] = schema.derive(JsonFormat)
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
// Encode
|
|
@@ -48,23 +48,26 @@ val result: Either[SchemaError, Person] = Person.codec.decode(bytes)
|
|
|
48
48
|
To include the base schema module with JSON support, add the following dependency to your `build.sbt`:
|
|
49
49
|
|
|
50
50
|
```scala
|
|
51
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.
|
|
51
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.32"
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
Additional format modules are separate artifacts:
|
|
55
55
|
|
|
56
56
|
```scala
|
|
57
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema-avro" % "0.0.
|
|
58
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema-
|
|
59
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema-
|
|
60
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema-
|
|
61
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema-
|
|
57
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema-avro" % "0.0.32"
|
|
58
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema-bson" % "0.0.32"
|
|
59
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema-csv" % "0.0.32"
|
|
60
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema-messagepack" % "0.0.32"
|
|
61
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema-thrift" % "0.0.32"
|
|
62
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema-toon" % "0.0.32"
|
|
63
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema-xml" % "0.0.32"
|
|
64
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema-yaml" % "0.0.32"
|
|
62
65
|
```
|
|
63
66
|
|
|
64
67
|
For cross-platform projects (Scala.js):
|
|
65
68
|
|
|
66
69
|
```scala
|
|
67
|
-
libraryDependencies += "dev.zio" %%% "zio-blocks-schema" % "0.0.
|
|
70
|
+
libraryDependencies += "dev.zio" %%% "zio-blocks-schema" % "0.0.32"
|
|
68
71
|
```
|
|
69
72
|
|
|
70
73
|
Supported Scala versions: 2.13.x and 3.x.
|
|
@@ -76,12 +79,15 @@ The codec system in ZIO Blocks is organized as a layered hierarchy:
|
|
|
76
79
|
```
|
|
77
80
|
Codec[DecodeInput, EncodeOutput, Value]
|
|
78
81
|
├── BinaryCodec[A] = Codec[ByteBuffer, ByteBuffer, A] (ByteBuffer ↔ A)
|
|
82
|
+
│ ├── AvroCodec[A]
|
|
79
83
|
│ ├── JsonCodec[A]
|
|
80
|
-
│ ├──
|
|
81
|
-
│ ├──
|
|
82
|
-
│ ├──
|
|
83
|
-
│
|
|
84
|
+
│ ├── MessagePackCodec[A]
|
|
85
|
+
│ ├── ThriftCodec[A]
|
|
86
|
+
│ ├── ToonCodec[A]
|
|
87
|
+
│ ├── XmlCodec[A]
|
|
88
|
+
│ └── YamlCodec[A]
|
|
84
89
|
└── TextCodec[A] = Codec[CharBuffer, CharBuffer, A] (CharBuffer ↔ A)
|
|
90
|
+
└── CsvCodec[A]
|
|
85
91
|
```
|
|
86
92
|
|
|
87
93
|
1. **`BinaryCodec[A]`** fixes both the input and output to `ByteBuffer` and is the base class for all codecs that operate on binary data:
|
|
@@ -207,7 +213,7 @@ Passing a `Deriver` directly is useful when working with custom or configured de
|
|
|
207
213
|
|
|
208
214
|
## Convenience Methods on Format-Specific Codecs
|
|
209
215
|
|
|
210
|
-
While the base `Codec` class defines only `encode(value, output)` and `decode(input)`, format-specific subclasses like `JsonCodec` and `
|
|
216
|
+
While the base `Codec` class defines only `encode(value, output)` and `decode(input)`, format-specific subclasses like `JsonCodec` and `ToonCodec` add convenience overloads for common I/O types.
|
|
211
217
|
|
|
212
218
|
### JsonCodec Convenience Methods
|
|
213
219
|
|
|
@@ -244,9 +250,9 @@ val is = new ByteArrayInputStream(os.toByteArray)
|
|
|
244
250
|
val fromStream: Either[SchemaError, Person] = codec.decode(is)
|
|
245
251
|
```
|
|
246
252
|
|
|
247
|
-
###
|
|
253
|
+
### ToonCodec Convenience Methods
|
|
248
254
|
|
|
249
|
-
`
|
|
255
|
+
`ToonCodec[A]` provides the same set of overloads:
|
|
250
256
|
|
|
251
257
|
```scala
|
|
252
258
|
import zio.blocks.schema._
|
|
@@ -348,7 +354,7 @@ object Person {
|
|
|
348
354
|
implicit val schema: Schema[Person] = Schema.derived
|
|
349
355
|
}
|
|
350
356
|
|
|
351
|
-
val customDeriver =
|
|
357
|
+
val customDeriver = ToonCodecDeriver
|
|
352
358
|
.withFieldNameMapper(NameMapper.SnakeCase)
|
|
353
359
|
.withArrayFormat(ArrayFormat.Tabular)
|
|
354
360
|
.withDiscriminatorKind(DiscriminatorKind.Field("type"))
|
|
@@ -365,11 +371,13 @@ import zio.blocks.schema._
|
|
|
365
371
|
import zio.blocks.schema.json._
|
|
366
372
|
|
|
367
373
|
case class Address(street: String, city: String)
|
|
368
|
-
case class Person(name: String, address: Address)
|
|
369
374
|
|
|
370
375
|
object Address {
|
|
371
376
|
implicit val schema: Schema[Address] = Schema.derived
|
|
372
377
|
}
|
|
378
|
+
|
|
379
|
+
case class Person(name: String, address: Address)
|
|
380
|
+
|
|
373
381
|
object Person {
|
|
374
382
|
implicit val schema: Schema[Person] = Schema.derived
|
|
375
383
|
}
|
package/reference/context.md
CHANGED
|
@@ -116,7 +116,7 @@ val config = ctx.get[Config] // Compile-time proof it exists
|
|
|
116
116
|
Add the ZIO Blocks Context module to your `build.sbt`:
|
|
117
117
|
|
|
118
118
|
```scala
|
|
119
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-context" % "0.0.
|
|
119
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-context" % "0.0.32"
|
|
120
120
|
```
|
|
121
121
|
|
|
122
122
|
## Construction
|
package/reference/docs.md
CHANGED
|
@@ -10,7 +10,7 @@ Complete API reference for the zio-blocks-docs module - a zero-dependency GitHub
|
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
12
12
|
```scala
|
|
13
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-docs" % "0.0.
|
|
13
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-docs" % "0.0.32"
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
## Core Types
|
|
@@ -83,7 +83,7 @@ dynamic
|
|
|
83
83
|
// value = Primitive(
|
|
84
84
|
// primitiveType = String(None),
|
|
85
85
|
// typeId = String,
|
|
86
|
-
// primitiveBinding = zio.blocks.schema.binding.NoBinding$$anon$1@
|
|
86
|
+
// primitiveBinding = zio.blocks.schema.binding.NoBinding$$anon$1@6cfd3324,
|
|
87
87
|
// doc = Doc(blocks = IndexedSeq(), metadata = Map()),
|
|
88
88
|
// modifiers = List(),
|
|
89
89
|
// storedDefaultValue = None,
|
|
@@ -97,7 +97,7 @@ dynamic
|
|
|
97
97
|
// value = Primitive(
|
|
98
98
|
// primitiveType = Int(None),
|
|
99
99
|
// typeId = Int,
|
|
100
|
-
// primitiveBinding = zio.blocks.schema.binding.NoBinding$$anon$1@
|
|
100
|
+
// primitiveBinding = zio.blocks.schema.binding.NoBinding$$anon$1@6cfd3324,
|
|
101
101
|
// doc = Doc(blocks = IndexedSeq(), metadata = Map()),
|
|
102
102
|
// modifiers = List(),
|
|
103
103
|
// storedDefaultValue = None,
|
|
@@ -115,7 +115,7 @@ dynamic
|
|
|
115
115
|
// value = Primitive(
|
|
116
116
|
// primitiveType = String(None),
|
|
117
117
|
// typeId = String,
|
|
118
|
-
// primitiveBinding = zio.blocks.schema.binding.NoBinding$$anon$1@
|
|
118
|
+
// primitiveBinding = zio.blocks.schema.binding.NoBinding$$anon$1@6cfd3324,
|
|
119
119
|
// doc = Doc(blocks = IndexedSeq(), metadata = Map()),
|
|
120
120
|
// modifiers = List(),
|
|
121
121
|
// storedDefaultValue = None,
|
package/reference/formats.md
CHANGED
|
@@ -44,13 +44,17 @@ object JsonFormat extends BinaryFormat("application/json", JsonCodecDeriver)
|
|
|
44
44
|
|
|
45
45
|
Here's a summary of the formats currently supported by ZIO Blocks. Each format provides a `BinaryFormat` object that can be passed to `derive`:
|
|
46
46
|
|
|
47
|
-
| Format Object | Codec Type
|
|
48
|
-
|
|
49
|
-
| `JsonFormat` | `JsonCodec[A]`
|
|
50
|
-
| `
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
47
|
+
| Format Object | Codec Type | MIME Type | Module |
|
|
48
|
+
|---------------------|-----------------------|-----------------------|---------------------------------|
|
|
49
|
+
| `JsonFormat` | `JsonCodec[A]` | `application/json` | `zio-blocks-schema` |
|
|
50
|
+
| `AvroFormat` | `AvroCodec[A]` | `application/avro` | `zio-blocks-schema-avro` |
|
|
51
|
+
| `BsonFormat` | `BsonCodec[A]` | `application/bson` | `zio-blocks-schema-bson` |
|
|
52
|
+
| `CsvFormat` | `CsvCodec[A]` | `text/csv` | `zio-blocks-schema-csv` |
|
|
53
|
+
| `MessagePackFormat` | `MessagePackCodec[A]` | `application/msgpack` | `zio-blocks-schema-messagepack` |
|
|
54
|
+
| `ThriftFormat` | `ThriftCodec[A]` | `application/thrift` | `zio-blocks-schema-thrift` |
|
|
55
|
+
| `ToonFormat` | `ToonCodec[A]` | `text/toon` | `zio-blocks-schema-toon` |
|
|
56
|
+
| `XmlFormat` | `XmlCodec[A]` | `application/xml` | `zio-blocks-schema-xml` |
|
|
57
|
+
| `YamlFormat` | `YamlCodec[A]` | `application/yaml` | `zio-blocks-schema-yaml` |
|
|
54
58
|
|
|
55
59
|
## Defining a Custom Format
|
|
56
60
|
|
|
@@ -162,7 +166,7 @@ val decoded: Either[SchemaError, Person] = codec.decode(bytes)
|
|
|
162
166
|
|
|
163
167
|
### Avro Schema Generation
|
|
164
168
|
|
|
165
|
-
Each `
|
|
169
|
+
Each `AvroCodec` exposes an `avroSchema` property containing the Apache Avro schema:
|
|
166
170
|
|
|
167
171
|
```scala
|
|
168
172
|
import zio.blocks.schema._
|
|
@@ -308,7 +312,7 @@ orders[2]{id,total}:
|
|
|
308
312
|
|
|
309
313
|
### Configuration Options
|
|
310
314
|
|
|
311
|
-
The `
|
|
315
|
+
The `ToonCodecDeriver` provides extensive configuration:
|
|
312
316
|
|
|
313
317
|
```scala
|
|
314
318
|
import zio.blocks.schema._
|
|
@@ -320,7 +324,7 @@ object Person {
|
|
|
320
324
|
}
|
|
321
325
|
|
|
322
326
|
// Custom deriver with snake_case field names
|
|
323
|
-
val customDeriver =
|
|
327
|
+
val customDeriver = ToonCodecDeriver
|
|
324
328
|
.withFieldNameMapper(NameMapper.SnakeCase)
|
|
325
329
|
.withArrayFormat(ArrayFormat.Tabular)
|
|
326
330
|
.withDiscriminatorKind(DiscriminatorKind.Field("type"))
|
|
@@ -362,7 +366,7 @@ val keyCodec = Schema[Shape].derive(ToonFormat)
|
|
|
362
366
|
// radius: 5
|
|
363
367
|
|
|
364
368
|
// Field discriminator
|
|
365
|
-
val fieldDeriver =
|
|
369
|
+
val fieldDeriver = ToonCodecDeriver
|
|
366
370
|
.withDiscriminatorKind(DiscriminatorKind.Field("type"))
|
|
367
371
|
val fieldCodec = Schema[Shape].derive(fieldDeriver)
|
|
368
372
|
// type: Circle
|
package/reference/media-type.md
CHANGED
|
@@ -75,13 +75,13 @@ textAny.matches(html) // true
|
|
|
75
75
|
Add the following to your `build.sbt`:
|
|
76
76
|
|
|
77
77
|
```scala
|
|
78
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-mediatype" % "0.0.
|
|
78
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-mediatype" % "0.0.32"
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
For cross-platform projects (Scala.js):
|
|
82
82
|
|
|
83
83
|
```scala
|
|
84
|
-
libraryDependencies += "dev.zio" %%% "zio-blocks-mediatype" % "0.0.
|
|
84
|
+
libraryDependencies += "dev.zio" %%% "zio-blocks-mediatype" % "0.0.32"
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
Supported Scala versions: 2.13.x and 3.x.
|
|
@@ -36,13 +36,13 @@ Without Resources, managing complex initialization and cleanup is tedious and er
|
|
|
36
36
|
Add the ZIO Blocks Scope module to your `build.sbt`:
|
|
37
37
|
|
|
38
38
|
```scala
|
|
39
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-scope" % "0.0.
|
|
39
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-scope" % "0.0.32"
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
For cross-platform (Scala.js):
|
|
43
43
|
|
|
44
44
|
```scala
|
|
45
|
-
libraryDependencies += "dev.zio" %%% "zio-blocks-scope" % "0.0.
|
|
45
|
+
libraryDependencies += "dev.zio" %%% "zio-blocks-scope" % "0.0.32"
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
Supported Scala versions: 2.13.x and 3.x.
|
|
@@ -55,7 +55,7 @@ If you've used `try/finally`, `Using`, or ZIO's `Scope`, this is the same proble
|
|
|
55
55
|
Add the following dependency to your `build.sbt`:
|
|
56
56
|
|
|
57
57
|
```scala
|
|
58
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-scope" % "0.0.
|
|
58
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-scope" % "0.0.32"
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
Supported Scala versions: **2.13.x** and **3.x**.
|
|
@@ -92,13 +92,13 @@ Scope.global.scoped { scope =>
|
|
|
92
92
|
Add the following dependency to your `build.sbt`:
|
|
93
93
|
|
|
94
94
|
```scala
|
|
95
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-scope" % "0.0.
|
|
95
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-scope" % "0.0.32"
|
|
96
96
|
```
|
|
97
97
|
|
|
98
98
|
For cross-platform (Scala.js):
|
|
99
99
|
|
|
100
100
|
```scala
|
|
101
|
-
libraryDependencies += "dev.zio" %%% "zio-blocks-scope" % "0.0.
|
|
101
|
+
libraryDependencies += "dev.zio" %%% "zio-blocks-scope" % "0.0.32"
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
Supported Scala versions: 2.13.x and 3.x.
|
|
@@ -39,13 +39,13 @@ The bidirectional data flow looks like this:
|
|
|
39
39
|
`As` is part of `zio-blocks-schema`:
|
|
40
40
|
|
|
41
41
|
```scala
|
|
42
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.
|
|
42
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.32"
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
For Scala.js and Scala Native, use `%%%`:
|
|
46
46
|
|
|
47
47
|
```scala
|
|
48
|
-
libraryDependencies += "dev.zio" %%% "zio-blocks-schema" % "0.0.
|
|
48
|
+
libraryDependencies += "dev.zio" %%% "zio-blocks-schema" % "0.0.32"
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
Supported Scala versions: 2.13.x and 3.x.
|
|
@@ -240,7 +240,7 @@ trait As[A, B] {
|
|
|
240
240
|
|
|
241
241
|
```scala
|
|
242
242
|
val revAs: As[LongBox, IntBox] = boxAs.reverse
|
|
243
|
-
// revAs: As[LongBox, IntBox] = zio.blocks.schema.As$$anon$1@
|
|
243
|
+
// revAs: As[LongBox, IntBox] = zio.blocks.schema.As$$anon$1@4bdeb475
|
|
244
244
|
|
|
245
245
|
revAs.into(LongBox(5L))
|
|
246
246
|
// res11: Either[SchemaError, IntBox] = Right(IntBox(5))
|
|
@@ -302,7 +302,7 @@ We import `As.reverseInto` and use it to obtain the reverse `Into[Int, String]`:
|
|
|
302
302
|
import As.reverseInto
|
|
303
303
|
|
|
304
304
|
val intToStr: Into[Int, String] = reverseInto[String, Int]
|
|
305
|
-
// intToStr: Into[Int, String] = zio.blocks.schema.AsLowPriorityImplicits$$Lambda$
|
|
305
|
+
// intToStr: Into[Int, String] = zio.blocks.schema.AsLowPriorityImplicits$$Lambda$17666/0x00007fd5f2a55c70@497d9813
|
|
306
306
|
intToStr.into(42)
|
|
307
307
|
// res14: Either[SchemaError, String] = Right("42")
|
|
308
308
|
```
|
|
@@ -69,13 +69,13 @@ Compare this to a manual implementation:
|
|
|
69
69
|
`Into` is part of the `zio-blocks-schema` module:
|
|
70
70
|
|
|
71
71
|
```scala
|
|
72
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.
|
|
72
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.32"
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
For Scala.js:
|
|
76
76
|
|
|
77
77
|
```scala
|
|
78
|
-
libraryDependencies += "dev.zio" %%% "zio-blocks-schema" % "0.0.
|
|
78
|
+
libraryDependencies += "dev.zio" %%% "zio-blocks-schema" % "0.0.32"
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
Supported Scala versions: 2.13.x and 3.x.
|
package/reference/schema-expr.md
CHANGED
|
@@ -70,13 +70,13 @@ val result: Either[OpticCheck, Seq[Boolean]] = combined.eval(alice)
|
|
|
70
70
|
## Installation
|
|
71
71
|
|
|
72
72
|
```scala
|
|
73
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.
|
|
73
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.32"
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
For cross-platform (Scala.js):
|
|
77
77
|
|
|
78
78
|
```scala
|
|
79
|
-
libraryDependencies += "dev.zio" %%% "zio-blocks-schema" % "0.0.
|
|
79
|
+
libraryDependencies += "dev.zio" %%% "zio-blocks-schema" % "0.0.32"
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
Supported Scala versions: 2.13.x and 3.x.
|
|
@@ -1455,7 +1455,7 @@ Now we can use the derived `Gen[Person]` instance to generate random `Person` va
|
|
|
1455
1455
|
|
|
1456
1456
|
```scala
|
|
1457
1457
|
val random = new Random(42) // Seeded for reproducible output
|
|
1458
|
-
// random: Random = scala.util.Random@
|
|
1458
|
+
// random: Random = scala.util.Random@195c6b05
|
|
1459
1459
|
|
|
1460
1460
|
Person.gen.generate(random)
|
|
1461
1461
|
// res14: Person = Person(name = "p", age = -1360544799)
|
package/reference/xml.md
CHANGED
|
@@ -942,9 +942,9 @@ All standard ZIO Blocks Schema types are supported:
|
|
|
942
942
|
- Options (`Option[A]`)
|
|
943
943
|
- Wrappers (newtypes)
|
|
944
944
|
|
|
945
|
-
##
|
|
945
|
+
## XmlCodec
|
|
946
946
|
|
|
947
|
-
`
|
|
947
|
+
`XmlCodec[A]` is the low-level codec interface that bridges Schema definitions with XML serialization. While usually derived automatically, you can work with it directly:
|
|
948
948
|
|
|
949
949
|
```scala
|
|
950
950
|
import zio.blocks.schema._
|
|
@@ -956,8 +956,7 @@ object Person {
|
|
|
956
956
|
}
|
|
957
957
|
|
|
958
958
|
// Get the underlying binary codec
|
|
959
|
-
val codec:
|
|
960
|
-
Schema[Person].derive(XmlBinaryCodecDeriver)
|
|
959
|
+
val codec: XmlCodec[Person] = Schema[Person].derive(XmlCodecDeriver)
|
|
961
960
|
|
|
962
961
|
// Encode to Xml directly
|
|
963
962
|
val person = Person("Alice", 30)
|
|
@@ -967,7 +966,7 @@ val xml: Xml = codec.encodeValue(person)
|
|
|
967
966
|
val decoded: Either[XmlError, Person] = codec.decodeValue(xml)
|
|
968
967
|
```
|
|
969
968
|
|
|
970
|
-
**
|
|
969
|
+
**XmlCodec supports all Schema types:**
|
|
971
970
|
- Primitives (Int, String, Boolean, etc.)
|
|
972
971
|
- Java time types (Instant, LocalDate, Duration, etc.)
|
|
973
972
|
- Records (case classes with field-level configuration)
|
package/ringbuffer.md
CHANGED
|
@@ -25,7 +25,7 @@ All variants expose `offer` (returns `false` if full) and `take` (returns `null`
|
|
|
25
25
|
## Installation
|
|
26
26
|
|
|
27
27
|
```scala
|
|
28
|
-
libraryDependencies += "dev.zio" %% "zio-blocks-ringbuffer" % "0.0.
|
|
28
|
+
libraryDependencies += "dev.zio" %% "zio-blocks-ringbuffer" % "0.0.32"
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
---
|
package/undocumented-report.md
CHANGED
|
@@ -74,8 +74,8 @@ These are core public API types that users interact with directly. Each needs a
|
|
|
74
74
|
|
|
75
75
|
**Format codec modules:**
|
|
76
76
|
- [ ] **`BsonEncoder` / `BsonDecoder` / `BsonCodec`** (schema-bson) — Core encoding/decoding types for BSON. **Scope: expand formats.md BSON section**. Source: `schema-bson/src/main/scala/zio/blocks/schema/bson/BsonTypes.scala`
|
|
77
|
-
- [ ] **`
|
|
78
|
-
- [ ] **`
|
|
77
|
+
- [ ] **`MessagePackCodec`** (schema-messagepack) — Public codec for MessagePack. **Scope: expand formats.md MessagePack section**. Source: `schema-messagepack/src/main/scala/zio/blocks/schema/msgpack/MessagePackCodec.scala`
|
|
78
|
+
- [ ] **`ThriftCodec`** (schema-thrift) — Public codec for Thrift. **Scope: expand formats.md Thrift section**. Source: `schema-thrift/src/main/scala/zio/blocks/schema/thrift/ThriftCodec.scala`
|
|
79
79
|
- [ ] **`ToonReader` / `ToonWriter`** (schema-toon) — Public codec for TOON. Referenced in 9-10 files. **Scope: expand formats.md TOON section**. Source: `schema-toon/src/main/scala/zio/blocks/schema/toon/`
|
|
80
80
|
|
|
81
81
|
**markdown module:**
|
|
@@ -244,7 +244,7 @@ Internal types that don't need documentation.
|
|
|
244
244
|
| `Registry` / `Registry.Entry` | schema | Internal binding resolver storage |
|
|
245
245
|
| `ObjectIdSupport` | schema-bson | Internal BSON ObjectId helper |
|
|
246
246
|
| `BsonBuilder` / `BsonTrace` / `EncoderContext` / `BsonDecoderContext` | schema-bson | Internal codec implementation |
|
|
247
|
-
| `
|
|
247
|
+
| `MessagePackCodecDeriver` | schema-messagepack | Internal deriver |
|
|
248
248
|
| `MessagePackReader` / `MessagePackWriter` | schema-messagepack | Internal binary readers/writers |
|
|
249
249
|
| `Mixed` / `UniformRecords` | schema-toon | Internal codec strategy types |
|
|
250
250
|
| `ArrayHeader` | schema-toon | Internal reader state |
|
|
@@ -313,8 +313,8 @@ Ordered TODO checklist grouped by module, with estimated scope.
|
|
|
313
313
|
### Format modules (expand `formats.md`)
|
|
314
314
|
|
|
315
315
|
26. - [ ] Expand **BSON section** in `formats.md` with BsonEncoder/BsonDecoder API — *update existing*
|
|
316
|
-
27. - [ ] Expand **MessagePack section** in `formats.md` with
|
|
317
|
-
28. - [ ] Expand **Thrift section** in `formats.md` with
|
|
316
|
+
27. - [ ] Expand **MessagePack section** in `formats.md` with MessagePackCodec API — *update existing*
|
|
317
|
+
28. - [ ] Expand **Thrift section** in `formats.md` with ThriftCodec API — *update existing*
|
|
318
318
|
29. - [ ] Expand **TOON section** in `formats.md` with ToonReader/ToonWriter, Delimiter, config — *update existing*
|
|
319
319
|
|
|
320
320
|
### Depth improvements (existing pages)
|