@asyncapi/parser
Advanced tools
Comparing version 1.13.0 to 1.13.1
@@ -16,2 +16,3 @@ const ParserError = require('../errors/parser-error'); | ||
/** | ||
* @param {string} [key] A key to retrieve from the JSON object. | ||
* @returns {any} | ||
@@ -18,0 +19,0 @@ */ |
{ | ||
"name": "@asyncapi/parser", | ||
"version": "1.13.0", | ||
"version": "1.13.1", | ||
"description": "JavaScript AsyncAPI parser.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -32,2 +32,3 @@ <h5 align="center"> | ||
- [Circular references](#circular-references) | ||
- [Stringify](#stringify) | ||
- [Develop](#develop) | ||
@@ -226,5 +227,11 @@ - [Contributing](#contributing) | ||
For that, the Parser supports the ability to stringify a parsed AsyncAPI document through the static `AsyncAPIDocument.stringify(...parsedDoc)` method. This method differs from the native `JSON.stringify(...json)` implementation, in that every reference that occurs (at least twice throughout the document) is converted into a [JSON Pointer](https://datatracker.ietf.org/doc/html/rfc6901) path. | ||
For that, the Parser supports the ability to stringify a parsed AsyncAPI document through the static `AsyncAPIDocument.stringify(...parsedDoc)` method. This method differs from the native `JSON.stringify(...json)` implementation, in that every reference that occurs (at least twice throughout the document) is converted into a [JSON Pointer](https://datatracker.ietf.org/doc/html/rfc6901) path with a `$ref:` prefix: | ||
```json | ||
{ | ||
"foo": "$ref:$.some.path.to.the.bar" | ||
} | ||
``` | ||
To parse a stringified document into an AsyncAPIDocument instance, you must use the static `AsyncAPIDocument.parse(...stringifiedDoc)` method. It isn't compatible with the native `JSON.parse()` method. | ||
To parse a stringified document into an AsyncAPIDocument instance, you must use the static `AsyncAPIDocument.parse(...stringifiedDoc)` method. It isn't compatible with the native `JSON.parse()` method. It replaces the given references pointed by the [JSON Pointer](https://datatracker.ietf.org/doc/html/rfc6901) path, with an `$ref:` prefix to the original objects. | ||
@@ -231,0 +238,0 @@ A few advantages of this solution: |
@@ -291,3 +291,6 @@ /** | ||
class Base { | ||
json(): any; | ||
/** | ||
* @param [key] - A key to retrieve from the JSON object. | ||
*/ | ||
json(key?: string): any; | ||
} | ||
@@ -294,0 +297,0 @@ interface ChannelParameter extends MixinDescription, MixinSpecificationExtensions { |
Sorry, the diff of this file is too big to display
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
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
1242069
51
7942
291