Skip to content

Add solid-urql and solidstart-urql generators#1350

Open
davedbase wants to merge 9 commits into
dotansimha:mainfrom
davedbase:main
Open

Add solid-urql and solidstart-urql generators#1350
davedbase wants to merge 9 commits into
dotansimha:mainfrom
davedbase:main

Conversation

@davedbase

@davedbase davedbase commented Jan 25, 2026

Copy link
Copy Markdown

Description

This PR adds two new GraphQL Code Generator plugins for the SolidJS ecosystem:

  1. @graphql-codegen/typescript-solid-urql - Generates typed SolidJS URQL hooks (createQuery, createMutation, createSubscription) for GraphQL operations
  2. @graphql-codegen/typescript-solidstart-urql - Generates typed SolidStart URQL query primitives and mutation actions for server-side rendering with SolidStart

These plugins follow the same patterns as the existing React and Vue URQL plugins, but are tailored for SolidJS's reactive primitives. They enable developers using SolidJS/SolidStart with URQL to get full TypeScript type safety for their GraphQL operations.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Screenshots/Sandbox (if appropriate/relevant):

Example generated code for a query:

solid-urql:

// Example of generated code
export const useCreateGetUser = (args: Omit<CreateQueryArgs<GetUserQueryVariables, GetUserQuery>, 'query'>) => {
  return createQuery<GetUserQuery, GetUserQueryVariables>({
    ...args,
    query: GetUserDocument,
  });
};

solidstart-urql:

// Example of generated code
export const queryGetUser = createQuery<GetUserQuery, GetUserQueryVariables>(
  GetUserDocument,
  'get-user'
);
// Example of use in Start
import { queryGetUsers } from '~/generated/graphql';
const users = createAsync(() => queryGetUsers());

How Has This Been Tested?

Comprehensive test suites have been added for both plugins:

  • Test that imports are generated correctly with proper package names
  • Test that query hooks/primitives are generated with required and optional variables
  • Test that mutation hooks/actions are generated correctly
  • Test that subscription hooks are generated correctly
  • Test that configuration options (withPrimitives, urqlImportFrom) work as expected
  • Test that file extension validation works (.ts/.tsx requirement)
  • Test that generated TypeScript code compiles without errors

Test Results:

  • 26 tests total (13 for each plugin)
  • All tests passing
  • 0 lint errors
  • All TypeScript types validate correctly

Test Environment:

  • OS: macOS (Darwin 25.2.0)
  • @graphql-codegen/*: Latest from monorepo
  • NodeJS: v18+ (as per project requirements)

Checklist:

  • I have followed the CONTRIBUTING doc and the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas (comprehensive JSDoc added)
  • I have made corresponding changes to the documentation (JSDoc with @name tags and @exampleMarkdown)
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules (N/A - no dependencies)

Further comments

Implementation Details:

Both plugins extend ClientSideBaseVisitor from @graphql-codegen/visitor-plugin-common, following the same architecture as other URQL plugins in the monorepo.

Key differences from React/Vue URQL plugins:

  1. solid-urql: Uses SolidJS primitives (createQuery, createMutation, createSubscription) instead of React hooks
  2. solidstart-urql: Generates query primitives with resource keys and mutation actions suitable for SolidStart's server-side rendering

Configuration Options:

Both plugins support:

  • withPrimitives (default: true) - Enable/disable hook/primitive generation
  • urqlImportFrom - Customize the URQL package import source

Documentation:

All configuration options are documented with JSDoc including @name, @description, @default, and @exampleMarkdown tags for automatic documentation generation. The plugins are ready to be added to the documentation site's plugin registry.

@changeset-bot

changeset-bot Bot commented Jan 25, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 485957c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@graphql-codegen/typescript-solid-urql Major
@graphql-codegen/typescript-solidstart-urql Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@davedbase

davedbase commented Jan 25, 2026

Copy link
Copy Markdown
Author

Note that I had a couple issues following the contributor guide. Some notes for consideration:

  1. It indicates to use Vitest however all the other packages tests are Jest. Vitest implementations wont work.
  2. I couldn't complete step 9 item 2 because there is no website folder in repo. Can you point me to the correct location to register the plugin?
  3. Couldn't complete step 10 either
  4. The contributor guide recommends marking the version number of the package to codegen's version 6.1.1. However, many other projects have their own version. Why wouldn't I use 1.0.0 as the release of these to not confuse users into thinking it's 6 major versions ahead?

Could someone provide additional guidance on how to submit to Plugins Hub and the documentation website?

@davedbase

Copy link
Copy Markdown
Author

@dotansimha would love feedback on this PR if you have a moment :)

@davedbase

Copy link
Copy Markdown
Author

@dotansimha sorry to gently nudge but if you have a moment we'd appreciate a review and release so we can make use of it in our projects :) Thanks so much for you OSS efforts.

@eddeee888

Copy link
Copy Markdown
Collaborator

Hi @davedbase , thanks for this PR!
I'll take a look soon.
Could you please rebase first?

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds two new TypeScript GraphQL Code Generator plugins targeting the SolidJS ecosystem (Solid + SolidStart) with URQL-specific generated primitives and accompanying documentation/examples/tests.

Changes:

  • Introduces @graphql-codegen/typescript-solid-urql and @graphql-codegen/typescript-solidstart-urql plugin implementations (visitors, config, validation).
  • Adds Jest test suites for both plugins plus example schemas/queries and generated example outputs.
  • Updates repo-level ESLint ignore patterns and devDependencies.

Reviewed changes

Copilot reviewed 37 out of 44 changed files in this pull request and generated 24 comments.

Show a summary per file
File Description
packages/plugins/typescript/solidstart-urql/tsconfig.json Adds per-package TS build config for the SolidStart URQL plugin.
packages/plugins/typescript/solidstart-urql/tests/solidstart-urql.spec.ts Adds Jest coverage for SolidStart URQL primitive generation and validation.
packages/plugins/typescript/solidstart-urql/src/visitor.ts Implements SolidStart URQL visitor to generate query/mutation/subscription primitives.
packages/plugins/typescript/solidstart-urql/src/index.ts Exposes plugin entrypoint + output file extension validation.
packages/plugins/typescript/solidstart-urql/src/config.ts Defines SolidStart URQL plugin config typings/JSDoc.
packages/plugins/typescript/solidstart-urql/README.md Adds end-user docs and usage examples for SolidStart URQL generation.
packages/plugins/typescript/solidstart-urql/package.json Adds package metadata and dependencies for publishing the SolidStart plugin.
packages/plugins/typescript/solidstart-urql/jest.config.js Wires SolidStart plugin tests into monorepo Jest config.
packages/plugins/typescript/solidstart-urql/example/usage-subscription-example.tsx Adds SolidStart subscription usage example consuming generated helpers.
packages/plugins/typescript/solidstart-urql/example/usage-mutation-example.tsx Adds SolidStart mutation/action usage example consuming generated helpers.
packages/plugins/typescript/solidstart-urql/example/schema.graphql Example schema for demonstrating generated outputs.
packages/plugins/typescript/solidstart-urql/example/queries.graphql Example operations used for docs/examples.
packages/plugins/typescript/solidstart-urql/example/generated/graphql.ts Example generated output committed for illustration.
packages/plugins/typescript/solidstart-urql/COMPARISON.md Compares Solid vs SolidStart plugin behavior/usage.
packages/plugins/typescript/solidstart-urql/codegen.yml Local example codegen config for generating the example output.
packages/plugins/typescript/solidstart-urql/codegen.example.yml Sample configuration for consumers.
packages/plugins/typescript/solidstart-urql/CHANGELOG.md Adds initial changelog for SolidStart plugin.
packages/plugins/typescript/solidstart-urql/.gitignore Ignores build artifacts/logs for the new package.
packages/plugins/typescript/solidstart-urql/package-lock.json Adds an npm lockfile for the package (new).
packages/plugins/typescript/solid-urql/tsconfig.json Adds per-package TS build config for the Solid URQL plugin.
packages/plugins/typescript/solid-urql/tests/solid-urql.spec.ts Adds Jest coverage for Solid URQL primitive generation and validation.
packages/plugins/typescript/solid-urql/src/visitor.ts Implements Solid URQL visitor to generate Solid primitives wrappers.
packages/plugins/typescript/solid-urql/src/index.ts Exposes plugin entrypoint + output file extension validation.
packages/plugins/typescript/solid-urql/src/config.ts Defines Solid URQL plugin config typings/JSDoc.
packages/plugins/typescript/solid-urql/README.md Adds end-user docs and usage examples for Solid URQL generation.
packages/plugins/typescript/solid-urql/package.json Adds package metadata and dependencies for publishing the Solid plugin.
packages/plugins/typescript/solid-urql/package-lock.json Adds an npm lockfile for the package (new).
packages/plugins/typescript/solid-urql/jest.config.js Wires Solid plugin tests into monorepo Jest config.
packages/plugins/typescript/solid-urql/example/test-plugin.js Adds a small runnable example script for local testing.
packages/plugins/typescript/solid-urql/example/schema.graphql Example schema for demonstrating generated outputs.
packages/plugins/typescript/solid-urql/example/queries.graphql Example operations used for docs/examples.
packages/plugins/typescript/solid-urql/example/package.json Example package manifest for running codegen.
packages/plugins/typescript/solid-urql/example/generated/graphql.ts Example generated output committed for illustration.
packages/plugins/typescript/solid-urql/example/codegen.yml Local example codegen config for generating the example output.
packages/plugins/typescript/solid-urql/COMPARISON.md Compares Solid vs SolidStart plugin behavior/usage.
packages/plugins/typescript/solid-urql/codegen.example.yml Sample configuration for consumers.
packages/plugins/typescript/solid-urql/CHANGELOG.md Adds initial changelog for Solid plugin.
packages/plugins/typescript/solid-urql/.gitignore Ignores build artifacts/logs for the new package.
package.json Adds vitest to root devDependencies.
.eslintrc.json Updates ignore patterns to include example.
.changeset/thick-bobcats-share.md Adds a changeset announcing the new Solid/SolidStart URQL plugins.
Files not reviewed (1)
  • packages/plugins/typescript/solid-urql/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/plugins/typescript/solidstart-urql/src/visitor.ts Outdated
Comment thread packages/plugins/typescript/solidstart-urql/src/visitor.ts Outdated
Comment thread packages/plugins/typescript/solid-urql/package-lock.json Outdated
Comment thread packages/plugins/typescript/solidstart-urql/package-lock.json Outdated
Comment thread packages/plugins/typescript/solid-urql/package.json
Comment thread packages/plugins/typescript/solid-urql/COMPARISON.md Outdated
Comment thread packages/plugins/typescript/solid-urql/COMPARISON.md Outdated
Comment thread packages/plugins/typescript/solid-urql/src/visitor.ts
Comment thread packages/plugins/typescript/solidstart-urql/src/visitor.ts
Comment thread .eslintrc.json Outdated
@eddeee888

Copy link
Copy Markdown
Collaborator

Sorry, I accidentally triggered Copilot request, I'll do manual reviews as well

davedbase and others added 2 commits June 13, 2026 09:07
Resolved conflicts:
- .eslintrc.json: kept local ignorePatterns additions (jest.project.js, example)
- package.json: used upstream pinned vitest 4.1.8
- yarn.lock: regenerated

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@davedbase

davedbase commented Jun 13, 2026

Copy link
Copy Markdown
Author

@eddeee888 I did my best to cover most of the relevant suggestions from Copilot. That'll reduce your manual review by quite a bit. There were lots of gaps. The tests however seem to be mostly broken but apparently it's an issue happening across all the other plugins?

I'd love to progress this getting published so let me know what I can do to support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants