Closed WhippetsAintDogs closed 5 years ago
Great progress - I am a tad busy with other at the moment but I should find some time towards the end of the week to have a look.
@DigitalGoldfish I've looked more in details the name clashes that we were apprehending (collection and singleton with the same name or two collections/singletons with just a difference in capitalisation) and I think that we don't have to handle them since all of them are accessible even if names are clashing. For example, if I have a collection named Mountain
(with a field named a
), a singleton named Mountain
(with a field named b
) and a singleton named mountain
(with a field named c
), this query:
{
allCockpitMountain {
edges {
node {
id
a {
value
}
b {
value
}
c {
value
}
}
}
}
}
the response would be:
{
"data": {
"allCockpitMountain": {
"edges": [
{
"node": {
"id": AN-ID,
"a": {
"value": THE-VALUE
},
"b": null,
"c": null,
}
},
{
"node": {
"id": ANOTHER-ID-DIFFERENT-THAN-THE-FIRST-ONE,
"a": null,
"b": {
"value": THE-VALUE
},
"c": null,
}
},
{
"node": {
"id": ANOTHER-UNIQUE-ID,
"a": null,
"b": null,
"c": {
"value": THE-VALUE
},
}
}
]
}
}
}
And every single one of these types (Mountain (collection)
, Mountain (singleton)
and mountain
) are accessible individually with the cockpitMountain(id/cockpitId: { eq: THE-ID-OF-THE-NODE-WE-WANT })
query. Keeping that in mind, do you still think that we should handle name clashes ?
Yes - because the above case is almost never what you want and will lead to unexpected behaviour; In case of property name clashes values might disappear due to type conflicts. Even if no properties clash it will severely hamper the autocomplete functionality in GrapiQL which we rely on extensively to create our queries.
But I think we can simplify it and don't need auto-renaming; it should be enough to
You're right, I'll do it like you suggested ☺
Any update on merging your pull request into the project? Using singletons would be an awesome feature!
@mjoellnier Sorry for the delays, last months, my priorities kinda switched over another project and I forgot to put some time in the plugin. I'll try to implement to name clash mechanism during the next weekend and merge the singletons altogether ! ☺
@WhippetsAintDogs Awesome! Thanks man :)
@mjoellnier It's released :smile: ! (v.1.1.0)
What still need to be done: