Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@graphql-codegen/schema-ast

Package Overview
Dependencies
Maintainers
0
Versions
4799
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-codegen/schema-ast

GraphQL Code Generator plugin for generating a .graphql file from a given schema

  • 4.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.5M
decreased by-8.02%
Maintainers
0
Weekly downloads
 
Created

What is @graphql-codegen/schema-ast?

@graphql-codegen/schema-ast is a plugin for GraphQL Code Generator that allows you to generate a GraphQL schema in AST (Abstract Syntax Tree) format. This can be useful for various purposes such as schema analysis, transformation, and validation.

What are @graphql-codegen/schema-ast's main functionalities?

Generate GraphQL Schema AST

This feature allows you to generate the AST representation of a GraphQL schema. The code sample demonstrates how to use the @graphql-codegen/schema-ast plugin to generate the AST from a simple GraphQL schema.

const { generate } = require('@graphql-codegen/schema-ast');
const schema = `
  type Query {
    hello: String
  }
`;

const config = {
  filename: 'schema.graphql',
  schema: schema,
  plugins: [
    {
      'schema-ast': {}
    }
  ],
  pluginMap: {
    'schema-ast': require('@graphql-codegen/schema-ast')
  }
};

generate(config).then(output => {
  console.log(output);
});

Customizing Output

This feature allows you to customize the output of the generated AST. The code sample shows how to enable comment descriptions in the generated AST.

const { generate } = require('@graphql-codegen/schema-ast');
const schema = `
  type Query {
    hello: String
  }
`;

const config = {
  filename: 'schema.graphql',
  schema: schema,
  plugins: [
    {
      'schema-ast': {
        commentDescriptions: true
      }
    }
  ],
  pluginMap: {
    'schema-ast': require('@graphql-codegen/schema-ast')
  }
};

generate(config).then(output => {
  console.log(output);
});

Other packages similar to @graphql-codegen/schema-ast

FAQs

Package last updated on 30 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc