Skip to content

feat: custom scalar support#32

Merged
jneurock merged 3 commits intokloeckner-i:masterfrom
miwialex:custom-scalar-support
Nov 11, 2019
Merged

feat: custom scalar support#32
jneurock merged 3 commits intokloeckner-i:masterfrom
miwialex:custom-scalar-support

Conversation

@miwialex
Copy link
Copy Markdown
Contributor

@miwialex miwialex commented Nov 7, 2019

Currently there is no ability to add support for custom scalars for example Map. This gives the ability to add mocks for your custom scalars. an example setup would be in your options object to do the following.

options = {
  scalarMocks: {
    Map: () => {
      return { foo: 'bar' }
    }
  }
}

Then anytime a custom scalar of Map is called, it resolves using the specified resolver.

@jgwhite
Copy link
Copy Markdown
Contributor

jgwhite commented Nov 8, 2019

This was much simpler than I expected!
I guess to round this out we’ll wanna:

  1. Address failing tests
  2. Add test cases for this itself
  3. Add documentation in the README.

@jgwhite
Copy link
Copy Markdown
Contributor

jgwhite commented Nov 8, 2019

Addresses #19

Comment thread addon/mocks/create.js Outdated
@jneurock
Copy link
Copy Markdown
Contributor

jneurock commented Nov 8, 2019

Thanks for the PR!

I would like to suggest that the option name be a little more specific. I think scalarMocks would be great.

add the ability to add support for custom scalars
@miwialex miwialex force-pushed the custom-scalar-support branch from e2d72a3 to ced5cf0 Compare November 8, 2019 20:20
@miwialex
Copy link
Copy Markdown
Contributor Author

miwialex commented Nov 8, 2019

Thanks for the PR!

I would like to suggest that the option name be a little more specific. I think scalarMocks would be great.

Thanks for the feedback @jneurock ! I made the updates you requested and updated the README. I'm not sure why the build is failing though, as I didn't touch any of the dependencies.

@jneurock
Copy link
Copy Markdown
Contributor

jneurock commented Nov 8, 2019

One particular Ember Try scenario has been failing for a while. I need to update some things. Not your fault.

How do you feel about adding an acceptance test? You could extend an existing test module or add a new one. Since I haven't tested custom scalars in my own apps, it would be cool to see this in action. The unit test doesn't quite tell me if the feature works.

added a custom scalar to Person and tested querying for it in the person route
@jneurock jneurock merged commit a33c1f0 into kloeckner-i:master Nov 11, 2019
@jneurock
Copy link
Copy Markdown
Contributor

Thanks again for the PR!

@jgwhite
Copy link
Copy Markdown
Contributor

jgwhite commented Nov 11, 2019

🙌 y’all are the best 🙌

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

Successfully merging this pull request may close these issues.

3 participants