graphitation icon indicating copy to clipboard operation
graphitation copied to clipboard

Fix to add default value as object to argumentDefinitions

Open dragoshomner opened this issue 10 months ago • 0 comments

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 avatar Apr 09 '24 14:04 dragoshomner