Method: GraphQL::Schema.from_definition
- Defined in:
- lib/graphql/schema.rb
.from_definition(definition_or_path, default_resolve: nil, parser: GraphQL.default_parser, using: {}) ⇒ Class
Create schema from an IDL schema or file containing an IDL definition.
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/graphql/schema.rb', line 115 def from_definition(definition_or_path, default_resolve: nil, parser: GraphQL.default_parser, using: {}) # If the file ends in `.graphql` or `.graphqls`, treat it like a filepath if definition_or_path.end_with?(".graphql") || definition_or_path.end_with?(".graphqls") GraphQL::Schema::BuildFromDefinition.from_definition_path( self, definition_or_path, default_resolve: default_resolve, parser: parser, using: using, ) else GraphQL::Schema::BuildFromDefinition.from_definition( self, definition_or_path, default_resolve: default_resolve, parser: parser, using: using, ) end end |