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(server): added server.summary() and hasSummary() functions #1080

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

AlexiusTatius
Copy link

Description

  • Added summary() method to Server class to access server summary attribute
  • Added hasSummary() helper method to check summary existence
  • Updated ServerInterface with new method signatures
  • Added extra type in serverObject interface of v2 & v3
  • Added unit tests accordingly
  • Corrected the path for list:fix in package.json of multi-parser

Related issue(s)
Fixes #1076

Copy link

changeset-bot bot commented Jan 31, 2025

⚠️ No Changeset found

Latest commit: 399a6ae

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@AlexiusTatius AlexiusTatius changed the title fix #1076: Added server.summary() hasSummary() functions fix(server): Added server.summary() and hasSummary() functions Jan 31, 2025
@AlexiusTatius AlexiusTatius changed the title fix(server): Added server.summary() and hasSummary() functions fix(server): added server.summary() and hasSummary() functions Jan 31, 2025
@@ -18,7 +18,7 @@ const config: Config.InitialOptions = {

// Test spec file resolution pattern
// Matches parent folder `__tests__` and filename
// should contain `test` or `spec`.
// should contain `btest` or `spec`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// should contain `btest` or `spec`.
// should contain `test` or `spec`.

@@ -80,7 +80,7 @@
"eslint-plugin-github": "^4.3.7",
"eslint-plugin-security": "^1.5.0",
"eslint-plugin-sonarjs": "^0.15.0",
"jest": "^29.0.2",
"jest": "^29.7.0",
Copy link
Member

Choose a reason for hiding this comment

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

Please do not upgrade jest if not needed. If you want to update it, please open a separate PR.

@@ -26,7 +26,6 @@ export class Server extends CoreModel<v3.ServerObject, { id: string }> implement
id(): string {
return this._meta.id;
}

Copy link
Member

Choose a reason for hiding this comment

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

Revert this.


describe('.hasSummary()', function () {
it('should return true if summary is present', function () {
expect(docItem.hasSummary()).toEqual(true);
Copy link
Member

Choose a reason for hiding this comment

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

You should test the opposite as well.

Copy link
Author

Choose a reason for hiding this comment

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

Like for a case where the summary isn't present?

expect(docItem.hasSummary()).toEqual(true);
});
});

Copy link
Member

Choose a reason for hiding this comment

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

- summary(): Returns the server summary string or undefined
- hasSummary(): Returns boolean indicating if summary exists
- Added unit tests for the respective functions
- Tested the code by building, ensuring changes in esm, cjs
 - now it points the ./eslintrc correctly
@AlexiusTatius AlexiusTatius force-pushed the issue-1076-summary-missing branch from 56d6360 to 399a6ae Compare February 1, 2025 19:58
Copy link

sonarqubecloud bot commented Feb 1, 2025

@AlexiusTatius
Copy link
Author

@smoya I've made the changes as requested!
Could you again review the pr?

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.

[BUG] Missing server.summary() function
2 participants