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

Allow option to conform to Relay spec #338

Closed
goldcaddy77 opened this issue Apr 15, 2020 · 17 comments
Closed

Allow option to conform to Relay spec #338

goldcaddy77 opened this issue Apr 15, 2020 · 17 comments
Milestone

Comments

@goldcaddy77
Copy link
Owner

@goldcaddy77 goldcaddy77 added this to the V3 milestone Apr 15, 2020
@goldcaddy77
Copy link
Owner Author

@FOSSforlife Making good progress here: #340

@bedeho
Copy link

bedeho commented Sep 6, 2020

Hi, what is the status on this? Is there anything we can do to help advance this along sooner, we would love to ship with this feature as part of an upcoming release.

@goldcaddy77
Copy link
Owner Author

Hey, I put this on hold to work on various items for Warthog V3. Will dust it off right now and see if I can push it through.

@bedeho
Copy link

bedeho commented Sep 8, 2020

Would mean the world to us, thank you so much, how could we keep up with that? Please let us know if you crack open a PR or something at some point.

@goldcaddy77
Copy link
Owner Author

I worked on it a bunch tonight... Still need to wire things up in BaseService. I can probably finish it up tomorrow night.

@bedeho
Copy link

bedeho commented Sep 8, 2020

Fantastic!

@goldcaddy77
Copy link
Owner Author

Did a bunch more work last night - getting close: #408. Just need one more push.

@goldcaddy77
Copy link
Owner Author

One more push got things very close: https://github.com/goldcaddy77/warthog/pull/408/commits . You can start playing with it on branch issue-338-relay-spec if you want. I need more tests though before I want to merge it down.

@bedeho
Copy link

bedeho commented Sep 10, 2020

Great, will ask one of our guys to try using it asap and provide feedback.

@metmirr
Copy link

metmirr commented Sep 10, 2020

@goldcaddy77 I tried to play with it on that branch but I am getting errors. For example, I created a sample model named User and then I tried to run warthog codegen it failed with these errors:

src/modules/user/user.resolver.ts:26:30 - error TS2344: Type 'UserWhereInput' does not satisfy the constraint 'WhereInput'.
  Type 'UserWhereInput' is not assignable to type 'WhereExpression'.
    Index signature is missing in type 'UserWhereInput'.

26     return this.service.find<UserWhereInput>(where, orderBy, limit, offset, fields);
                                ~~~~~~~~~~~~~~
src/modules/user/user.resolver.ts:31:33 - error TS2558: Expected 0 type arguments, but got 1.

31     return this.service.findOne<UserWhereUniqueInput>(where);
                                   ~~~~~~~~~~~~~~~~~~~~
src/modules/user/user.resolver.ts:52:38 - error TS2345: Argument of type 'UserWhereUniqueInput' is not assignable to parameter of type 'WhereExpression'.
  Index signature is missing in type 'UserWhereUniqueInput'.

52     return this.service.update(data, where, userId);

Building and installing warthog:

  1. Build warthog from issue-338-relay-spec branch - yarn build
  2. Install the version from step 1 - yarn add /path/to/warthog.tgz

@goldcaddy77
Copy link
Owner Author

I'm working on this now and plan on having this merged in the next few hours.

@goldcaddy77
Copy link
Owner Author

Merged: #408

Let me know if this works. You can find usage here:

@goldcaddy77
Copy link
Owner Author

@bedeho / @metmirr let me know how this works. Currently porting it to V3 as well.

@bedeho
Copy link

bedeho commented Sep 12, 2020

Hopefully, @metmirr can get back to you by Monday ;)

@metmirr
Copy link

metmirr commented Sep 16, 2020

@goldcaddy77 by following the usage in the tests I was able to create a connection. Now my question is cli is not generating connection related ObjectType, ArgType etc. So do I need to define these types for every resolver that I have? For the Dish example you have defined DishEdge, DishConnection, ConnectionPageInputOptions, and DishConnectionWhereArgs

@goldcaddy77
Copy link
Owner Author

Hi, yes for now you do need to create those manually, but we can add an option to auto-generate them pretty easily. Feel free to take a stab. You'll just need to add the additional functions to https://github.com/goldcaddy77/warthog/blob/main/src/schema/TypeORMConverter.ts and call them in https://github.com/goldcaddy77/warthog/blob/main/src/schema/SchemaGenerator.ts

@goldcaddy77
Copy link
Owner Author

@metmirr going to track the auto-gen for Connection queries in #331, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants