Skip to content
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

Merged

Conversation

unclecheese
Copy link

@unclecheese unclecheese commented Oct 11, 2018

Resolves #611

NB: Ignore the branch name. Was originally done against 1.2, but have rebased to 1.

@unclecheese unclecheese force-pushed the pulls/1.2/sense-and-extensibility branch from 0d25271 to df538e8 Compare October 11, 2018 02:08
@unclecheese unclecheese changed the base branch from 1.2 to 1 October 11, 2018 02:10
Copy link
Contributor

@robbieaverill robbieaverill left a 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

Copy link
Contributor

@robbieaverill robbieaverill left a 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

@robbieaverill
Copy link
Contributor

robbieaverill commented Oct 15, 2018

Also the commits could do with being squashed (during the necessary rebase), and the PR could be re-targetted at the 1.3 branch

@unclecheese unclecheese force-pushed the pulls/1.2/sense-and-extensibility branch from 1366eaf to 9e80ebe Compare October 15, 2018 20:45
@unclecheese unclecheese changed the base branch from 1 to 1.3 October 15, 2018 21:38
@unclecheese unclecheese merged commit 3e2ce31 into silverstripe:1.3 Oct 15, 2018
@unclecheese unclecheese deleted the pulls/1.2/sense-and-extensibility branch October 15, 2018 21:39
];
addFields(path = ROOT_FIELD, fields = []) {
let fieldArray = [];
path.split('/').forEach(part => {
Copy link
Member

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

Copy link
Author

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']);
Copy link
Member

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)

raissanorth pushed a commit to creative-commoners/silverstripe-admin that referenced this pull request Oct 18, 2018
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants