-
Notifications
You must be signed in to change notification settings - Fork 166
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
@atproto/api v0.14.0 release notes #307
base: main
Are you sure you want to change the base?
Conversation
|
||
Because this release introduces other breaking changes, and because adapting our own codebase to this change showed it made more sense, we decided to adopt the latter option. | ||
|
||
In lots of cases where data needs to be discriminated, this change in the signature of the `is*` function will actually not cause any issue when upgrading the version of the SDK. This is the case for example when working with data obtained from the API. Because an API is a "contract" between a server and a client, the data returned by the server is "guaranteed" to be valid. In these cases, the `is*` utility methods provide a convenient way to discriminate between valid values. |
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.
This note that we guarantee server response shape should be more prominent imo. Do we have admonitions set up here? If nothing else, just bolded.
Devs migrating to this need to know this, otherwise they're going to think they need to use the isValid*
method variants.
// Get an embed with unknown validity somehow | ||
declare const embed: unknown | ||
|
||
// The following condition will be true if, and only if, the value matches the `Image` interface |
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.
Nit: lot of these comments throughout this doc scroll off the screen. Might be good to do a multi-line comment so that readers don't have to scroll horizontally to read the comments.
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.
This is GREAT. Thanks for writing this up!
I think we could use a lil recap at the bottom, a few things like "we hope this helps you build better codebases, we found a few small bugs ourselves while migrating" and migration tl;dr:
- Need to be absolutely sure of your data? use
isValid*
orvalidate*
utils - Using data from our app view? you can use
isValid
- Building lex objects for writing? Make sure you use
$Typed
when building those.
Re: 2, might be worth adding a small example of cases where isValid*
isn't enough, and you also need to type-cast the object for safe usage, like I did here. And reiterate that this is safe when using data from Bluesky's app view.
No description provided.