-
Notifications
You must be signed in to change notification settings - Fork 96
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
ENHANCEMENT: Add nested fields, args, distribute args to fields #683
ENHANCEMENT: Add nested fields, args, distribute args to fields #683
Conversation
0d25271
to
df538e8
Compare
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 have no context on this part of the code, but I've put some minor formatting comments
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've resolved my qualms, LGTM now
Also the commits could do with being squashed (during the necessary rebase), and the PR could be re-targetted at the 1.3 branch |
1366eaf
to
9e80ebe
Compare
]; | ||
addFields(path = ROOT_FIELD, fields = []) { | ||
let fieldArray = []; | ||
path.split('/').forEach(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.
Is that an invalid symbol in GraphQL field names? I mean, it'd be a pretty weird field name, but who knows :D
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.
Yeah, deliberately so, because the /
is a DSL for nested field names. Had to choose a character that was invalid.
@@ -73,6 +77,44 @@ describe('ApolloGraphqlManager', () => { | |||
expect(fields).toContain('fest'); | |||
}); | |||
|
|||
it('adds nested fields', () => { | |||
const manager = createMock(); | |||
manager.addFields('root', ['FirstName', 'Surname']); |
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.
In terms of API, it feels a bit weird to have "root" as a mandated argument. I would've done the function signature the other way around. addFields(fields, path?)
, just assume root
, and start deeper paths there (foo/bar
rather than root/foo/bar
)
…erstripe#683) * New api for adding fields, args * Linting * Build * Get tests for new args, fields manager API * Rebase against 1 * Update doc blocks and indentation * Rebase against 1.3
Resolves #611
NB: Ignore the branch name. Was originally done against 1.2, but have rebased to 1.