{"id":49173,"library":"resolve-protobuf-schema","title":"resolve-protobuf-schema","description":"Reads a protobuf schema from disk, parses it, and resolves all imports, producing a combined parsed schema. Current stable version is 2.1.0, with no recent updates. It is a lightweight utility for Node.js environments, offering both async and sync API. Unlike other protobuf parsers, it focuses solely on schema resolution without parsing .proto files into runtime objects. Requires protobufjs (peek-readable) for parsing. Release cadence is low; no breaking changes expected.","status":"active","version":"2.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/mafintosh/resolve-protobuf-schema","tags":["javascript"],"install":[{"cmd":"npm install resolve-protobuf-schema","lang":"bash","label":"npm"},{"cmd":"yarn add resolve-protobuf-schema","lang":"bash","label":"yarn"},{"cmd":"pnpm add resolve-protobuf-schema","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used internally to read and parse protobuf files; not directly exposed but required at runtime.","package":"peek-readable","optional":false}],"imports":[{"note":"ESM available; named export. CommonJS still works but use destructuring for consistency.","wrong":"const sync = require('resolve-protobuf-schema').sync","symbol":"sync","correct":"import { sync } from 'resolve-protobuf-schema'"},{"note":"Default export is the async resolve function. For sync, use named export.","wrong":"const resolve = require('resolve-protobuf-schema'); resolve() is fine but default import is ESM style.","symbol":"resolve (default)","correct":"import resolve from 'resolve-protobuf-schema'"},{"note":"Type definitions are not bundled; use @types or define manually.","wrong":null,"symbol":"TypeScript type definitions","correct":"import type { SyncResult } from 'resolve-protobuf-schema'"}],"quickstart":{"code":"import { sync } from 'resolve-protobuf-schema';\nconst schema = sync('path/to/schema.proto');\nconsole.log(JSON.stringify(schema, null, 2));","lang":"typescript","description":"Demonstrates synchronous resolution of a .proto file, returning a parsed schema object with resolved imports."},"warnings":[{"fix":"Always provide absolute paths or paths relative to process.cwd().","message":"The schema file path is relative to process.cwd() by default, not the module's directory.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Ensure imported files exist relative to the importing file's location.","message":"Imports in .proto files are resolved using the same base directory as the file being resolved, not the current working directory.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Consider alternatives like protobufjs that include schema resolution.","message":"The package is not actively maintained; last version 2.1.0 was released in 2019.","severity":"deprecated","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'2.1.0':26 'api':44 'async':41 'break':74 'cadenc':70 'chang':75 'combin':19 'current':22 'disk':10 'environ':38 'expect':76 'file':58 'focus':50 'import':16 'javascript':77 'lightweight':34 'low':72 'node.js':37 'object':61 'offer':39 'pars':11,20,56,68 'parser':48 'peek':65 'peek-read':64 'produc':17 'proto':57 'protobuf':3,7,47 'protobufj':63 'read':5 'readabl':66 'recent':29 'releas':69 'requir':62 'resolut':54 'resolv':2,14 'resolve-protobuf-schema':1 'runtim':60 'schema':4,8,21,53 'sole':51 'stabl':23 'sync':43 'unlik':45 'updat':30 'util':35 'version':24 'without':55","created_at":"2026-06-07T17:00:25.737373+00:00","updated_at":"2026-06-07T17:00:25.737373+00:00","problems":[{"fix":"Use an absolute path or check the relative path from the working directory.","cause":"File path provided is incorrect or non-existent relative to process.cwd().","error":"Error: ENOENT: no such file or directory, open '...'"},{"fix":"Use `import resolve from 'resolve-protobuf-schema'` for async, or `import { sync } from '...'` for sync.","cause":"Importing incorrectly, e.g., using named import for default export.","error":"TypeError: resolve is not a function"}],"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/mafintosh/resolve-protobuf-schema","github":"https://github.com/mafintosh/resolve-protobuf-schema","docs":null,"changelog":null,"pypi":null,"npm":"resolve-protobuf-schema","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"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}}