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

docs: update parser-api #64

Merged
merged 3 commits into from
Jun 23, 2022
Merged

Conversation

magicmatatjahu
Copy link
Member

Description

  • add MessageTrait model
  • add MessageTraits model
  • add OperationTrait model
  • add OperationTraits model
  • update Message model
  • update Operation model
  • update Security model
  • update ChannelParameter model

Related issue(s)
Methods introduced in the asyncapi/parser-js#542 PR

docs/v1.md Outdated
- messages() : `Message[]`
- servers() : `Server[]`
- summary() : `string` | `undefined`
- tags() : `Tags`
- type() : `enum{'ClientSubscribing', 'ClientPublishing', 'ApplicationSubscribing', 'ApplicationPublishing}`
- action() : `enum{'ClientSubscribing', 'ClientPublishing', 'ApplicationSubscribing', 'ApplicationPublishing}`
Copy link
Member

Choose a reason for hiding this comment

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

We can include send and receive from asyncapi/spec#618 as it will most probably be in in 3.0.
In fact, I'm thinking if we should just remove the others, or changing the names to ClientReceive, ClientSend, etc.

Copy link
Member Author

Choose a reason for hiding this comment

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

👌🏼

Copy link
Member

@smoya smoya May 9, 2022

Choose a reason for hiding this comment

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

I think I would just leave send and receive, removing the others. WDYT @jonaslagoni @fmvilas ? 2.x. users will have to eventually migrate to 3.x if they want a 1:1 match on the action names.

Copy link
Member

Choose a reason for hiding this comment

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

Yup. I think parser DX should gracefully degrade in v2. Let's not make users choose method names depending on spec versions because they may not know in advance.

- isApplicationPublishing() : `boolean`
- isApplicationSubscribing() : `boolean`
- isClientPublishing() : `boolean`
- isClientSubscribing() : `boolean`
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't make sense to include isSend() and isReceive() ?

Copy link
Member Author

Choose a reason for hiding this comment

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

In 2.x.x these methods would then have a different meaning, so for now I prefer not to add these methods and see how 3.x.x will look like and then we will add the appropriate methods.

Copy link
Member

Choose a reason for hiding this comment

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

But here we are building an API based on intents, and those are still valid. I think we should add them and, for 2.x.x, return only the value it should be returned, without the application or client perspective.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you suggest isSubscribing, isPublishing?

Copy link
Member

Choose a reason for hiding this comment

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

No, I suggest we do, at implementation level:

2.x.x:

  • isSend() -> this.action === publish
  • isReceive() -> this.action === subscribe

3.x.x:

  • isSend() -> this.action === send
  • isReceive() -> this.action === receive

Copy link
Member Author

@magicmatatjahu magicmatatjahu May 9, 2022

Choose a reason for hiding this comment

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

@smoya Thanks, however in in the 2.x.x we should switch publish/subscribe meaning, because isSend and isReceive describes operation from application point of view, not user, so publish -> receive (user publishes something, so app receives it), but subscribe -> send (user subscribs to something, so app sends it to the user), but I could be wrong, so please correct me.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I thought about this but I thought we could just follow the perspective or point of view each spec version has:

  • 2.x.x: described from the point of view of the client
  • 3.x.x: described from the point of view of the application

However, if we start documenting each method on the Parser-API, it could be convenient to clarify what is the point of view of the API itself, which aligned with >=3.x.x, It would be the application's one.

I think I can agree we should go further and do what you suggest @magicmatatjahu, to be completely strict on meanings and explicitly consider send always means the application is sending a message, no room for interpretation 👍 .

WDYT @fmvilas @jonaslagoni ?

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.

A couple of suggestions/requests!

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! 🙌

@magicmatatjahu
Copy link
Member Author

/rtm

@asyncapi-bot asyncapi-bot merged commit 0524be9 into asyncapi:master Jun 23, 2022
@magicmatatjahu magicmatatjahu deleted the add-traits branch June 23, 2022 10:16
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants