Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: updated the method of importing the parser #1045

Merged
merged 12 commits into from
Aug 2, 2024
5 changes: 5 additions & 0 deletions .changeset/bubble-beach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@asyncapi/multi-parser": patch
---

Updated the method of importing the parser in the Nunjucks filter. Standardized the import of different parser functions.
1,430 changes: 567 additions & 863 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/multi-parser/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const config: Config.InitialOptions = {
'src/**'
],
moduleNameMapper: {
'^parserapiv3$': path.resolve(__dirname, '../parser')
'^@asyncapi/parser$': path.resolve(__dirname, '../parser')
}
};

Expand Down
2 changes: 1 addition & 1 deletion packages/multi-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@asyncapi/raml-dt-schema-parser": "^4.0.4",
"parserapiv1": "npm:@asyncapi/parser@^2.1.0",
"parserapiv2": "npm:@asyncapi/parser@3.0.0-next-major-spec.8",
"parserapiv3": "file:../parser"
"@asyncapi/parser": "*"
},
"devDependencies": {
"@jest/types": "^29.0.2",
Expand Down
6 changes: 3 additions & 3 deletions packages/multi-parser/src/convert.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { createAsyncAPIDocument as createAsyncAPIDocumentParserV1 } from 'parserapiv1';
import { createAsyncAPIDocument as createAsyncAPIDocumentParserV2 } from 'parserapiv2';
import { createAsyncAPIDocument as createAsyncAPIDocumentParserV3 } from 'parserapiv3/esm/index';
import { createAsyncAPIDocument as createAsyncAPIDocumentParserV3 } from '@asyncapi/parser';

import type { AsyncAPIDocumentInterface as AsyncAPIDocumentInterfaceParserV1 } from 'parserapiv1';
import type { AsyncAPIDocumentInterface as AsyncAPIDocumentInterfaceParserV2 } from 'parserapiv2';
import type { AsyncAPIDocumentInterface as AsyncAPIDocumentInterfaceParserV3 } from 'parserapiv3/esm/index';
import type { AsyncAPIDocumentInterface as AsyncAPIDocumentInterfaceParserV3 } from '@asyncapi/parser';

import type { DetailedAsyncAPI as DetailedAsyncAPIParserV1 } from 'parserapiv1/esm/types';
import type { DetailedAsyncAPI as DetailedAsyncAPIParserV2 } from 'parserapiv2/esm/types';
import type { DetailedAsyncAPI as DetailedAsyncAPIParserV3 } from 'parserapiv3/esm/types';
import type { DetailedAsyncAPI as DetailedAsyncAPIParserV3 } from '@asyncapi/parser/esm/types';

export type AsyncAPIDocument = AsyncAPIDocumentInterfaceParserV1 | AsyncAPIDocumentInterfaceParserV2 | AsyncAPIDocumentInterfaceParserV3;

Expand Down
4 changes: 2 additions & 2 deletions packages/multi-parser/src/parse.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Parser as ParserV1 } from 'parserapiv1';
import { Parser as ParserV2 } from 'parserapiv2';
import { Parser as ParserV3 } from 'parserapiv3/esm/index';
import { Parser as ParserV3 } from '@asyncapi/parser';

import { AvroSchemaParser } from '@asyncapi/avro-schema-parser';
import { OpenAPISchemaParser } from '@asyncapi/openapi-schema-parser';
Expand All @@ -9,7 +9,7 @@ import { ProtoBuffSchemaParser } from '@asyncapi/protobuf-schema-parser';

import type { ParserOptions as ParserOptionsParserV1 } from 'parserapiv1/esm/parser';
import type { ParserOptions as ParserOptionsParserV2 } from 'parserapiv2/esm/parser';
import type { ParserOptions as ParserOptionsParserV3 } from 'parserapiv3/esm/parser';
import type { ParserOptions as ParserOptionsParserV3 } from '@asyncapi/parser/esm/parser';

export type ParserOptions = ParserOptionsParserV1 | ParserOptionsParserV2 | ParserOptionsParserV3;
export type Options = {
Expand Down
2 changes: 1 addition & 1 deletion packages/multi-parser/test/convert.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import { Parser as ParserV1 } from 'parserapiv1';
import { Parser as ParserV2 } from 'parserapiv2';
import { Parser as ParserV3 } from 'parserapiv3/esm/index';
import { Parser as ParserV3 } from '@asyncapi/parser';

import { AsyncAPIDocument, ConvertDocumentParserAPIVersion } from '../src/convert';

Expand Down
2 changes: 1 addition & 1 deletion packages/multi-parser/test/parse.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import { Parser as ParserV1 } from 'parserapiv1';
import { Parser as ParserV2 } from 'parserapiv2';
import { Parser as ParserV3 } from 'parserapiv3/esm/index';
import { Parser as ParserV3 } from '@asyncapi/parser';

import { AvroSchemaParser } from '@asyncapi/avro-schema-parser';
import { OpenAPISchemaParser } from '@asyncapi/openapi-schema-parser';
Expand Down
Loading