-
Notifications
You must be signed in to change notification settings - Fork 4
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
The json_result documented against Sandbox Test API is wildly out-of-date #48
Comments
I agree a spec would be an improvement. What IDL should we use for this? I know that we use the Rust IDL in the spec docs for APIs but we also use protobuf elsewhere as the IDL for request/response payloads, for input validation (eg in the admin API). To kick things off, this is a draft protobuf based on a reverse-engineering of the current code:
|
Having never used Rust, I just tried to look up the Rust IDL which you refer to @paddybyers but I can't find anything obvious out there in the wild. Can you point me in the right direction? In the features spec we refer to "bespoke IDL" with no reference to Rust. I confused. Anyway... For me, the sort of questions I ask when I see an interface include:
It seems we're more focussed on the fact that these things we specify in our "IDL" are data structures, with less concern for the "interface" part of that story. IMO, nullability and mutability are very important and should be considered at inception of a design. If we care about some or all of the things I mention above in a given context then my preference would be that we find an IDL that can express that without requiring "comments as annotations". |
The first version of it was written by Toni, who based the syntax heavily on syntax Rust uses for type annotations. Since neither I now Paddy are that familiar with Rust yet, I suspect that the bits we've added may have somewhat drifted away from that. I'm not sure protobuf is a great fit for an IDL to have in documentation - it's fairly limited in what it can express (e.g. all Messages are nullable, no primitive values are), it's not very readable (eg everything's flat so hard to parse the nesting in your head), and we could only ever use it to describe data structures and not full APIs - would be nice for something that can do both. One thought: we have now started using Typescript, and typescript type specs are pretty powerful/flexible, we could start making heavier use of those, with the advantage that they can be copied & pasted between code and docs and vice versa for (some level of) compiler-checked guarantees of accuracy. (Maybe even automatically in the code->docs direction, so they never get out of date, though that would mean giving the docs repo compilation step access to the realtime repo). I think those satisfy all of @QuintinWillison's requirements ( {
id?: string;
status?: Status;
tlsOnly?: boolean;
...
} |
https://heycam.github.io/webidl/ was an attempt at modelling something sufficiently generally that you could define APIs and have multiple language bindings implied by the IDL. However, the java binding has since been deleted from the spec because, in the process of making it rich enough to describe any javascript API, they created features that were simply not possible in multiple other languages. But it would do what we need here I think. |
Urr, I think we're going about this the wrong way - this is just an API endpoint. We provide an administrative API endpoint that is used solely by the client SDKs, and it returns a body that has a well defined schema. So isn't this simply an Open API spec (like our REST API spec) and perhaps a JSON Schema for the body content. Then everyone can use this agnostic of language. WDYT? |
See #47 |
➤ Automation for Jira commented: The link to the corresponding Jira issue is https://ably.atlassian.net/browse/SDK-2790 |
See: https://docs.ably.io/client-lib-development-guide/test-api/
I've been referring to
AppSpec
in Setup.java as I'm yet to find docs (not just live code) that properly defines this response.Perhaps this API should be properly documented rather than just vaguely demonstrated by example?
┆Issue is synchronized with this Jira Task by Unito
The text was updated successfully, but these errors were encountered: