ptj
protobuf-to-jsonschema
npm i protobuf-to-jsonschema
ptj

protobuf-to-jsonschema

Compiles Protobuf IDL to JSON Schema

by Devon Govett

1.0.1 (see all)License:MITTypeScript:Not Found
npm i protobuf-to-jsonschema
Readme

protobuf-jsonschema

Compiles Protocol Buffer IDL to JSON Schema definitions.

Usage

You can use protobuf-jsonschema as a command line tool, or as a function in node.

The CLI can output JSON or YAML (e.g. for Swagger). If you specify a protobuf message name along with a file, it will output just that message and all dependencies. Otherwise, it will output all messages.

$ npm install protobuf-jsonschema -g
$ protobuf-jsonschema --help

  Usage: protobuf-jsonschema [options] <file> [model]

  Options:

    -h, --help             output usage information
    -V, --version          output the version number
    -f, --format [format]  output format: json or yaml [json]

In node, protobuf-jsonschema exports a single function that returns an object with the JSON Schema model.

var compile = require('protobuf-jsonschema');

var all = compile('models.proto');
var single = compile('models.proto', 'MyModel');

License

MIT

Downloads/wk

5

GitHub Stars

100

LAST COMMIT

5yrs ago

MAINTAINERS

1

CONTRIBUTORS

2

OPEN ISSUES

6

OPEN PRs

4
VersionTagPublished
1.0.1
latest
3yrs ago
No alternatives found
No tutorials found
Add a tutorial

Rate & Review

100
No reviews found
Be the first to rate