enonic / lib-guillotine

Apache License 2.0
3 stars 0 forks source link

Guilotine returning optional value as null #65

Closed pcermak closed 3 years ago

pcermak commented 4 years ago

When we define a content type with optional variables and the variables are not used (empty) the Guillotine returns result without the variables. So the variables are not included in the result at all. See the picture attached - title, department

guillotineOutput

For our purposes it would be better if the optional variables were included in the result set any time. In case they are empty the return values will be null

sigdestad commented 4 years ago

Comment to team: I know for a fact that our developer was working on adding support for returning NULL instead of empty value, and that this was supposedly released in 4.1.2 https://market.enonic.com/vendors/enonic/guillotine-headless-lib.

Pls investigate what was changed before moving forward.

alansemenov commented 3 years ago

@anatol-sialitski the actual fix was in lib-graphql, not in guillotine

sigdestad commented 3 years ago

But why is this mentioned in the guillotine release notes then?

sigdestad commented 3 years ago

Also, I believe this was fixed in guillotine based on that another user had the same problem (missing NULL return value)? So, something must have happened to make it "disappear" again?

nerdkid93 commented 3 years ago

I ran into this issue, and I think it stems from starter-headless. It appears it's POST endpoint isn't JSON.stringify-ing the GraphQL response... replacing graphQlLib.execute(...) with JSON.stringify(graphQlLib.execute(...)) fixed my occurance of this issue. https://github.com/enonic/starter-headless/blob/master/src/main/resources/controllers/graphql.js#L164

alansemenov commented 3 years ago

@nerdkid93 Thanks, we have merged your PR in the Headless Starter repo and released a new version.