-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add decorateBaseSchema function qlkube #454
Add decorateBaseSchema function qlkube #454
Conversation
Hi @ralls0. Thanks for your PR. I am @kingmakerbot.
Make sure this PR appears in the CrownLabs changelog, adding one of the following labels:
|
c1bcc85
to
ef5710c
Compare
3d17b73
to
d3235a1
Compare
qlkube/src/decorateBaseSchema.js
Outdated
const targetType = baseSchema.getQueryType().getFields()[targetQuery]; | ||
if (!targetType) return baseSchema; | ||
|
||
nameWrapper = nameWrapper ? nameWrapper : 'fieldWrapper'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would provide an error in case the nameWrapper
is not defined, as you did with targetQuery
qlkube/src/decorateBaseSchema.js
Outdated
for (e of argsNeeded) { | ||
newParent[e] = parent[e]; | ||
} | ||
return newParent !== {} ? newParent : parent; // gestire errori |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The !== {}
check will always result false, if you need this check you should use a loop with Obejct.keys. But I believe that a better approach would be to throw an error if the needed prop doesn't exist on the parent.
(also please remove the // gestire errori
part)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Being that argsNeeded is optional also newParent could be empty, isn't so?
May be Object.keys(newParent).length !==0 ? newParent : parent
a good alternative?
I could add also a default value for the optional agrs.
@ralls0 thanks for the PR! 😍 |
20c8c77
to
23f58a6
Compare
/rebase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/rebase |
fix: fix exception
23f58a6
to
5598390
Compare
/deploy-staging |
Your staging environment has been correctly deployed/updated!
|
/merge |
/merge |
Your staging environment has been correctly teared-down! |
Description
New function has been added.
decorateBaseSchema
function allow to change the dynamic schema create on the fly by qlkube. This new function uses five parameters:then a new
GraphQLSchema
object is returned.How Has This Been Tested?
Below a test query used to test the new feature: