Socket
Socket
Sign inDemoInstall

sdl-schema-analyzer

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sdl-schema-analyzer

An analyzer to extract info about your schema


Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

An analyzer to extract info about your schema


Usage

npm install --save sdl-schema-analyzer
const SchemaAnalyzer = require('sdl-schema-analyzer')

const schema = `
  type Query {
    test1: Test1
    test2: Test2 @deprecated(reason: "Field deprecated")
    test3: Test2
  }

  type Test1 {
    field1: String
    field2: Test2 @deprecated(reason: "Use test3 root query")
  }

  type Test2 {
    field3: Int
    field4: Boolean @deprecated(reason: "Any")
  }

  enum DeprecatedEnum @deprecated(reason: "Deprecated Enum") { 
    ONE, 
    TWO
  }

  enum NotDeprecateEnum {
    THREE, 
    FOR
  }
`

// create the analyzer instance
const analyzer = new SchemaAnalyzer(schema)

// get the list of deprecated pieces in the schema 
analyzer.getDeprecations() 
/*
[
  {
    definitionType: 'FieldDefinition',
    label: 'Query.test2',
    reason: 'Field deprecated'
  },
  {
    definitionType: 'FieldDefinition',
    label: 'Test1.field2',
    reason: 'Use test3 root query'
  },
  {
    definitionType: 'FieldDefinition',
    label: 'Test2.field4',
    reason: 'Any'
  },
  {
    definitionType: 'EnumTypeDefinition',
    label: 'DeprecatedEnum',
    reason: 'Deprecated Enum'
  }
]
*/

FAQs

Package last updated on 04 Apr 2023

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