Skip to content

feat(graphql plugin): add schema introspect + entity generation from live GraphQL endpoint #262

Description

@arrrrny

Expected Behavior

zfa graphql introspect <url> should connect to a live GraphQL endpoint, run the introspection query (which already exists in lib/src/graphql/graphql_introspection_service.dart), and generate Zorphy-annotated entity files for each schema type.

Actual Behavior

The "graphql" plugin was just wired into the CLI (PR #261), but it only generates GraphQL query/mutation STRING files (e.g., "GetProduct query { ... }") — not entities. There is no "introspect" subcommand. The introspection service exists in the codebase but has no CLI exposure.

Minimal Reproduction

  1. zfa graphql introspect http://localhost:3000/shop-api — Command not found (no "introspect" subcommand)
  2. zfa graphql <EntityName> — Generates a GraphQL operation string, not an entity

Context

First real-world use of the graphql plugin: Vendure e-commerce SDK rewrite (vendure-flutter-sdk). The existing lib/src/graphql/ directory has all the infrastructure (introspection service, schema model, schema translator, entity emitter) but it is not wired into any CLI command.

Suggested Fix

Add a zfa graphql introspect <url> command that:

  1. Calls GraphQLIntrospectionService.introspect(url)
  2. Passes the result to GraphqlSchemaTranslator / GraphqlEntityEmitter
  3. Generates Zorphy entity files for each OBJECT and INPUT_OBJECT type

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions