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

AsyncAPI linting support #1127

Merged
merged 40 commits into from
Sep 15, 2023
Merged

AsyncAPI linting support #1127

merged 40 commits into from
Sep 15, 2023

Conversation

RomanHotsiy
Copy link
Member

@RomanHotsiy RomanHotsiy commented Jun 9, 2023

What/Why/How?

(description edited by @lornajane as the idea takes shape!)

The goal is to add linting support for AsyncAPI files to Redocly. Initially this will be partial AsyncAPI v2.6.0 support, and feedback is very welcome.

Progress:

  • Channel bindings
  • Server bindings
  • Operation bindings
  • Message bindings
  • Configurable rules
  • Documentation

Examples of AsyncAPI files can be found in the AsyncAPI project: https://github.com/asyncapi/spec/tree/master/examples

Reference

Fixes #1126

Testing

Screenshots (optional)

Check yourself

  • Code is linted
  • Tested with redoc/reference-docs/workflows
  • All new/updated code is covered with tests

Security

  • Security impact of change has been considered
  • Code follows company security practices and guidelines

@RomanHotsiy RomanHotsiy requested a review from a team as a code owner June 9, 2023 07:07
@RomanHotsiy RomanHotsiy marked this pull request as draft June 9, 2023 07:07
@github-actions
Copy link
Contributor

github-actions bot commented Jun 9, 2023

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 75.81% 3995/5270
🟡 Branches 65.72% 2128/3238
🟡 Functions 67.92% 648/954
🟡 Lines 75.99% 3745/4928
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / asyncapi.ts
81.28% 0% 0% 81.28%
🟢
... / index.ts
100% 100% 100% 100%
🟢
... / channels-kebab-case.ts
100% 100% 100% 100%
🟢
... / no-channel-trailing-slash.ts
100% 100% 100% 100%
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢 core/src/lint.ts 88.89%
63.64% (-9.7% 🔻)
80% 88.64%
🟡
... / config.ts
70.91% 76.19%
68.97% (+3.58% 🔼)
70.67%
🟢
... / config-resolvers.ts
83.54% 73.73% 100% 84.21%
🟢 core/src/index.ts 100% 100% 7.69% 100%
🟡 core/src/bundle.ts
75.18% (-2.76% 🔻)
65.31% (-4.08% 🔻)
92.86%
75.18% (-2.76% 🔻)

Test suite run success

635 tests passing in 93 suites.

Report generated by 🧪jest coverage report action from 577890e

@github-actions
Copy link
Contributor

github-actions bot commented Jul 19, 2023

Command Mean [s] Min [s] Max [s] Relative
redocly lint packages/core/src/benchmark/benches/rebilly.yaml 1.387 ± 0.035 1.342 1.443 1.03 ± 0.04
redocly-next lint packages/core/src/benchmark/benches/rebilly.yaml 1.347 ± 0.041 1.307 1.446 1.00

@lornajane lornajane changed the title chore: progress on asyncapi AsyncAPI linting support Jul 28, 2023
@adamaltman adamaltman mentioned this pull request Aug 13, 2023
5 tasks
@changeset-bot
Copy link

changeset-bot bot commented Aug 17, 2023

🦋 Changeset detected

Latest commit: 577890e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@redocly/openapi-core Minor
@redocly/cli Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@lornajane
Copy link
Contributor

@tatomyr I think this is ready for your review. I see the build is failing, but I'm not sure if I should be pushing prettier fixes to files I didn't change ...

@TaylorKrusen if you want to have a look at the guide I wrote, it would be good to get some feedback on that.

packages/cli/src/utils.ts Outdated Show resolved Hide resolved
packages/core/src/oas-types.ts Outdated Show resolved Hide resolved
packages/core/src/oas-types.ts Outdated Show resolved Hide resolved
packages/core/src/config/config-resolvers.ts Outdated Show resolved Hide resolved
@tatomyr
Copy link
Contributor

tatomyr commented Sep 8, 2023

@lornajane no worries, we'll figure out what's wrong with the prettier later.

Copy link
Contributor

@tatomyr tatomyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lornajane I updated the tests and renamed the majorSpecVersion function into getMajorSpecVersion. Also left a few more questions and suggestions.

P.S. Please rebase this against the main branch and add a changeset.

packages/core/src/oas-types.ts Outdated Show resolved Hide resolved
packages/core/src/types/asyncapi.ts Show resolved Hide resolved
packages/core/src/types/asyncapi.ts Outdated Show resolved Hide resolved
packages/core/src/types/asyncapi.ts Outdated Show resolved Hide resolved
packages/core/src/types/asyncapi.ts Show resolved Hide resolved
packages/core/src/bundle.ts Outdated Show resolved Hide resolved
__tests__/lint/async2/redocly.yaml Outdated Show resolved Hide resolved
Copy link
Contributor

@tatomyr tatomyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm approving the MR, but as it now contains my changes too, I'd like someone else from the team to approve it as well. 🙂

@lornajane lornajane merged commit 680c431 into main Sep 15, 2023
28 checks passed
@lornajane lornajane deleted the async-api branch September 15, 2023 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plans on supporting AsyncAPI?
6 participants