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

flow-operations tries to spread inexact objects #198

Closed
Athelian opened this issue Jun 30, 2022 · 4 comments
Closed

flow-operations tries to spread inexact objects #198

Athelian opened this issue Jun 30, 2022 · 4 comments

Comments

@Athelian
Copy link
Contributor

Athelian commented Jun 30, 2022

Edit: I found the line causing this issue. I would suggest making it check the config for whether or not flowExactObject is specified and then making it an exact typename object.
I can make a PR if devs agree with this change.

Describe the bug

flow-operations makes its own $Pick util function and then tries to spread the results of it into a merged object which also includes inexact types.

Please try removing the question mark on line 9 from the FlowTry, or try making {__typename: "Reference"} exact like {|__typename: "Reference"|}:

My codebase produces this problem in large quantities.

Your Example Website or App

https://flow.org/try/#0FAFwngDgpgBAJABQJYGMDWAeA8gJyQcyQDsAuGLAIwCsoUQAaGAaSjAGczKa6A+GAXnhcAsgEMISDC3aMprHgAo0ZaQEoBfOAFEANlAC2UIiAAqkKNjyEijaTx4BuYKHMwcUAGZR3RFLEEA3gA+ogD8ZBQA9pF6okRBAL7O4NAwHjqRAO5Y0DiiIEiRRGxmqYHAMDAAdDUBMAD69SlGooZkAOQASp7eRn7tMAn0FdU1iKiY7l4+fowjwTBhZABUMIk8wEnAKEVsIDAgUHtk6Vk53vmFxaX+MAGNzUStUGQARN3TfVCvjKJkIDgAK5QBJAA

Steps to Reproduce the Bug or Issue

Generate types from an exact object with an optional property type.

Expected behavior

The typename object should be exact.

Screenshots or Videos

No response

Platform

  • OS: Linux
  • Flow: 0.181.2
  • @graphql-codegen/flow-operations version: ^2.2.13

Codegen Config File

documents: 'src/graphql/**/*.js'
generates:
  src/generated/graphql.js:
    plugins:
      - codegen-custom-plugin.js

Additional context

No response

@simkessy
Copy link

I am having the same issue. Did you manage to get a solution to this?

@Athelian
Copy link
Contributor Author

I am having the same issue. Did you manage to get a solution to this?

Sorry I didn't see your reply. I ended up making a custom codegen plugin, copy pasting source code from the flow-operations node module and adjusting the line I mentioned in this issue.

@simkessy
Copy link

simkessy commented Aug 29, 2022

Could you make a PR so they could integrate the solution?

@Athelian
Copy link
Contributor Author

Could you make a PR so they could integrate the solution?

dotansimha/graphql-code-generator#8299

@dotansimha dotansimha transferred this issue from dotansimha/graphql-code-generator Feb 5, 2023
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

2 participants