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

SwaggerEditor@next: use stable version of @asyncapi/[email protected] #4585

Closed
char0n opened this issue Nov 16, 2023 · 2 comments
Closed

SwaggerEditor@next: use stable version of @asyncapi/[email protected] #4585

char0n opened this issue Nov 16, 2023 · 2 comments

Comments

@char0n
Copy link
Member

char0n commented Nov 16, 2023

The goal of this issue is to use stable version of @asyncapi/[email protected]. Unfortunately this stable version started to use @asyncapi/[email protected] under the hood which now uses Spectral for validation and reference processing (let's call all these new versions AsyncAPI next gen). This introduced many issues documented below:

Issue 1

It's complicated to bundle Spectral. But, we've already did some work to be able to support it in our building infra: swagger-api/swagger-editor-cra@e7ebbca

The POC of integrating next gen AsyncAPI tooling with Spectral is here: #4446

Issue 2

Due to the fact that @asyncapi/[email protected] now uses Spectral, our bundle size have increased significantly. The parser also does the validation before parsing. We'll have to adapt to that and propagate validation errors to editor markers properly.

More info in asyncapi/parser-js#857

Issue 3

@asyncapi/[email protected] serialization and deserialization it broken when used with @asyncapi/[email protected]. This is essential for us to store parsed AsyncAPI documents in redux. It can be worked around as demonstrated in POC #4446.

More info in: asyncapi/asyncapi-react#769

Issue 4

There is a breaking change in how @asyncapi/[email protected] handles references.

In Parser v1 we use @apidevtools/json-schema-ref-parser and now I see that v2 uses @stoplight/json-ref-resolver which is marked as deprecated and points to @apidevtools/json-schema-ref-parser 😄

We do provide override for AsyncAPI definition parsing which allows to plugin custom logic of URL resolution - https://github.com/swagger-api/swagger-editor/blob/718b04d756d0becc8bada052fbdcd960b7d8d51c/src/plugins/editor-preview-asyncapi/actions.js#L56-L55. It's critical that it functions equivalently.

It seems that the goal of AsyncAPI team is to return back to @apidevtools/json-schema-ref-parser, so it doesn't make sense for us to change own custom resolution mechanism, just to change it back again when the underlying library is switched.

More info in: asyncapi/parser-js#761

Here is example how to do override for spectral ref resolver: https://github.com/backstage/backstage/pull/22160/files


For now, we'll stick with last working version of @asyncapi/[email protected] with @asyncapi/[email protected].

@char0n
Copy link
Member Author

char0n commented Nov 16, 2023

For now we, we'll stick with last working version of @asyncapi/[email protected] with @asyncapi/[email protected].

This has been addressed in #4586

char0n added a commit that referenced this issue Nov 16, 2023
With these version we're parsing and rendering
AsyncAPI definition correctly.

Refs #4585
swagger-bot pushed a commit that referenced this issue Nov 16, 2023
# [5.0.0-alpha.81](v5.0.0-alpha.80...v5.0.0-alpha.81) (2023-11-16)

### Bug Fixes

* **preview-asyncapi:** use stable versions of AsyncAPI tooling ([#4586](#4586)) ([6b1982d](6b1982d)), closes [#4585](#4585)

### Features

* **editor-preview-asyncapi:** add support for protobufs ([#4588](#4588)) ([d2ed2c6](d2ed2c6))
* show extensions for OpenAPI 2.0/3.0.x ([#4566](#4566)) ([acc495e](acc495e))
char0n added a commit to swagger-api/swagger-editor-cra that referenced this issue Mar 28, 2024
char0n added a commit to swagger-api/swagger-editor-cra that referenced this issue Mar 28, 2024
@char0n
Copy link
Member Author

char0n commented Mar 28, 2024

All issues have been addressed in #4446

Issue 1

swagger-editor-cra has been compensated to support Spectral and SwaggerEditor@5 provides instructions for webpack how to overcome Spectral bundling issues.

Issue 2

There is nothing we can do about this. As mentioned in various in AsyncAPI issues, this is the status quo that will stay with AsyncAPI tooling for some time.

Issue 3

Workaround has been utilized.

Issue 4

It's a breaking change. We'll document migration of parser option in release notes.

char0n added a commit that referenced this issue Mar 28, 2024
Latest AsyncAPI toolkit provides rendering of AsyncAPI 2.x/3.x definitions.

Refs #4585
@char0n char0n closed this as completed Mar 28, 2024
swagger-bot pushed a commit that referenced this issue Mar 29, 2024
# [5.0.0-alpha.91](v5.0.0-alpha.90...v5.0.0-alpha.91) (2024-03-29)

### Features

* update AsyncAPI toolkit to latest versions ([#4446](#4446)) ([4b90270](4b90270)), closes [#4585](#4585)

### Performance Improvements

* **language-apidom:** fix perf regression in reference validation ([#4885](#4885)) ([99af87f](99af87f))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant