New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

apollo-deprecated-highlight

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-deprecated-highlight

Highlight the apollo graphql deprecated fields

  • 1.1.15
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
24
increased by60%
Maintainers
1
Weekly downloads
 
Created
Source

apollo deprecated highlight

circleci codecov Known Vulnerabilities

Highlight the apollo graphql deprecated fields.

We know that even you mark a field in apollo-server as @deprecated the client-side won't be able to know it until execute introspection queries. This package is for showing the deprecations in the response so that the engineers can know which fields are deprecated when they are developing.

NOTE: This package is only for apollo 4. If you are using apollo 3 please use apollo3-deprecated-highlight

How to use

import { ApolloDeprecatedHighlight } from 'apollo-deprecated-highlight';

// add ApolloDeprecatedHighlight() as plugin
const server = new ApolloServer({
    typeDefs,
    resolvers,
    plugins: [ApolloDeprecatedHighlight()],
    ...
});

Then it will add deprecations to extensions of graphql respons. The response format will be

{
    "data": {...},
    "extensions": {
        "deprecations": [
            <deprecation1>,
            <deprecation2>,
            ...
        ]
    }
}

Example

Here is the example project

We mark title, author and make as deprecated fields in the schema

type Book {
    title: String @deprecated(reason:"title is deprecated. Dont't use it")
    author: String @deprecated(reason:"author is deprecated. Dont't use it")
}

type Car {
    make: String @deprecated(reason:"make is deprecated. Dont't use it")
    model: String
}

You will see the deprecations in the response response example

Here is the response

"data": {...}
"extensions": {
    "deprecations": [
      {
        "field": "title",
        "reason": "title is deprecated. Dont't use it"
      },
      {
        "field": "author",
        "reason": "author is deprecated. Dont't use it"
      },
      {
        "field": "make",
        "reason": "make is deprecated. Dont't use it"
      }
    ]
  }

Friendly browser warnings

It's better use this package with apollo-deprecated-highlight-client. You can get friendly browser warnings in console like this client example

Keywords

FAQs

Package last updated on 05 Jan 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