@asyncapi/avro-schema-parser
Advanced tools
Comparing version 0.2.0 to 0.2.1
{ | ||
"name": "@asyncapi/avro-schema-parser", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "An AsyncAPI schema parser for Avro 1.x schemas.", | ||
@@ -9,4 +9,7 @@ "main": "index.js", | ||
"release": "semantic-release", | ||
"lint": "eslint --config .eslintrc.yaml .", | ||
"get-version": "echo $npm_package_version" | ||
"lint": "eslint --max-warnings 0 --config .eslintrc.yaml .", | ||
"get:version": "echo $npm_package_version", | ||
"get:name": "echo $npm_package_name", | ||
"generate:assets": "echo 'No additional assets need to be generated at the moment'", | ||
"bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION" | ||
}, | ||
@@ -33,8 +36,8 @@ "publishConfig": { | ||
"devDependencies": { | ||
"@asyncapi/parser": "^0.25.1", | ||
"@asyncapi/parser": "^1.5.0", | ||
"@semantic-release/commit-analyzer": "^8.0.1", | ||
"@semantic-release/github": "^7.0.4", | ||
"@semantic-release/npm": "^7.0.3", | ||
"@semantic-release/npm": "^7.1.1", | ||
"@semantic-release/release-notes-generator": "^9.0.1", | ||
"conventional-changelog-conventionalcommits": "^4.2.3", | ||
"conventional-changelog-conventionalcommits": "^4.5.0", | ||
"eslint": "^6.8.0", | ||
@@ -44,3 +47,3 @@ "eslint-plugin-jest": "^23.18.0", | ||
"jest": "^26.1.0", | ||
"semantic-release": "^17.0.4" | ||
"semantic-release": "^17.4.2" | ||
}, | ||
@@ -47,0 +50,0 @@ "release": { |
@@ -69,2 +69,27 @@ # Avro Schema Parser | ||
### Usage with local references | ||
```js | ||
const parser = require('@asyncapi/parser') | ||
const avroSchemaParser = require('@asyncapi/avro-schema-parser') | ||
parser.registerSchemaParser(avroSchemaParser) | ||
const asyncapiWithAvro = ` | ||
asyncapi: 2.0.0 | ||
info: | ||
title: Example with Avro | ||
version: 0.1.0 | ||
channels: | ||
example: | ||
publish: | ||
message: | ||
schemaFormat: 'application/vnd.apache.avro;version=1.9.0' | ||
payload: | ||
$ref: 'local/path/to/file/user' | ||
` | ||
await parser.parse(asyncapiWithAvro) | ||
``` | ||
### Usage with Confluent Schema Registry | ||
@@ -71,0 +96,0 @@ |
@@ -7,6 +7,6 @@ const fs = require('fs'); | ||
const inputWithAvro190 = fs.readFileSync(path.resolve(__dirname, './asyncapi-avro-1.9.0.yaml'), 'utf8'); | ||
const outputWithAvro190 = '{"asyncapi":"2.0.0","info":{"title":"My API","version":"1.0.0"},"channels":{"mychannel":{"publish":{"message":{"payload":{"type":"object","properties":{"name":{"type":"string","x-parser-schema-id":"<anonymous-schema-2>"},"age":{"oneOf":[{"type":"null","x-parser-schema-id":"<anonymous-schema-4>"},{"type":"integer","minimum":-2147483648,"maximum":2147483647,"x-parser-schema-id":"<anonymous-schema-5>"}],"x-parser-schema-id":"<anonymous-schema-3>"},"favoriteProgrammingLanguage":{"type":"string","enum":["JS","Java","Go","Rust","C"],"default":"JS","x-parser-schema-id":"<anonymous-schema-6>"},"address":{"type":"object","properties":{"zipcode":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"x-parser-schema-id":"<anonymous-schema-8>"}},"x-parser-schema-id":"<anonymous-schema-7>"},"someid":{"type":"string","x-parser-schema-id":"<anonymous-schema-9>"}},"x-parser-schema-id":"<anonymous-schema-1>"},"x-parser-original-schema-format":"application/vnd.apache.avro;version=1.9.0","x-parser-original-payload":{"name":"Person","type":"record","fields":[{"name":"name","type":"string"},{"name":"age","type":["null","int"],"default":null},{"name":"favoriteProgrammingLanguage","type":{"name":"ProgrammingLanguage","type":"enum","symbols":["JS","Java","Go","Rust","C"],"default":"JS"}},{"name":"address","type":{"name":"Address","type":"record","fields":[{"name":"zipcode","type":"int"}]}},{"name":"someid","type":"uuid"}]},"schemaFormat":"application/vnd.aai.asyncapi;version=2.0.0","x-parser-message-name":"<anonymous-message-1>"}}}}}'; | ||
const outputWithAvro190 = '{"asyncapi":"2.0.0","info":{"title":"My API","version":"1.0.0"},"channels":{"mychannel":{"publish":{"message":{"payload":{"type":"object","properties":{"name":{"type":"string","x-parser-schema-id":"<anonymous-schema-2>"},"age":{"oneOf":[{"type":"null","x-parser-schema-id":"<anonymous-schema-4>"},{"type":"integer","minimum":-2147483648,"maximum":2147483647,"x-parser-schema-id":"<anonymous-schema-5>"}],"x-parser-schema-id":"<anonymous-schema-3>"},"favoriteProgrammingLanguage":{"type":"string","enum":["JS","Java","Go","Rust","C"],"default":"JS","x-parser-schema-id":"<anonymous-schema-6>"},"address":{"type":"object","properties":{"zipcode":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"x-parser-schema-id":"<anonymous-schema-8>"}},"x-parser-schema-id":"<anonymous-schema-7>"},"someid":{"type":"string","x-parser-schema-id":"<anonymous-schema-9>"}},"x-parser-schema-id":"<anonymous-schema-1>"},"x-parser-original-schema-format":"application/vnd.apache.avro;version=1.9.0","x-parser-original-payload":{"name":"Person","type":"record","fields":[{"name":"name","type":"string"},{"name":"age","type":["null","int"],"default":null},{"name":"favoriteProgrammingLanguage","type":{"name":"ProgrammingLanguage","type":"enum","symbols":["JS","Java","Go","Rust","C"],"default":"JS"}},{"name":"address","type":{"name":"Address","type":"record","fields":[{"name":"zipcode","type":"int"}]}},{"name":"someid","type":"uuid"}]},"schemaFormat":"application/vnd.aai.asyncapi;version=2.0.0","x-parser-message-parsed":true,"x-parser-message-name":"<anonymous-message-1>"}}}},"x-parser-spec-parsed":true}'; | ||
const inputWithAvro182 = fs.readFileSync(path.resolve(__dirname, './asyncapi-avro-1.8.2.yaml'), 'utf8'); | ||
const outputWithAvro182 = '{"asyncapi":"2.0.0","info":{"title":"My API","version":"1.0.0"},"channels":{"mychannel":{"publish":{"message":{"payload":{"type":"object","properties":{"name":{"type":"string","x-parser-schema-id":"<anonymous-schema-2>"},"age":{"oneOf":[{"type":"null","x-parser-schema-id":"<anonymous-schema-4>"},{"type":"integer","minimum":-2147483648,"maximum":2147483647,"x-parser-schema-id":"<anonymous-schema-5>"}],"x-parser-schema-id":"<anonymous-schema-3>"},"favoriteProgrammingLanguage":{"type":"string","enum":["JS","Java","Go","Rust","C"],"x-parser-schema-id":"<anonymous-schema-6>"},"address":{"type":"object","properties":{"zipcode":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"x-parser-schema-id":"<anonymous-schema-8>"}},"x-parser-schema-id":"<anonymous-schema-7>"}},"x-parser-schema-id":"<anonymous-schema-1>"},"x-parser-original-schema-format":"application/vnd.apache.avro;version=1.8.2","x-parser-original-payload":{"name":"Person","type":"record","fields":[{"name":"name","type":"string"},{"name":"age","type":["null","int"],"default":null},{"name":"favoriteProgrammingLanguage","type":{"name":"ProgrammingLanguage","type":"enum","symbols":["JS","Java","Go","Rust","C"]}},{"name":"address","type":{"name":"Address","type":"record","fields":[{"name":"zipcode","type":"int"}]}}]},"schemaFormat":"application/vnd.aai.asyncapi;version=2.0.0","x-parser-message-name":"<anonymous-message-1>"}}}}}'; | ||
const outputWithAvro182 = '{"asyncapi":"2.0.0","info":{"title":"My API","version":"1.0.0"},"channels":{"mychannel":{"publish":{"message":{"payload":{"type":"object","properties":{"name":{"type":"string","x-parser-schema-id":"<anonymous-schema-2>"},"age":{"oneOf":[{"type":"null","x-parser-schema-id":"<anonymous-schema-4>"},{"type":"integer","minimum":-2147483648,"maximum":2147483647,"x-parser-schema-id":"<anonymous-schema-5>"}],"x-parser-schema-id":"<anonymous-schema-3>"},"favoriteProgrammingLanguage":{"type":"string","enum":["JS","Java","Go","Rust","C"],"x-parser-schema-id":"<anonymous-schema-6>"},"address":{"type":"object","properties":{"zipcode":{"type":"integer","minimum":-2147483648,"maximum":2147483647,"x-parser-schema-id":"<anonymous-schema-8>"}},"x-parser-schema-id":"<anonymous-schema-7>"}},"x-parser-schema-id":"<anonymous-schema-1>"},"x-parser-original-schema-format":"application/vnd.apache.avro;version=1.8.2","x-parser-original-payload":{"name":"Person","type":"record","fields":[{"name":"name","type":"string"},{"name":"age","type":["null","int"],"default":null},{"name":"favoriteProgrammingLanguage","type":{"name":"ProgrammingLanguage","type":"enum","symbols":["JS","Java","Go","Rust","C"]}},{"name":"address","type":{"name":"Address","type":"record","fields":[{"name":"zipcode","type":"int"}]}}]},"schemaFormat":"application/vnd.aai.asyncapi;version=2.0.0","x-parser-message-parsed":true,"x-parser-message-name":"<anonymous-message-1>"}}}},"x-parser-spec-parsed":true}'; | ||
@@ -13,0 +13,0 @@ parser.registerSchemaParser(avroSchemaParser); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
186314
28
138