Skip to content

Commit 3cdd60c

Browse files
authored
Add Data Builders to the migration guide (#6087)
1 parent 0f01aca commit 3cdd60c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/source/migration/4.0.mdx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,26 @@ The [Android Studio plugin](../testing/android-studio-plugin#migration-helpers)
547547

548548
</Note>
549549

550+
### Data builders
551+
552+
With Apollo Kotlin 4, the syntax for using data builders for fragments is the same as for operations and [doesn't need the top level `buildFoo {}` wrapper](https://github.com/apollographql/apollo-kotlin/pull/4782):
553+
554+
```kotlin
555+
// Replace
556+
val data = AnimalDetailsImpl.Data {
557+
buildCat {
558+
name = "Noushka"
559+
species = "Maine Coon"
560+
}
561+
}
562+
563+
// With
564+
val data = AnimalDetailsImpl.Data(Cat) {
565+
name = "Noushka"
566+
species = "Maine Coon"
567+
}
568+
```
569+
550570
### Test builders are removed
551571

552572
Test builders were an experimental feature that have been superseded by [data builders](../testing/data-builders), a simpler version that also plays nicer with custom scalars.

0 commit comments

Comments
 (0)