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

API response standardization and future proofing #221

Closed
Alrighttt opened this issue Jan 24, 2025 · 1 comment
Closed

API response standardization and future proofing #221

Alrighttt opened this issue Jan 24, 2025 · 1 comment
Labels

Comments

@Alrighttt
Copy link

Description

Enforcing a policy returning a JSON object for all API endpoints would allow for better flexibility in making changes to endpoints in the future.

For example, the response of /api/addresses/<address>/outputs/siacoin is currently JSON serialization of []types.SiacoinElement or [<utxo0>, <utxo1>, <utxo2>]. If we needed to add a field to this endpoint in the future, it would require a breaking change for all apps or clients utilizing this endpoint.

If we use a dedicated type instead:

type utxo_response struct {
    outputs []types.SiacoinElement
}

or

{"outputs": [<utxo0>, <utxo1>, <utxo2>]}

Adding additional fields will not introduce a breaking change for clients. Older clients will be served the same data while ignoring the newly added fields.

Version

No response

What operating system are you running (e.g. Ubuntu 22.04, macOS, Windows 11)?

No response

Anything else?

No response

@ChrisSchinnerl
Copy link
Member

Thank you for your message! We are considering adding a policy like that in the future when we formalize our engineering guidelines and for new endpoints. However, we don't want to break our existing API for the sake of hopefully not breaking it in the future right now.

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

No branches or pull requests

2 participants