From bed52db10c240bda19f82b7757bb7eae9204c379 Mon Sep 17 00:00:00 2001 From: Heiko Henning Date: Thu, 7 Sep 2023 11:25:49 +0000 Subject: [PATCH] feat: support for protobuf schemas --- package-lock.json | 24 ++++++++++++++++++++++++ package.json | 1 + src/global.d.ts | 1 + src/parser.ts | 2 ++ 4 files changed, 28 insertions(+) diff --git a/package-lock.json b/package-lock.json index abfb3c35345..df1583bab26 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "@asyncapi/openapi-schema-parser": "^3.0.3", "@asyncapi/optimizer": "^0.2.1", "@asyncapi/parser": "^2.1.0", + "@asyncapi/protobuf-schema-parser": "3.0.0", "@asyncapi/raml-dt-schema-parser": "^4.0.3", "@asyncapi/studio": "^0.17.3", "@oclif/core": "^1.26.2", @@ -476,6 +477,16 @@ "@types/json-schema": "^7.0.11" } }, + "node_modules/@asyncapi/protobuf-schema-parser": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@asyncapi/protobuf-schema-parser/-/protobuf-schema-parser-3.0.0.tgz", + "integrity": "sha512-kjoLrll611K+xYC/iBUlSnZsCHbrhL999ItVHZhObUOjUB991XgonqbSAaihiiDXTYgceOLhJKAN5llkV/LOOA==", + "dependencies": { + "@asyncapi/parser": "^2.1.0", + "@types/protocol-buffers-schema": "^3.4.1", + "protocol-buffers-schema": "^3.6.0" + } + }, "node_modules/@asyncapi/raml-dt-schema-parser": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/@asyncapi/raml-dt-schema-parser/-/raml-dt-schema-parser-4.0.4.tgz", @@ -5327,6 +5338,14 @@ "integrity": "sha512-ri0UmynRRvZiiUJdiz38MmIblKK+oH30MztdBVR95dv/Ubw6neWSb8u1XpRb72L4qsZOhz+L+z9JD40SJmfWow==", "dev": true }, + "node_modules/@types/protocol-buffers-schema": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/@types/protocol-buffers-schema/-/protocol-buffers-schema-3.4.1.tgz", + "integrity": "sha512-CBpqIDa1+/F3Z5EL8Uz/t+1eygIinJiMS37KP8O9TN+n38OlckYQhU+t/vYpsF7XhSDuiZS0zAJyfRrAeDKDUw==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/responselike": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", @@ -15107,6 +15126,11 @@ "node": ">= 8" } }, + "node_modules/protocol-buffers-schema": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz", + "integrity": "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw==" + }, "node_modules/proxy-agent": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-5.0.0.tgz", diff --git a/package.json b/package.json index fe8b44a468e..8fb7b35fa2f 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "@asyncapi/optimizer": "^0.2.1", "@asyncapi/parser": "^2.1.0", "@asyncapi/raml-dt-schema-parser": "^4.0.3", + "@asyncapi/protobuf-schema-parser": "3.0.0", "@asyncapi/studio": "^0.17.3", "@oclif/core": "^1.26.2", "@oclif/errors": "^1.3.6", diff --git a/src/global.d.ts b/src/global.d.ts index ac3f42f6b27..c1ce8ec908d 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -3,3 +3,4 @@ declare module '@asyncapi/specs'; declare module '@asyncapi/openapi-schema-parser'; declare module '@asyncapi/avro-schema-parser'; declare module '@asyncapi/raml-dt-schema-parser'; +declare module '@asyncapi/protobuf-schema-parser'; diff --git a/src/parser.ts b/src/parser.ts index 314ecdb06d9..0a7b3c62dee 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -3,6 +3,7 @@ import { Parser, convertToOldAPI } from '@asyncapi/parser/cjs'; import { AvroSchemaParser } from '@asyncapi/avro-schema-parser'; import { OpenAPISchemaParser } from '@asyncapi/openapi-schema-parser'; import { RamlDTSchemaParser } from '@asyncapi/raml-dt-schema-parser'; +import { ProtoBuffSchemaParser } from '@asyncapi/protobuf-schema-parser'; import { getDiagnosticSeverity } from '@stoplight/spectral-core'; import { html, json, junit, stylish, teamcity, text, pretty } from '@stoplight/spectral-cli/dist/formatters'; import { OutputFormat } from '@stoplight/spectral-cli/dist/services/config'; @@ -26,6 +27,7 @@ const parser = new Parser({ parser.registerSchemaParser(AvroSchemaParser()); parser.registerSchemaParser(OpenAPISchemaParser()); parser.registerSchemaParser(RamlDTSchemaParser()); +parser.registerSchemaParser(ProtoBuffSchemaParser()); export interface ValidationFlagsOptions { logDiagnostics?: boolean;