Skip to content

Commit

Permalink
feat: add parser API v3 support (#1066)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslagoni authored Nov 20, 2023
1 parent 23f3ce5 commit 2e36c9c
Show file tree
Hide file tree
Showing 5 changed files with 178 additions and 59 deletions.
4 changes: 2 additions & 2 deletions docs/configuration-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The `generator` property from `package.json` file must contain a JSON object tha
|Name|Type|Description|
|---|---|---|
|`renderer`| String | Its value can be either `react` or `nunjucks` (default).
|`apiVersion`| String | Determines which **major** version of the [Parser-API](https://github.com/asyncapi/parser-api) the template uses. For example, `v2` for `v2.x.x`. If not specified, the Generator assumes the template is not compatible with the Parser-API so it will use the [Parser-JS v1 API](https://github.com/asyncapi/parser-js/tree/v1.18.1#api-documentation). For templates that need to support AsyncAPI specification v3 make sure to use `v2` [Parser-API](https://github.com/asyncapi/parser-api). If the template uses a version of the Parser-API that is not supported by the Generator, the Generator will throw an error.
|`apiVersion`| String | Determines which **major** version of the [Parser-API](https://github.com/asyncapi/parser-api) the template uses. For example, `v2` for `v2.x.x`. If not specified, the Generator assumes the template is not compatible with the Parser-API so it will use the [Parser-JS v1 API](https://github.com/asyncapi/parser-js/tree/v1.18.1#api-documentation). For templates that need to support AsyncAPI specification v3 make sure to use `v3` [Parser-API](https://github.com/asyncapi/parser-api). If the template uses a version of the Parser-API that is not supported by the Generator, the Generator will throw an error.
|`supportedProtocols`| [String] | A list with all the protocols this template supports.
|`parameters`| Object[String, Object] | An object with all the parameters that can be passed when generating the template. When using the command line, it's done by indicating `--param name=value` or `-p name=value`.
|`parameters[param].description`| String | A user-friendly description about the parameter.
Expand All @@ -28,7 +28,7 @@ The `generator` property from `package.json` file must contain a JSON object tha
"generator":
{
"renderer": "react",
"apiVersion": "v2",
"apiVersion": "v3",
"supportedProtocols": ["amqp", "mqtt"],
"parameters": {
"server": {
Expand Down
3 changes: 2 additions & 1 deletion lib/templateConfigValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const ajv = new Ajv({ allErrors: true });
// See https://github.com/asyncapi/parser-api
const supportedParserAPIMajorVersions = [
'v1',
'v2'
'v2',
'v3'
];

/**
Expand Down
Loading

0 comments on commit 2e36c9c

Please sign in to comment.