@zio.dev/zio-blocks 0.0.29 → 0.0.31

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.
Files changed (36) hide show
  1. package/guides/compile-time-resource-safety-with-scope.md +997 -0
  2. package/guides/query-dsl-extending.md +1 -1
  3. package/guides/query-dsl-fluent-builder.md +203 -203
  4. package/guides/query-dsl-reified-optics.md +1 -1
  5. package/guides/query-dsl-sql.md +1 -1
  6. package/guides/zio-schema-migration.md +8 -8
  7. package/index.md +20 -14
  8. package/package.json +1 -1
  9. package/reference/codec.md +17 -17
  10. package/reference/context.md +49 -1
  11. package/reference/docs.md +1 -1
  12. package/reference/dynamic-schema.md +39 -42
  13. package/reference/formats.md +5 -11
  14. package/reference/json-schema.md +2 -2
  15. package/reference/json.md +34 -43
  16. package/reference/media-type.md +2 -2
  17. package/reference/modifier.md +4 -4
  18. package/reference/resource-management/defer-handle.md +246 -0
  19. package/reference/resource-management/finalization.md +286 -0
  20. package/reference/resource-management/finalizer.md +167 -0
  21. package/reference/{resource-management-di → resource-management}/index.md +3 -8
  22. package/reference/{resource-management-di → resource-management}/resource.md +532 -50
  23. package/reference/resource-management/scope.md +3026 -0
  24. package/reference/resource-management/unscoped.md +125 -0
  25. package/reference/{resource-management-di → resource-management}/wire.md +122 -28
  26. package/reference/schema-error.md +0 -1
  27. package/reference/schema-evolution/as.md +4 -4
  28. package/reference/schema-evolution/into.md +2 -2
  29. package/reference/schema-expr.md +2 -2
  30. package/reference/schema.md +9 -4
  31. package/reference/streams.md +989 -0
  32. package/reference/type-class-derivation.md +14 -15
  33. package/ringbuffer.md +1 -1
  34. package/sidebars.js +9 -4
  35. package/undocumented-report.md +1 -1
  36. package/reference/resource-management-di/scope.md +0 -1423
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@zio.dev/zio-blocks",
3
3
  "description": "ZIO Blocks Documentation",
4
4
  "license": "Apache-2.0",
5
- "version": "0.0.29",
5
+ "version": "0.0.31",
6
6
  "repository": {
7
7
  "url": "https://github.com/zio/zio-blocks"
8
8
  }
@@ -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 `JsonBinaryCodec[A]` or `ToonBinaryCodec[A]`, which add convenience methods for common input/output types.
22
+ End users rarely interact with `Codec` directly. Instead, they work with format-specific subclasses like `JsonCodec[A]` or `ToonBinaryCodec[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
 
@@ -33,7 +33,7 @@ object Person {
33
33
  // Derive a schema for Person (required for codec derivation)
34
34
  implicit val schema: Schema[Person] = Schema.derived
35
35
  // Derive a JSON codec from the schema
36
- implicit val codec: JsonBinaryCodec[Person] = schema.derive(JsonFormat)
36
+ implicit val codec: JsonCodec[Person] = schema.derive(JsonFormat)
37
37
  }
38
38
 
39
39
  // Encode
@@ -48,23 +48,23 @@ 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.29"
51
+ libraryDependencies += "dev.zio" %% "zio-blocks-schema" % "0.0.31"
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.29"
58
- libraryDependencies += "dev.zio" %% "zio-blocks-schema-toon" % "0.0.29"
59
- libraryDependencies += "dev.zio" %% "zio-blocks-schema-messagepack" % "0.0.29"
60
- libraryDependencies += "dev.zio" %% "zio-blocks-schema-thrift" % "0.0.29"
61
- libraryDependencies += "dev.zio" %% "zio-blocks-schema-bson" % "0.0.29"
57
+ libraryDependencies += "dev.zio" %% "zio-blocks-schema-avro" % "0.0.31"
58
+ libraryDependencies += "dev.zio" %% "zio-blocks-schema-toon" % "0.0.31"
59
+ libraryDependencies += "dev.zio" %% "zio-blocks-schema-messagepack" % "0.0.31"
60
+ libraryDependencies += "dev.zio" %% "zio-blocks-schema-thrift" % "0.0.31"
61
+ libraryDependencies += "dev.zio" %% "zio-blocks-schema-bson" % "0.0.31"
62
62
  ```
63
63
 
64
64
  For cross-platform projects (Scala.js):
65
65
 
66
66
  ```scala
67
- libraryDependencies += "dev.zio" %%% "zio-blocks-schema" % "0.0.29"
67
+ libraryDependencies += "dev.zio" %%% "zio-blocks-schema" % "0.0.31"
68
68
  ```
69
69
 
70
70
  Supported Scala versions: 2.13.x and 3.x.
@@ -76,7 +76,7 @@ The codec system in ZIO Blocks is organized as a layered hierarchy:
76
76
  ```
77
77
  Codec[DecodeInput, EncodeOutput, Value]
78
78
  ├── BinaryCodec[A] = Codec[ByteBuffer, ByteBuffer, A] (ByteBuffer ↔ A)
79
- │ ├── JsonBinaryCodec[A]
79
+ │ ├── JsonCodec[A]
80
80
  │ ├── AvroBinaryCodec[A]
81
81
  │ ├── ToonBinaryCodec[A]
82
82
  │ ├── ThriftBinaryCodec[A]
@@ -116,7 +116,7 @@ object Person {
116
116
  }
117
117
 
118
118
  // Pass a Format object to get a codec for that format
119
- val jsonCodec: JsonBinaryCodec[Person] = Schema[Person].derive(JsonFormat)
119
+ val jsonCodec: JsonCodec[Person] = Schema[Person].derive(JsonFormat)
120
120
  ```
121
121
 
122
122
  This works with any format:
@@ -151,12 +151,12 @@ object Person extends CompanionOptics[Person] {
151
151
  }
152
152
 
153
153
  // Override the codec for the "name" field
154
- val customNameCodec = new JsonBinaryCodec[String] {
154
+ val customNameCodec = new JsonCodec[String] {
155
155
  def decodeValue(in: JsonReader): String = in.readString()
156
156
  def encodeValue(x: String, out: JsonWriter): Unit = out.writeVal(x.toUpperCase)
157
157
  }
158
158
 
159
- val codec: JsonBinaryCodec[Person] = Schema[Person]
159
+ val codec: JsonCodec[Person] = Schema[Person]
160
160
  .deriving(JsonFormat.deriver)
161
161
  .instance(Person.name, customNameCodec)
162
162
  .derive
@@ -207,11 +207,11 @@ Passing a `Deriver` directly is useful when working with custom or configured de
207
207
 
208
208
  ## Convenience Methods on Format-Specific Codecs
209
209
 
210
- While the base `Codec` class defines only `encode(value, output)` and `decode(input)`, format-specific subclasses like `JsonBinaryCodec` and `ToonBinaryCodec` add convenience overloads for common I/O types.
210
+ While the base `Codec` class defines only `encode(value, output)` and `decode(input)`, format-specific subclasses like `JsonCodec` and `ToonBinaryCodec` add convenience overloads for common I/O types.
211
211
 
212
- ### JsonBinaryCodec Convenience Methods
212
+ ### JsonCodec Convenience Methods
213
213
 
214
- `JsonBinaryCodec[A]` provides the following overloads beyond the base `ByteBuffer` API:
214
+ `JsonCodec[A]` provides the following overloads beyond the base `ByteBuffer` API:
215
215
 
216
216
  ```scala
217
217
  import zio.blocks.schema._
@@ -307,7 +307,7 @@ object Person {
307
307
  implicit val schema: Schema[Person] = Schema.derived
308
308
  }
309
309
 
310
- val customDeriver = JsonBinaryCodecDeriver
310
+ val customDeriver = JsonCodecDeriver
311
311
  .withFieldNameMapper(NameMapper.SnakeCase)
312
312
  .withTransientNone(true)
313
313
  .withRejectExtraFields(true)
@@ -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.29"
119
+ libraryDependencies += "dev.zio" %% "zio-blocks-context" % "0.0.31"
120
120
  ```
121
121
 
122
122
  ## Construction
@@ -525,6 +525,22 @@ cd zio-blocks
525
525
  **Context construction: creating contexts with apply, empty.add, and inspecting size/isEmpty/nonEmpty**
526
526
 
527
527
  ```scala title="schema-examples/src/main/scala/context/ContextConstructionExample.scala"
528
+ /*
529
+ * Copyright 2024-2026 John A. De Goes and the ZIO Contributors
530
+ *
531
+ * Licensed under the Apache License, Version 2.0 (the "License");
532
+ * you may not use this file except in compliance with the License.
533
+ * You may obtain a copy of the License at
534
+ *
535
+ * http://www.apache.org/licenses/LICENSE-2.0
536
+ *
537
+ * Unless required by applicable law or agreed to in writing, software
538
+ * distributed under the License is distributed on an "AS IS" BASIS,
539
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
540
+ * See the License for the specific language governing permissions and
541
+ * limitations under the License.
542
+ */
543
+
528
544
  package context
529
545
 
530
546
  import zio.blocks.context._
@@ -586,6 +602,22 @@ sbt "schema-examples/runMain context.ContextConstructionExample"
586
602
  **Context retrieval: using get, supertype lookups, and getOption for safe access**
587
603
 
588
604
  ```scala title="schema-examples/src/main/scala/context/ContextRetrievalExample.scala"
605
+ /*
606
+ * Copyright 2024-2026 John A. De Goes and the ZIO Contributors
607
+ *
608
+ * Licensed under the Apache License, Version 2.0 (the "License");
609
+ * you may not use this file except in compliance with the License.
610
+ * You may obtain a copy of the License at
611
+ *
612
+ * http://www.apache.org/licenses/LICENSE-2.0
613
+ *
614
+ * Unless required by applicable law or agreed to in writing, software
615
+ * distributed under the License is distributed on an "AS IS" BASIS,
616
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
617
+ * See the License for the specific language governing permissions and
618
+ * limitations under the License.
619
+ */
620
+
589
621
  package context
590
622
 
591
623
  import zio.blocks.context._
@@ -655,6 +687,22 @@ sbt "schema-examples/runMain context.ContextRetrievalExample"
655
687
  **Context modification: adding values, updating existing ones, merging contexts, and pruning types**
656
688
 
657
689
  ```scala title="schema-examples/src/main/scala/context/ContextModificationExample.scala"
690
+ /*
691
+ * Copyright 2024-2026 John A. De Goes and the ZIO Contributors
692
+ *
693
+ * Licensed under the Apache License, Version 2.0 (the "License");
694
+ * you may not use this file except in compliance with the License.
695
+ * You may obtain a copy of the License at
696
+ *
697
+ * http://www.apache.org/licenses/LICENSE-2.0
698
+ *
699
+ * Unless required by applicable law or agreed to in writing, software
700
+ * distributed under the License is distributed on an "AS IS" BASIS,
701
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
702
+ * See the License for the specific language governing permissions and
703
+ * limitations under the License.
704
+ */
705
+
658
706
  package context
659
707
 
660
708
  import zio.blocks.context._
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.29"
13
+ libraryDependencies += "dev.zio" %% "zio-blocks-docs" % "0.0.31"
14
14
  ```
15
15
 
16
16
  ## Core Types
@@ -82,48 +82,45 @@ dynamic
82
82
  // name = "name",
83
83
  // value = Primitive(
84
84
  // primitiveType = String(None),
85
- // typeId = Impl(
86
- // name = "String",
87
- // owner = Owner(List(Package("java"), Package("lang"))),
88
- // typeParams = List(),
89
- // typeArgs = List(),
90
- // defKind = Class(
91
- // isFinal = true,
92
- // isAbstract = false,
93
- // isCase = false,
94
- // isValue = false,
95
- // bases = List(
96
- // Ref(
97
- // Impl(
98
- // name = "CharSequence",
99
- // owner = Owner(List(Package("java"), Package("lang"))),
100
- // typeParams = List(),
101
- // typeArgs = List(),
102
- // defKind = Trait(isSealed = false, bases = List()),
103
- // selfType = None,
104
- // aliasedTo = None,
105
- // representation = None,
106
- // annotations = List()
107
- // )
108
- // ),
109
- // Ref(
110
- // Impl(
111
- // name = "Comparable",
112
- // owner = Owner(List(Package("java"), Package("lang"))),
113
- // typeParams = List(
114
- // TypeParam(
115
- // name = "T",
116
- // index = 0,
117
- // variance = Invariant,
118
- // bounds = TypeBounds(lower = None, upper = None),
119
- // kind = Type
120
- // )
121
- // ),
122
- // typeArgs = List(),
123
- // defKind = Unknown,
124
- // selfType = None,
125
- // aliasedTo = None,
126
- // representation = None,
85
+ // typeId = String,
86
+ // primitiveBinding = zio.blocks.schema.binding.NoBinding$$anon$1@53d6fe60,
87
+ // doc = Doc(blocks = IndexedSeq(), metadata = Map()),
88
+ // modifiers = List(),
89
+ // storedDefaultValue = None,
90
+ // storedExamples = List()
91
+ // ),
92
+ // doc = Doc(blocks = IndexedSeq(), metadata = Map()),
93
+ // modifiers = List()
94
+ // ),
95
+ // Term(
96
+ // name = "age",
97
+ // value = Primitive(
98
+ // primitiveType = Int(None),
99
+ // typeId = Int,
100
+ // primitiveBinding = zio.blocks.schema.binding.NoBinding$$anon$1@53d6fe60,
101
+ // doc = Doc(blocks = IndexedSeq(), metadata = Map()),
102
+ // modifiers = List(),
103
+ // storedDefaultValue = None,
104
+ // storedExamples = List()
105
+ // ),
106
+ // doc = Doc(blocks = IndexedSeq(), metadata = Map()),
107
+ // modifiers = List()
108
+ // ),
109
+ // Term(
110
+ // name = "address",
111
+ // value = Record(
112
+ // fields = Vector(
113
+ // Term(
114
+ // name = "street",
115
+ // value = Primitive(
116
+ // primitiveType = String(None),
117
+ // typeId = String,
118
+ // primitiveBinding = zio.blocks.schema.binding.NoBinding$$anon$1@53d6fe60,
119
+ // doc = Doc(blocks = IndexedSeq(), metadata = Map()),
120
+ // modifiers = List(),
121
+ // storedDefaultValue = None,
122
+ // storedExamples = List()
123
+ // ),
127
124
  // ...
128
125
  ```
129
126
 
@@ -34,10 +34,10 @@ abstract class BinaryFormat[...](...) extends Format { ... }
34
34
  abstract class TextFormat[...](...) extends Format { ... }
35
35
  ```
36
36
 
37
- For example, the `JsonFormat` is a `BinaryFormat` that represents a JSON binary format, where the input for decoding is `ByteBuffer` and the output for encoding is also `ByteBuffer`, the MIME type is `application/json`, and the deriver for generating codecs from schemas is `JsonBinaryCodecDeriver`:
37
+ For example, the `JsonFormat` is a `BinaryFormat` that represents a JSON binary format, where the input for decoding is `ByteBuffer` and the output for encoding is also `ByteBuffer`, the MIME type is `application/json`, and the deriver for generating codecs from schemas is `JsonCodecDeriver`:
38
38
 
39
39
  ```scala
40
- object JsonFormat extends BinaryFormat("application/json", JsonBinaryCodecDeriver)
40
+ object JsonFormat extends BinaryFormat("application/json", JsonCodecDeriver)
41
41
  ```
42
42
 
43
43
  ## Built-in Formats
@@ -46,7 +46,7 @@ Here's a summary of the formats currently supported by ZIO Blocks. Each format p
46
46
 
47
47
  | Format Object | Codec Type | MIME Type | Module |
48
48
  |---------------------|-----------------------------|-----------------------|---------------------------------|
49
- | `JsonFormat` | `JsonBinaryCodec[A]` | `application/json` | `zio-blocks-schema` |
49
+ | `JsonFormat` | `JsonCodec[A]` | `application/json` | `zio-blocks-schema` |
50
50
  | `ToonFormat` | `ToonBinaryCodec[A]` | `text/toon` | `zio-blocks-schema-toon` |
51
51
  | `MessagePackFormat` | `MessagePackBinaryCodec[A]` | `application/msgpack` | `zio-blocks-schema-messagepack` |
52
52
  | `AvroFormat` | `AvroBinaryCodec[A]` | `application/avro` | `zio-blocks-schema-avro` |
@@ -120,15 +120,9 @@ object Person {
120
120
  implicit val schema: Schema[Person] = Schema.derived
121
121
  }
122
122
 
123
- // Using JsonEncoder/JsonDecoder
124
- val jsonEncoder = JsonEncoder[Person]
125
- val jsonDecoder = JsonDecoder[Person]
126
-
127
123
  val person = Person("Alice", 30)
128
- val json: Json = jsonEncoder.encode(person)
129
- // {"name":"Alice","age":30}
130
-
131
- val decoded: Either[SchemaError, Person] = jsonDecoder.decode(json)
124
+ val bytes: Array[Byte] = person.toJsonBytes
125
+ val decoded: Either[SchemaError, Person] = bytes.fromJson[Person]
132
126
  ```
133
127
 
134
128
  ## Avro Format
@@ -51,9 +51,9 @@ jsonSchema.conforms(valid) // true
51
51
  jsonSchema.conforms(invalid) // false
52
52
  ```
53
53
 
54
- ### Through JsonBinaryCodec
54
+ ### Through JsonCodec
55
55
 
56
- For more control, derive through `JsonBinaryCodec`:
56
+ For more control, derive through `JsonCodec`:
57
57
 
58
58
  ```scala
59
59
  import zio.blocks.schema._
package/reference/json.md CHANGED
@@ -531,69 +531,62 @@ val normalized = json.normalize
531
531
 
532
532
  ## Encoding and Decoding
533
533
 
534
- ### Type Classes
535
-
536
- ZIO Blocks provides `JsonEncoder` and `JsonDecoder` type classes for converting between Scala types and `Json`:
534
+ ### Built-in Codecs
537
535
 
538
536
  ```scala
539
- import zio.blocks.schema.json.{Json, JsonEncoder, JsonDecoder}
537
+ import zio.blocks.schema.Schema
540
538
 
541
- // Encode Scala values to Json
542
- val intJson = JsonEncoder[Int].encode(42) // Json.Number(42)
543
- val strJson = JsonEncoder[String].encode("hello") // Json.String("hello")
539
+ // Primitives
540
+ Schema[String].jsonCodec
541
+ Schema[Int].jsonCodec
542
+ Schema[Long].jsonCodec
543
+ Schema[Double].jsonCodec
544
+ Schema[Boolean].jsonCodec
545
+ Schema[BigDecimal].jsonCodec
544
546
 
545
- // Decode Json to Scala values
546
- val intResult = JsonDecoder[Int].decode(Json.Number(42)) // Right(42)
547
- val strResult = JsonDecoder[String].decode(Json.String("hello")) // Right("hello")
547
+ // Collections
548
+ Schema[List[Int]].jsonCodec
549
+ Schema[Vector[String]].jsonCodec
550
+ Schema[Map[String, Int]].jsonCodec
551
+ Schema[Option[String]].jsonCodec
552
+
553
+ // Java time/util types
554
+ Schema[java.time.Instant].jsonCodec
555
+ Schema[java.time.LocalDate].jsonCodec
556
+ Schema[java.time.ZonedDateTime].jsonCodec
557
+ Schema[java.util.UUID].jsonCodec
548
558
  ```
549
559
 
550
- ### Built-in Encoders/Decoders
560
+ ### Encoding/Decoding of Primitives
551
561
 
552
562
  ```scala
553
- import zio.blocks.schema.json.{JsonEncoder, JsonDecoder}
554
-
555
- // Primitives
556
- JsonEncoder[String]
557
- JsonEncoder[Int]
558
- JsonEncoder[Long]
559
- JsonEncoder[Double]
560
- JsonEncoder[Boolean]
561
- JsonEncoder[BigDecimal]
563
+ import zio.blocks.schema._
562
564
 
563
- // Collections
564
- JsonEncoder[List[Int]]
565
- JsonEncoder[Vector[String]]
566
- JsonEncoder[Map[String, Int]]
567
- JsonEncoder[Option[String]]
565
+ // Encode Scala values to Json
566
+ val intJson = 42.toJson // Json.Number(42)
567
+ val strJson = "hello".toJson // Json.String("hello")
568
568
 
569
- // Java time types
570
- JsonEncoder[java.time.Instant]
571
- JsonEncoder[java.time.LocalDate]
572
- JsonEncoder[java.time.ZonedDateTime]
573
- JsonEncoder[java.util.UUID]
569
+ // Decode Json to Scala values
570
+ val intResult = intJson.as[Int] // Right(42)
571
+ val strResult = strJson.as[String] // Right("hello")
574
572
  ```
575
573
 
576
- ### Schema-Based Derivation
574
+ ### Encoding/Decoding of Case Classes
577
575
 
578
576
  For complex types, use Schema-based derivation:
579
577
 
580
578
  ```scala
581
- import zio.blocks.schema.Schema
582
- import zio.blocks.schema.json.{Json, JsonEncoder, JsonDecoder}
579
+ import zio.blocks.schema._
583
580
 
584
581
  case class Person(name: String, age: Int)
585
582
 
586
583
  object Person {
587
584
  implicit val schema: Schema[Person] = Schema.derived
588
-
589
- // Derived from schema (lower priority)
590
- implicit val encoder: JsonEncoder[Person] = JsonEncoder.fromSchema
591
- implicit val decoder: JsonDecoder[Person] = JsonDecoder.fromSchema
592
585
  }
593
586
 
594
587
  val person = Person("Alice", 30)
595
- val json = JsonEncoder[Person].encode(person)
596
- val decoded = JsonDecoder[Person].decode(json)
588
+ val json = person.toJson
589
+ val decoded = json.as[Person]
597
590
  ```
598
591
 
599
592
  ### Extension Syntax
@@ -631,14 +624,12 @@ These extension methods provide a more ergonomic API compared to explicitly crea
631
624
  ### Using the `as` Method
632
625
 
633
626
  ```scala
634
- import zio.blocks.schema.json.Json
635
- import zio.blocks.schema.json.JsonDecoder
636
- import zio.blocks.schema.{Schema, SchemaError}
627
+ import zio.blocks.schema._
628
+ import zio.blocks.schema.json._
637
629
 
638
630
  case class Person(name: String, age: Int)
639
631
  object Person {
640
632
  implicit val schema: Schema[Person] = Schema.derived
641
- implicit val decoder: JsonDecoder[Person] = JsonDecoder.fromSchema
642
633
  }
643
634
 
644
635
  val json = Json.parseUnsafe("""{"name": "Alice", "age": 30}""")
@@ -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.29"
78
+ libraryDependencies += "dev.zio" %% "zio-blocks-mediatype" % "0.0.31"
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.29"
84
+ libraryDependencies += "dev.zio" %%% "zio-blocks-mediatype" % "0.0.31"
85
85
  ```
86
86
 
87
87
  Supported Scala versions: 2.13.x and 3.x.
@@ -38,9 +38,9 @@ object User extends CompanionOptics[User] {
38
38
  .derived[User]
39
39
  .modifier(Modifier.config("db.table-name", "users"))
40
40
 
41
- implicit val jsonCodec: JsonBinaryCodec[User] =
41
+ implicit val jsonCodec: JsonCodec[User] =
42
42
  schema
43
- .deriving(JsonBinaryCodecDeriver)
43
+ .deriving(JsonCodecDeriver)
44
44
  .modifier(User.name, Modifier.rename("username"))
45
45
  .modifier(User.cache, Modifier.transient())
46
46
  .derive
@@ -86,9 +86,9 @@ object User extends CompanionOptics[User] {
86
86
  implicit val schema: Schema[User] =
87
87
  Schema.derived[User]
88
88
 
89
- implicit val jsonCodec: JsonBinaryCodec[User] =
89
+ implicit val jsonCodec: JsonCodec[User] =
90
90
  schema
91
- .derive(JsonBinaryCodecDeriver)
91
+ .derive(JsonCodecDeriver)
92
92
  }
93
93
  ```
94
94