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: change metadata of models and fix minor things #663

Merged
merged 5 commits into from
Oct 27, 2022

Conversation

magicmatatjahu
Copy link
Member

@magicmatatjahu magicmatatjahu commented Oct 26, 2022

Description

  • add input to the asyncapi metadata of models.
  • source in model metadata now points to the source of file/document, not to the input.
  • to boolean values we cannot assign things like x-parser-schema-id so I will add proper if in setExtension function.
  • catch global errors from validate and parse functions.
  • remove version() method from Extension model - we don't have clarified it in spec, so we shouldn't add that in current api.
  • revert some changes in the additionalItems and additionalProperties methods from old Schema model - we havw to consistent with old logic.
  • add unit tests.

cc @smoya

@magicmatatjahu magicmatatjahu added bug Something isn't working enhancement New feature or request labels Oct 26, 2022
@magicmatatjahu magicmatatjahu marked this pull request as ready for review October 26, 2022 11:23
if (typeof additionalItems === 'boolean') return additionalItems;
if (additionalItems === undefined) return true;
if (additionalItems === null) return false;
if (additionalItems === undefined || additionalItems === null) return;
Copy link
Member Author

Choose a reason for hiding this comment

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

We have to be consistent with implementation in v1 parser - current logic in next-major has breaking change in additionalItems and additionalProperties methods and some templates won't work.

Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -2,6 +2,5 @@ import type { BaseModel } from './base';

export interface ExtensionInterface<T = any> extends BaseModel {
id(): string;
version(): string;
Copy link
Member

Choose a reason for hiding this comment

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

Please ensure this change is proposed in asyncapi/parser-api#71

Copy link
Member Author

Choose a reason for hiding this comment

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

src/utils.ts Outdated Show resolved Hide resolved
Copy link
Member

@smoya smoya left a comment

Choose a reason for hiding this comment

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

LGTM!! Just one very minor, feel free to discard

Co-authored-by: Sergio Moya <1083296+smoya@users.noreply.github.com>
@sonarcloud
Copy link

sonarcloud bot commented Oct 27, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@magicmatatjahu
Copy link
Member Author

@smoya Thanks!

@magicmatatjahu
Copy link
Member Author

/rtm

@asyncapi-bot asyncapi-bot merged commit f96e769 into asyncapi:next-major Oct 27, 2022
@magicmatatjahu magicmatatjahu deleted the next/fix-bindings branch October 27, 2022 14:21
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 2.0.0-next-major.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request ready-to-merge released on @next-major
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants