Guilotine not returning empty fields

Enonic version: 7.6.1
OS: W10

Hi,
after a request to enonic, I get response null. The request it self is correct. But as it shows in enonic api (playground) enonic does not return null (or empty) on empty non-mandatory fields (enonic does not return variable at all), which causes the problem on client. Apollo (gql) get the correct data from enonic but does not pass through since there are fields missing (fields that are, as mentioned, non mandatory). Instead it returns null.

I found similar problem here on forum (Guilotine returning optional value as null). Unfortunately I could not figure out how it fixes the problem.

While checking the version on guillotine app I decided to completely uninstall it. Surprisingly my web still fetched data from XP without any problem. Is the guillotine app necessary for headless web system? If so, is there any example on how to implement it?

Can I force through config xp to return empty arrays etc. on non-mandatory fields instead of nothing?

I am currently creating somewhat universal type with content-type based on optionSet. Which will always have some empty fields (Universal type - date or day - #6 by Brozek).

Thx,
Martin

Hi Brozek,

Lib Guillotine can be used in your app without app-guillotine. It means that a developer will be responsible for creation a schema. In this case, for instance, you can refer to this page Customizing the schema. In this example you can find that line:

var result = JSON.stringify(graphQlLib.execute(schema, body.query, body.variables));

Using JSON.stringify for graphQLLib.execute will fix the null issue in result.

For App Guillotine that issue was fixed starting from version 4.2.0.

Best regards,
Anatol

3 Likes

Thank you. Works perfectly.

1 Like