Expand description
GraphQL request execution for SDL-first Rust applications.
NecrassRs separates build-time contracts from runtime execution. The
necrassrs-build crate generates resolver traits, argument types, and a
dispatcher from SDL. Applications implement resolver bodies, own their
Context type, and pass a Context value to execute for each request.
HTTP integration is provided separately by necrassrs-axum.
§Request flow
- Parse your schema with
Schema::parse_and_validate, usually once at startup. - Construct a
Requestwith a document and optional variables/operation name. - Call
executewith the schema, dispatcher, and request Context. - Serialize the returned
Responseor pass it to the HTTP adapter.
Request validation errors omit data. Resolver failures become GraphQL
execution errors with a field path and source location; nullability determines
whether other data can be returned. Return ResolverError for application
failures. Panics are not converted into GraphQL errors.
§Current scope
Generated query, mutation, and subscription contracts support built-in and custom
scalars, enum results, ordinary and OneOf input objects, nullable/list forms,
recursive input boxing, owned Object results, and abstract results. The runtime
preserves Object parents, list-item conversion errors, and nullability during
completion. Borrowed Object results remain unsupported. Schema introspection is
enabled by default; use execute_with_options to disable it independently of any UI.
Structs§
- Execution
Options - Server-controlled execution settings.
- Field
Coordinate - Original SDL coordinates of a field to resolve, independent of query aliases.
- GraphQL
Error - A serializable error, as found in a GraphQL response.
- Id
- A GraphQL ID that preserves its supplied string representation.
- Request
- An owned GraphQL document, optional operation name, and variable values.
- Resolver
Error - An application failure returned by a resolver.
- Response
- A serializable GraphQL request-error or execution response.
- Response
Stream - Ordered GraphQL response events from a subscription.
- Schema
- High-level representation of a GraphQL type system document a.k.a. schema.
- Source
Stream - A subscription source stream.
- Valid
- Wraps a
Schemaor [ExecutableDocument] to mark it as valid.
Enums§
- GraphQL
Input - The presence state of a nullable GraphQL argument or input object field.
- Resolved
Value - A resolved value tree retaining Object parents and conversion errors.
- Scalar
Literal - Executable AST for a literal GraphQL Value.
- Source
Event - One item produced by a subscription source.
- Subscription
Error - A terminal failure of a subscription response stream.
Traits§
- Dispatcher
- Connects execution to application resolvers for Context type
C. - Field
- Identifies one generated GraphQL field and its argument type.
- Resolved
Object - A resolved Object value that dispatches fields against its parent instance.
- Resolver
- Resolves a generated GraphQL field against an application-owned parent value.
- Scalar
- Converts values between GraphQL inputs, an application-owned scalar, and JSON output.
- Subscriber
- Creates a source stream for a generated subscription root field.
Functions§
- execute
- Validates and executes a request with introspection enabled.
- execute_
with_ options - Executes a request with server-owned settings.
- subscribe
- Validates a subscription request and creates its source stream.
- subscribe_
with_ options - Validates a subscription request and creates its source stream with server settings.
Type Aliases§
- JsonMap
- A JSON-compatible object/map with string keys and dynamically-typed values.
- Json
Value - A JSON-compatible dynamically-typed value.
- Scalar
Error - A custom scalar conversion failure.
- Scalar
Literal Map - GraphQL literal arguments retained for generated custom scalar conversion.