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

@atproto/api v0.14.0 release notes #307

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

matthieusieben
Copy link
Contributor

No description provided.

@arcalinea arcalinea temporarily deployed to msi/sdk-014-release-notes - bsky-docs PR #307 January 10, 2025 14:39 — with Render Destroyed
@arcalinea arcalinea temporarily deployed to msi/sdk-014-release-notes - bsky-docs PR #307 January 10, 2025 17:14 — with Render Destroyed
@arcalinea arcalinea temporarily deployed to msi/sdk-014-release-notes - bsky-docs PR #307 January 10, 2025 17:14 — with Render Destroyed
@arcalinea arcalinea temporarily deployed to msi/sdk-014-release-notes - bsky-docs PR #307 January 10, 2025 17:14 — with Render Destroyed
@arcalinea arcalinea temporarily deployed to msi/sdk-014-release-notes - bsky-docs PR #307 January 10, 2025 17:16 — with Render Destroyed

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.
Copy link
Member

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
Copy link
Member

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.

Copy link
Member

@estrattonbailey estrattonbailey left a 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:

  1. Need to be absolutely sure of your data? use isValid* or validate* utils
  2. Using data from our app view? you can use isValid
  3. 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.

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.

3 participants