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

Fix to add default value as object to argumentDefinitions #413

Conversation

dragoshomner
Copy link
Contributor

@dragoshomner dragoshomner commented Apr 9, 2024

The problem is described in #401. For short, we weren't able to add a defaultValue to argumentDefinitions directive as an object. The root cause is that, when the metadata is created in extractMetadataTransform.ts, it maps each parameter (key) to the generated object from graphqlAST (value). The value is created using valueFromASTUntyped. When the value is KIND.OBJECT (like our case), it'll call keyValMap. The result is created as a pure Object (using Object.create(null)), and it doesn't have hasOwnProperty, which is needed internally by relay-compiler, as you can see in the following screenshot:

image

TODO:

  • Update tests

@dragoshomner dragoshomner marked this pull request as ready for review April 10, 2024 19:12
Copy link
Member

@alloy alloy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks 👍

@alloy alloy merged commit 08bdc6a into microsoft:main Apr 16, 2024
2 checks passed
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.

None yet

2 participants