Skip to content

Commit

Permalink
Update documentation to have additional details like how to add seria…
Browse files Browse the repository at this point in the history
…lizer/deserializer.
  • Loading branch information
debu999 committed Jan 15, 2024
1 parent 384386d commit 9784e5e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/custom-json-serializers-deserializers.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ public class CustomJsonbService implements EventingService {
@Override
public Map<String, Jsonb> overrideJsonbConfig() {
JsonbConfig config = new JsonbConfig().withDateFormat("MM dd yyyy HH:mm Z", null);
JsonbConfig config = new JsonbConfig().withDateFormat("MM dd yyyy HH:mm Z", null).withDeserializers(OBJECTID_DESERIALIZER).withSerializers(
OBJECTID_SERIALIZER);
return Collections.singletonMap("MyModelClass.class.getName()", JsonbBuilder.create(config));
}
}
```

We can customize the JsonbConfig as per our need in above example we have registered additional serializer and date formatting for the class MyModelClass.

As the discovery of eventing services uses the ServiceLoader mechanism, don't forget to add a
`META-INF/services/io.smallrye.graphql.spi.EventingService` file that contains the fully qualified
name of your implementation.
Expand Down

0 comments on commit 9784e5e

Please sign in to comment.