asyncapi / parser-js

AsyncAPI parser for Javascript (browser-compatible too).
Apache License 2.0
115 stars 91 forks source link

Remove spectral or fix underlying dependencies #857

Open jonaslagoni opened 11 months ago

jonaslagoni commented 11 months ago

Reason/Context

There are way too many issues with webpack and jest configuration when we upgrade libraries to use the new parser versions and for dependent libraries to do the same for it to make sense to continue using it IMO. I have spend way to many hours fixing these problems and encountering new edge cases.

What it falls back to are https://github.com/P0lip/nimma (that spectral depend on) that simply don't work out the box with our setups and require workaround in every library that integrate the parser and who ever integrate with those. It's just a continuous requirement to fix it all the time.

That is why I am suggesting that we either pool some resources together to fix the underlying library or remove spectral completely and each user can decide to use it on their own terms.

By removing Spectral we are going to miss out on some convenient validation stuff, but nothing that will mean the library cant function as needed. And the user can still decide to use it on their own term before using the parser, for example in Studio.

And for fixing the underlying library, I simply have no idea how easy it is to achieve especially considering last time nimma was updated was 2 years ago.

Thats why I am more in favor of removing the library entirely for now.

char0n commented 11 months ago

Hi @jonaslagoni,

I can concur. Took significant time to get around all the spectral issues and integrate https://github.com/asyncapi/parser-js/releases/tag/v3.0.0-next-major-spec.2 into bundles. Eventually managed to get it working but increased the bundle sizes significantly as the entire spectral toolchain now gets bundled.

I was immediately looking for a way how to remove spectral by the bundling process. I just need to parse the AsyncAPI document and pass the parsed document to the asyncapi-react renderer. I don't need any validation at all. Either the parser should parse the document and provide it or fails (with reason).

IMHO integrating the major linting library (that's difficult to bundle) into the parser without opting out from it is not the best situation.

Would it be possible to create a new entry point inside the npm package that would just do the pure parsing without spectral?

jonaslagoni commented 11 months ago

Its a great question @char0n, maybe is the short answer 😅 Problem is its currently tied to reference resolvement as well, so might need a little re-engeering, feel free to propose it 👍

But yea, definitely need to be addressed at some point...

derberg commented 10 months ago

Because of https://github.com/asyncapi/parser-js/issues/761 for me Spectral should go away. Before we had custom validation code for some extra spec stuff (that ajv could not cover) and it was working. Code was not the best but at least you could control it.

Maybe now as Stoplight is part of SmartBear the development experience with Spectral will increase @char0n 😉 😄

char0n commented 10 months ago

@derberg, well bad timing on my side ;]

But anyway I've just bump into https://github.com/asyncapi/parser-js/issues/761 as well on top of issues I've described above. We maintain custom layer on top of @apidevtools/json-schema-ref-parser which v1 of parser-js allowed to customize.

github-actions[bot] commented 6 months ago

This issue has been automatically marked as stale because it has not had recent activity :sleeping:

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience :heart:

smoya commented 5 months ago

I have faced this issue as well (nimma within the ref resolver) when trying to use our parser in a Deno env through Netlify's Edge functions.

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity :sleeping:

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience :heart:

ValeryG commented 2 days ago

ld it be possible to create a new entry point inside the npm package that would just do the pure parsing without spectral?

This will also make parser to work in cloudflare workers. it looks like today it doesn't as spectral is using ajv and ajv is using code from string via new Function and this is prohibited on coworkers. I was wondering if @char0n suggestion to bypass or op-out from spectral is doable?