Skip to content

fix: change metadata of models and fix minor things - #663

Merged
asyncapi-bot merged 5 commits into
asyncapi:next-majorfrom
magicmatatjahu:next/fix-bindings
Oct 27, 2022
Merged

asyncapi-bot merged 5 commits into
asyncapi:next-majorfrom
magicmatatjahu:next/fix-bindings

Conversation

@magicmatatjahu

@magicmatatjahu magicmatatjahu commented Oct 26, 2022 •

Copy link
Copy Markdown
Member

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
Comment thread src/old-api/schema.ts
if (typeof additionalItems === 'boolean') return additionalItems;
if (additionalItems === undefined) return true;
if (additionalItems === null) return false;
if (additionalItems === undefined || additionalItems === null) return;

Copy link
Copy Markdown
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
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Comment thread src/models/extension.ts

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

Copy link
Copy Markdown
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
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Comment thread src/utils.ts Resolved

@smoya smoya left a comment

Copy link
Copy Markdown
Member

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 <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

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
Copy Markdown
Member Author

@smoya Thanks!

@magicmatatjahu

Copy link
Copy Markdown
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
Copy Markdown
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