Registry / forms / uniforms-react18-bridge-graphql

uniforms-react18-bridge-graphql

JSON →
library0.0.2jsnpmunverified

A GraphQL schema bridge for uniforms, a React library for building forms from schemas. This package allows you to generate forms automatically from a GraphQL schema. Version 0.0.2 is experimental; the stable version is part of the main uniforms package. Unlike JSON Schema bridges, this one leverages GraphQL type system. It ships TypeScript types and is part of the Vazco uniforms ecosystem. Release cadence follows the main uniforms repo.

npm install uniforms-react18-bridge-graphql
INSTALL
IMPORT
SIG · UNIFORMS-REACT18-B
U
uniforms-react18-bridge-graphql
formsjavascriptv0.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GraphQLBridge
import { GraphQLBridge } from 'uniforms-bridge-graphql';
const { GraphQLBridge } = require('uniforms-bridge-graphql');
ESM-only; CJS require is not supported in this package version.
GraphQLBridge types
import type { GraphQLBridge } from 'uniforms-bridge-graphql';
TypeScript users should use type-only import for type checking.
default import
import GraphQLBridge from 'uniforms-bridge-graphql';
Default import is also supported and equivalent to named import.

Shows how to create a GraphQLBridge from a GraphQL schema AST and use it with uniforms AutoForm.

import { GraphQLBridge } from 'uniforms-bridge-graphql'; import { buildASTSchema } from 'graphql'; const typeDefs = ` type Query { user(id: ID!): User } type User { id: ID! name: String! age: Int } `; const schema = buildASTSchema(parse(typeDefs)); const bridge = new GraphQLBridge(schema, { type: 'User', required: ['name'] }); // bridge is now usable with uniforms forms import { AutoForm } from 'uniforms-react18'; import { AutoField } from 'uniforms-react18-material'; const MyForm = () => ( <AutoForm schema={bridge} onSubmit={console.log}> <AutoField /> </AutoForm> );
Debug
Known issues
gotchaThe GraphQL schema must be built using buildASTSchema from graphql; bridge does not accept SDL string directly.
fix
Import and use buildASTSchema to convert SDL string to GraphQLSchema object before passing to bridge.
affects: >=0.0.0
gotchaThe bridge expects a 'type' option indicating the GraphQL type to use for form fields; omitting it may cause errors.
fix
Always provide the 'type' option with the name of the GraphQL type (e.g., 'User').
affects: >=0.0.0
deprecatedThis package is experimental and may be merged into the main uniforms package; breaking changes may occur.
fix
Watch the uniforms repository for updates and migration guides.
affects: 0.0.x
Errors
Common errors & fixes
Error: You must provide a valid GraphQL schema to the GraphQLBridge constructor.
Passed an SDL string instead of a GraphQLSchema object.
fix
Use buildASTSchema from the 'graphql' package to convert SDL to schema.
TypeError: Cannot read properties of undefined (reading 'fields')
Missing the 'type' option in the bridge configuration.
fix
Add { type: 'YourTypeName' } as second argument to GraphQLBridge.
Upgrade
Version history
0.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
35 hits · last 30 days
node
30
OpenAI (training)
1
Resources
uniforms-react18-bridge-graphql — npm install uniforms-react18-bridge-graphql · libregistry