Skip to content

Commit

Permalink
Merge pull request #314 from goshacodes/fix_readme
Browse files Browse the repository at this point in the history
fixed readme
  • Loading branch information
dos65 committed Sep 3, 2024
2 parents 7370dd6 + 545095e commit 8f2a09d
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ It's advantages:
* Configurable recursive semiauto derivation
* Discriminator support for sum types derivation


Read more about library usage bellow:
- [Scala 3](https://github.com/tethys-json/tethys?tab=readme-ov-file#scala-3)
- [Scala 2](https://github.com/tethys-json/tethys?tab=readme-ov-file#scala-2)


# Scala 3

## Quick start

```scala
Expand Down Expand Up @@ -210,9 +216,9 @@ json.jsonAs[Session] == Right(session)
session.asJson == json
```

## Sealed traits and enums
### Sealed traits and enums
To derive **JsonReader** you **must** provide a discriminator.
This can be done via **selector** annotation
This can be done via **selector** annotation.
Discriminator for **JsonWriter** is optional.

If you don't need readers/writers for subtypes, you can omit them,
Expand Down Expand Up @@ -383,15 +389,14 @@ case object Direction extends Enum[Direction]

```

## scala 2
### Migration notes

### migration notes
When migrating to **scala 3** you should use **0.28.1** version.
When migrating to **scala 3** you should use **0.29.0** version.

Scala 3 derivation API in **1.0.0** has a lot of deprecations and is not fully compatible with **0.28.1**, including:
Scala 3 derivation API in **0.29.0** has a lot of deprecations and is not fully compatible in compile time with **0.28.4**, including:

1. **WriterDescription** and **ReaderDescription** are deprecated along with **describe** macro.
You can use **WriterBuilder** and **ReaderBuilder** directly instead
Use **WriterBuilder** and **ReaderBuilder** directly instead


2. **DependentField** model for **ReaderBuilder** has changed.
Expand All @@ -407,20 +412,21 @@ Scala 3 derivation API in **1.0.0** has a lot of deprecations and is not fully c
.extract(_.i).from(_.d).and[Double]("e")((d, e) => (d + e).toInt)
```

3. **0.28.1 scala 3 enum support** will not compile to prevent runtime effects during migration
3. **0.28.4 scala 3 enum support** was changed. [See more](https://github.com/tethys-json/tethys?tab=readme-ov-file#basic-enums)


4. `updatePartial` for **WriterBuilder** is deprecated. You can use ```update``` instead
4. `updatePartial` for **WriterBuilder** is deprecated. Use ```update``` instead

5. all derivation api is moved directly into core module in **tethys** package, including
5. all derivation api were moved directly into core module in **tethys** package, including
* FieldStyle
* WriterBuilder
* ReaderBuilder

6. **auto** derivation is removed
6. **auto** derivation is deprecated. Use derives on toplevel type instead

# Scala 2

### Quick start
## Quick start
Add dependencies to your `build.sbt`

```scala
Expand Down

0 comments on commit 8f2a09d

Please sign in to comment.