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: add AsyncAPI definition #9

Merged
merged 7 commits into from
Jul 24, 2024

Conversation

ginnun
Copy link
Contributor

@ginnun ginnun commented Jul 22, 2024

The AsyncAPI definition file, based on the CIP details.
You can copy and paste the file content into https://studio.asyncapi.com/ for a visual rendering.

The definition uses one channel per blockchain, but this can be easily changed, and every blockchain can be combined into one channel.
For WS, one channel is one connection.

To-dos:

  • - Example for fields and messages
  • - Re-using tip message by referencing
  • - use more generic example urls
  • - required field tagging

Copy link

@iccicci iccicci left a comment

Choose a reason for hiding this comment

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

Very nice! 🚀

@ginnun ginnun marked this pull request as ready for review July 23, 2024 11:43
pattern: '^[A-Za-z0-9+/=]*$'
required:
- payment
- stake
Copy link

@iccicci iccicci Jul 23, 2024

Choose a reason for hiding this comment

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

Shouldn't stake be optional to support enterprise addresses?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@iccicci stake can be an empty array even if the field is required.
I see no problem making it optional or keeping it mandatory like this.

$ref: '#/components/schemas/pointPayload'
required:
- point
protocolParameterPayload:
Copy link
Contributor

Choose a reason for hiding this comment

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

One of the goals of this API is for it to be stable over protocol upgrades where transaction contents and protocol params can change.

This current approach establishes a strong contract with the server that's specific to a particular Cardano era. We would either need to create era types or just consider serializing the protocol parameters and pass a blob to the client, similar to how we're not concerned with transaction contents. I'm leaning towards the latter since the former does not address the goals mentioned above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't have a clear winner here. I am not so sure using a blob makes it more 'stable'.

If we use a blob, the API will remain the same over time. However, declaring the details will maintain the contract created by the API between the client and the server.

If not declared, once a new era arrives, the server and the client will try to implement something not defined in the API specs. They should go and inspect the blockchain implementation and figure out the details.

Taking long-term responsibility for maintaining the client-server contract is a strategic decision.
If it is documented well, using a blob will lower the maintenance costs and keep the development cost the same.

For me, the winner is 'a blob' by a nose.

@rhyslbw rhyslbw mentioned this pull request Jul 23, 2024
Merged
Copy link
Contributor

@rhyslbw rhyslbw left a comment

Choose a reason for hiding this comment

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

Taking inspiration from https://ogmios.dev/api/. I think we should also avoid mentioning Cardano specifically when it's not required and there's also currently no hosted instances.

url: 'https://www.apache.org/licenses/LICENSE-2.0'
defaultContentType: application/json
servers:
cardano-mainnet:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
cardano-mainnet:
127.0.0.1:{port}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since this is like a name, I changed it to local-server 8dca51e

cardano-mainnet:
host: 'localhost:8080'
protocol: wss
description: Cardano Mainnet API
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
description: Cardano Mainnet API
description: Default instance, when running a local server.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Applied 8dca51e

defaultContentType: application/json
servers:
cardano-mainnet:
host: 'localhost:8080'
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
host: 'localhost:8080'
host: '127.0.0.1:{port}'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Applied 8dca51e

description: This environment is for Cardano mainnet production
- name: 'visibility:public'
description: This resource is public to all users
cardano-preprod:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can remove this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Applied 8dca51e

@will-break-it will-break-it merged commit bc7dd94 into will-break-it:cip Jul 24, 2024
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.

4 participants