-
-
Notifications
You must be signed in to change notification settings - Fork 809
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
Schema stitching fails when type/field names collide with JS built-ins #1107
Comments
5 tasks
yaacovCR
added a commit
that referenced
this issue
Apr 3, 2020
closes #1107 and #1108 - Use Object.create(null) for maps to remove prototype, which allows use of in operator, former modelled after use in graphql-js, latter code style choice to show that object is being used as a map. - Create utility for Object.prototype.hasOwnProperty.call - Use graphql-js toObjMap, keyMap, and keyValMap helpers to streamline code.
yaacovCR
added a commit
that referenced
this issue
Apr 3, 2020
closes #1107 and #1108 - Use Object.create(null) for maps to remove prototype, which allows use of in operator, former modelled after use in graphql-js, latter code style choice to show that object is being used as a map. - Create utility for Object.prototype.hasOwnProperty.call - Use graphql-js toObjMap, keyMap, and keyValMap helpers to streamline code.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When using the field name
constructor
in my schema, graphql-tools fails to perform transformations insidedelegateToSchema
: it incorrectly thinks here that the mapping already exists, and thus throws an exception.To inline the
if
statement:In this case, since
field
is equal to"constructor"
, the objectthis.mapping[actualTypeName]
has a regular JS constructor by default, so theif
case executes even though theelse
case would be more correct.I'm about to open a PR with a possible fix, to use JS Map objects instead of plain
{}
objects. Please advise if another approach would be better!Thanks!
The text was updated successfully, but these errors were encountered: