Skip to content

Provide a definition API that doesn't instance_eval #454

Closed
@rmosolgo

Description

@rmosolgo

.define hijacks the lexical scope, resulting in weirdness:

  • Loss of outer self, uh, "obviously"
  • Confusing NoMethodError if you make a typo when referencing a local variable

However, it makes an API that's pretty on paper.

Could we make an equally easy API for schema definition that doesn't require the bait-and-switch of instance_eval?

One point: types.String is the same as GraphQL::STRING_TYPE. One option would be to make those constants more user-friendly and suggest people to use them instead of types. helpers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions