-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
feat: extend the components model with has-like functions #192
Conversation
@magicmatatjahu is this still in progress or? |
@jonaslagoni It's for the review :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@magicmatatjahu major question I have is the use of !!
in components and some testing comments 🙇 Are you sure the use of double question marks provide the expected return?
@jonaslagoni Thanks for review. I understand your point of view about returned value -> should return false if array/object is empty or true, but please check that in other models in very similar methods (like in PR), if field of given model is an empty array or object, then function returns true, like here https://github.com/asyncapi/parser-js/blob/master/lib/models/server.js#L61 only in case undefined or null function returns false. We must discuss in which way we should go with @derberg @fmvilas. Please note that changing default behavior will be breaking change :) I will add suggested tests. Thanks again! |
Good point! What do you say we keep it as is for this PR and track it in another issue since it is, as you say, a major change? |
@jonaslagoni Sure, good idea :) I want that @derberg and @fmvilas know about our problem as well. |
yeah, I think we already talked about this in the past, in some other issue or PR, so we definitely need a followup issue as we just need to discuss and plan how we change all over the place. As far as I remember I was fan of what @jonaslagoni wrote, about treating empty as false, but recently when working on template-for-generator-templates I liked a lot |
@magicmatatjahu will you or should I create the issue? Also just re-request review when you have added the corresponding tests 😄 |
@jonaslagoni I added missing tests only for checking returned empty object/array if given field doesn't exist in component or asyncapi model. Please check if everything is good :) If you want create issue, you're welcome 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a comment in regards to the titles for the tests. Not sure if its required to change that's up to you 😄 Good job 👍
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
well done lads! |
🎉 This PR is included in version 1.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
* master: (24 commits) chore: Refactored code location for iterators (asyncapi#225) chore(release): 1.3.1 (asyncapi#222) fix: apply traits to standalone messages from components section (asyncapi#214) test: improve feedback loop from browser tests (asyncapi#216) ci: fix the space-issue in bump workflow (asyncapi#218) ci: update global workflows (asyncapi#217) chore(deps): bump ini from 1.3.5 to 1.3.7 (asyncapi#215) ci: rename pr testing job name and test node 14 (asyncapi#213) ci: bump workflow to start on push instead of release (asyncapi#212) chore(release): 1.3.0 (asyncapi#211) feat: add a traverse schema function (asyncapi#198) ci: add workflow that bumps parser in other asyncapi repos (asyncapi#208) ci: fix release workflow step that is responsible for handling twitter (asyncapi#209) ci: update global workflows (asyncapi#206) ci: disable any testing on draft PR (asyncapi#204) chore(release): 1.2.0 (asyncapi#202) feat: extend the components and asyncapi model with has-like functions (asyncapi#192) chore(deps-dev): bump semantic-release from 17.0.6 to 17.2.3 (asyncapi#199) chore(release): 1.1.1 (asyncapi#197) fix: channels with name '/' fail on validation (asyncapi#196) ...
Description
As in description:
Components
model with has-like functions:Schema
model withproperty(name)
function to retrieve single property as Schema object -> idea from Add missing methods that help evaluate if given collection is empty or not #88 (comment)AsyncAPIDocument
model withhasDefaultContentType()
functiontest-lib
npm script for run only unit tests (without browser-test) - it's only for better dev-experience. Sometimes dev wants only write missing tests for models and do not want to run browser test every time -> in lib does not change anything itself.Related issue(s)
Resolves #173