prismicio-community / java-kit

Community maintained development kit for Prismic and the Java language
https://prismic.io
15 stars 38 forks source link

[enhancement] Support integration field (and any other unknown field) #65

Closed damienbeaufils closed 6 years ago

damienbeaufils commented 6 years ago

Hello Prismic team,

The integration field feature is actually in beta, and we want to retrieve the data fetched from the integration field through the java-kit. But it is not possible right now because the fragment returned from the api has no "type" and then won't be parsed (the parseFragment method returns null when type is unknown).

This PR adds the support of the integration field (and any other unknown field) by parsing any unknown fragment to a Raw fragment which exposes the raw json as JsonNode (with getValue method) and as String (with asText method). When parsing a document, any unknown fragment will then be parsed as a Raw fragment instead of null.

When a "type" will be added for integration field fragments, we willl be able to add a new specific fragment type in java-kit. But we will also keep the Raw fragment, which can handle any future unknown fragment.

This PR depends on #64

Thanks!