Submodule schemas.lua is a part of GraphQL API module that provides common API for managing internal GraphQL schemas registry. Each GraphQL schema often a large tree of objects in special format. For performance purposes each schema have a cache, but if something is added or removed to the schema cache must be invalidated and on next request to this schema cache must be rebuilt.
schemas.set_invalid(schema) - method is used to invalidate schema and also this method add the desired schema to GraphQLIDE schemas registry,
where:
schema(string) - optional, schema name, if nil - then default schema is used Default schema.
schemas.reset_invalid(schema) - method is used to reset schema invalidation,
where:
schema(string) - optional, schema name, if nil - then default schema is used Default schema.
schemas.is_invalid(schema) - method is used to check schema invalidation state,
where:
schema(string) - optional, schema name, if nil - then default schema is used Default schema.
schemas.remove_schema(schema) - method is used to remove schema from schemas registry and also this method removes the desired schema from GraphQLIDE schemas registry,
where:
schema(string) - optional, schema name, if nil - then default schema is used Default schema.
schemas.remove_all() - method is used to remove all schemas from schemas registry and also this method removes all schemas from GraphQLIDE schemas registry.
schemas.remove_all() - method is used to get list of Graphql schemas from schemas registry,
returns:
[1] (table) - array of strings with schemas names or {} if no any schemas is registered in schemas registry.
schemas.cache_set(schema, request_hash, request_ast) - method is used to put parsed and validated AST (Abstract syntax tree) of graphql request into cache,
where:
schema(string) - optional, schema name, if nil - then default schema is used Default schema;request_hash(string) - mandatory, request sha256 hash;request_ast(table|nil) - mandatory, request AST.
schemas.cache_get(schema, request_hash) - method is used to get from cache parsed and validated AST (Abstract syntax tree) of graphql request,
where:
schema(string) - optional, schema name, if nil - then default schema is used Default schema;request_hash(string) - mandatory, request sha256 hash,
returns:
request_ast(table|nil) - request AST or nil if request is not cached.