Code Monkey home page Code Monkey logo

proto-schema-parser's Introduction

ProtoBuff Data Types Schema Parser

A schema parser for Protocol Buffers data types. For ProtoBuff 2 and 3 schemas.

There is no explicit distinction between ProtoBuff 2 and 3. You dont have to expect any errors if your schemaFormat is application/vnd.google.protobuf;version=2 defined, but your schema is proto3.

Support for AsyncApi schema versions: 2

Compatible with: @asyncapi/parser 1.x (tested with: 1.18.1)

This package is browser-compatible.

Installation

npm install @asyncapi/proto-schema-parser

Usage

const parser = require('asyncapi-parser')
const protoParser = require('@asyncapi/proto-schema-parser')

const asyncapiWithProto = `
asyncapi: 2.0.0
info:
  title: Example with ProtoBuff
  version: 0.1.0
channels:
  example:
    publish:
      message:
        schemaFormat: 'application/vnd.google.protobuf;version=3'
        payload: |
            message Point {
                required int32 x = 1;
                required int32 y = 2;
                optional string label = 3;
            }

            message Line {
                required Point start = 1;
                required Point end = 2;
                optional string label = 3;
            }
`

parser.registerSchemaParser(protoParser)

await parser.parse(asyncapiWithProto)

Place your protoBuff schema as string in payload to get it parsed.

Refferences are NOT supported:

  • no support for $ref
  • no support for import, except the default google types:
    • google/protobuf/*
    • google/type/*

proto-schema-parser's People

Contributors

greenrover avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

proto-schema-parser's Issues

Consider upgrading the code to be supported by AsyncAPI Parser-JS v2

Reason/Context

Parser-JS 2.0 (released as rc at this moment) is a completely new parser, with a lot of changes. The bigger ones are:

  • Completely rewritten to TS.
  • Implements the new parser-api, in particular, the version found in this PR.
  • Uses Spectral as parser/linter with the AsyncAPI ruleset.
  • Lots of other improvements, especially around Developer Experience.

Considering that Spectral now validates the documents before parsing, we had to update the interface for Schema parsers to separate validation from parsing. This change also introduced better errors and the way we handle them. (see this issue and related).

Description

Note that Parser-JS v2 uses TypeScript so feel free to use it as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.