microsoft / graphitation

GraphQL tooling & runtime support needed for MS Teams and beyond
https://microsoft.github.io/graphitation/
MIT License
137 stars 30 forks source link

Fix to add default value as object to argumentDefinitions #413

Closed dragoshomner closed 2 months ago

dragoshomner commented 2 months ago

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: