{"id":47805,"library":"graphql-annotations","title":"graphql-annotations","description":"Utility library for parsing and stripping annotated metadata from GraphQL schema descriptions (v0.0.3). Allows extracting custom annotations like @db.length or @db.unique from type/field descriptions, returning structured objects. Supports multiple namespaces and JSON-like values. Lightweight, no runtime dependencies, ships TypeScript definitions. Created by Guillaume Chau (Akryum), maintainer of vue-apollo and GraphQL tools. Suitable for code generation or ORM mapping where directives are not available.","status":"active","version":"0.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/Akryum/graphql-annotations","tags":["javascript","typescript"],"install":[{"cmd":"npm install graphql-annotations","lang":"bash","label":"npm"},{"cmd":"yarn add graphql-annotations","lang":"bash","label":"yarn"},{"cmd":"pnpm add graphql-annotations","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM and CJS both supported; no tree-shaking advantage.","wrong":"const { parseAnnotations } = require('graphql-annotations')","symbol":"parseAnnotations","correct":"import { parseAnnotations } from 'graphql-annotations'"},{"note":"Named export only; default export does not exist.","wrong":"import stripAnnotations from 'graphql-annotations'","symbol":"stripAnnotations","correct":"import { stripAnnotations } from 'graphql-annotations'"},{"note":"Only named exports available; namespace import works but not typical.","wrong":"import * as annotations from 'graphql-annotations'","symbol":"ALL","correct":"import { parseAnnotations, stripAnnotations } from 'graphql-annotations'"}],"quickstart":{"code":"import { parseAnnotations, stripAnnotations } from 'graphql-annotations';\n\nconst description = `\n  A field with annotations\n  @db.length: 200\n  @db.unique\n`;\n\nconst parsed = parseAnnotations('db', description);\nconsole.log(parsed); // { length: 200, unique: true }\n\nconst stripped = stripAnnotations('db', description);\nconsole.log(stripped); // '\\n  A field with annotations\\n'\n","lang":"typescript","description":"Demonstrates parsing and stripping @db annotations from a description string."},"warnings":[{"fix":"Ensure string values are quoted: @db.foo: 'bar' or @db.foo: \"bar\"","message":"Annotation values are interpreted via JSON.parse-like parser. Strings must be quoted with single or double quotes, numbers unquoted. Unquoted strings will fail.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"For false, do not include the annotation.","message":"Boolean annotations without value (e.g., @db.unique) are parsed as literal true. To set false you must write @db.unique: false? Not supported; omit annotation instead.","severity":"gotcha","affected_versions":">=0.0.1"},{"fix":"N/A","message":"No breaking changes have been documented; version is low and stable.","severity":"breaking","affected_versions":">=0.0.1"}],"env_vars":null,"search_vec":"'akryum':50 'allow':17 'annot':3,10,20 'apollo':55 'avail':70 'chau':49 'code':61 'creat':46 'custom':19 'db.length':22 'db.unique':24 'definit':45 'depend':42 'descript':15,27 'direct':67 'extract':18 'generat':62 'graphql':2,13,57 'graphql-annot':1 'guillaum':48 'javascript':71 'json':36 'json-lik':35 'librari':5 'lightweight':39 'like':21,37 'maintain':51 'map':65 'metadata':11 'multipl':32 'namespac':33 'object':30 'orm':64 'pars':7 'return':28 'runtim':41 'schema':14 'ship':43 'strip':9 'structur':29 'suitabl':59 'support':31 'tool':58 'type/field':26 'typescript':44,72 'util':4 'v0.0.3':16 'valu':38 'vue':54 'vue-apollo':53","created_at":"2026-06-07T16:53:23.495301+00:00","updated_at":"2026-06-07T16:53:23.495301+00:00","problems":[{"fix":"Use import { parseAnnotations } from 'graphql-annotations'","cause":"Using default import instead of named import.","error":"TypeError: parseAnnotations is not a function"},{"fix":"Quote string values: @db.foo: 'bar'","cause":"Unquoted string value in annotation (e.g., @db.foo: bar).","error":"SyntaxError: Unexpected token"},{"fix":"Run npm install graphql-annotations","cause":"Package not installed or typo.","error":"Cannot find module 'graphql-annotations'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/Akryum/graphql-annotations#readme","github":"https://github.com/Akryum/graphql-annotations","docs":null,"changelog":null,"pypi":null,"npm":"graphql-annotations","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}