Skip to content

docs: automated updates for deprecation#213

Open
jessiemongeon1 wants to merge 3 commits into
MystenLabs:mainfrom
jessiemongeon1:docs-monitor/auto-update-20260417-192023
Open

docs: automated updates for deprecation#213
jessiemongeon1 wants to merge 3 commits into
MystenLabs:mainfrom
jessiemongeon1:docs-monitor/auto-update-20260417-192023

Conversation

@jessiemongeon1

Copy link
Copy Markdown
Collaborator

Summary

Automated documentation updates triggered by recent release notes.

Changes

Triggered by MystenLabs/move-book#26226: [sui-framework] Clean up df/dof exists_ and remove_if_exists

  • 🔴 book/programmability/dynamic-object-fields.md
  • 🔴 book/programmability/dynamic-fields.md

Triggered by MystenLabs/move-book#26196: [move-stdlib] purge vector::empty and vector::singleton

  • 🟢 book/guides/code-quality-checklist.md

Review details

book/programmability/dynamic-object-fields.md

The documentation page lists exists_ as one of the available methods for dynamic object fields:

  • exists_ - checks if a dynamic object field exists

This needs to be updated to reflect the deprecation of exists_ in favor of exists, and the addition of remove_opt (and deprecation of remove_if_exists, though that wasn't listed here).

Section needing update: The bullet list under "The rest of the methods..." (before the "Additionally, there is an id method..." paragraph).

What's wrong: exists_ is now deprecated in favor of exists. The list should reference exists instead of exists_.

Suggested update: Replace exists_ with exists in the bullet list:

- `exists` - checks if a dynamic object field exists

Additionally, since remove_opt is newly added for dynamic_object_fields, it could be added to the list:

- `remove_opt` - removes a dynamic object field if it exists, returning an Option

NO major structural changes are needed, but the exists_exists rename should be reflected, and remove_opt should be mentioned as a new method.

book/programmability/dynamic-fields.md

The documentation page needs updating due to the deprecation of exists_ in favor of exists and remove_if_exists in favor of remove_opt.

What Needs Updating

1. "Usage" section — prose description

Current text:

Additionally, the exists_ method can be used to check if a field exists (for stricter checks with type, there is an exists_with_type method).

Should be updated to reference the new exists method as the preferred API, noting that exists_ is deprecated. For example:

Additionally, the exists method can be used to check if a field exists (for stricter checks with type, there is an exists_with_type method). Note: exists_ is deprecated in favor of exists.

2. "Usage" section — code example

Current code (lines in test_character_and_accessories):

assert!(df::exists_(&character.id, b"hat_key"));
assert!(df::exists_(&character.id, b"mustache_key"));
// ...
assert!(!df::exists_(&character.id, b"hat_key"));
assert!(!df::exists_(&character.id, b"mustache_key"));

Should be updated to use the new non-deprecated name:

assert!(df::exists(&character.id, b"hat_key"));
assert!(df::exists(&character.id, b"mustache_key"));
// ...
assert!(!df::exists(&character.id, b"hat_key"));
assert!(!df::exists(&character.id, b"mustache_key"));

3. Consider mentioning remove_opt

The remove_if_existsremove_opt deprecation is not currently documented anywhere on this page (the old function isn't mentioned either), but if the page aims to be comprehensive about available methods, a brief note about remove_opt (remove a field if it exists, returning an Option) in the "Usage" section prose would be appropriate. This is lower priority since remove_if_exists wasn't previously documented here, but the new remove_opt is worth a mention for completeness.

book/guides/code-quality-checklist.md

Looking at the PR change (deprecating vector::empty and vector::singleton in MoveStdlib) and the documentation page, I need to check if any existing guidance is affected.

The relevant section is "Vector Has a Literal. And Associated Functions" under "Function Body: Struct Methods":

// bad!
let mut my_vec = vector::empty();
vector::push_back(&mut my_vec, 10);
let first_el = vector::borrow(&my_vec);
assert!(vector::length(&my_vec) == 1);

// good!
let mut my_vec = vector[10];
let first_el = my_vec[0];
assert!(my_vec.length() == 1);

This section already marks vector::empty() as bad practice and recommends the vector literal syntax instead. The deprecation of vector::empty (and vector::singleton) reinforces the existing guidance.

However, the documentation could be slightly strengthened to:

  1. Explicitly mention vector::singleton as also deprecated/discouraged (it's not shown in the example at all currently).
  2. Optionally note that vector::empty() and vector::singleton() are now formally deprecated.

Recommendation: Update the "Vector Has a Literal. And Associated Functions" section to:

  • Add vector::singleton(value) to the "bad" example alongside vector::empty(), showing its replacement with vector[value].
  • Optionally add a note that vector::empty and vector::singleton are now deprecated in MoveStdlib, strengthening the case for using vector literals.

Suggested update to the bad example:

// bad! (vector::empty and vector::singleton are now deprecated)
let mut my_vec = vector::empty();
vector::push_back(&mut my_vec, 10);
let singleton = vector::singleton(10); // also deprecated

This is a minor but relevant update — the deprecation directly validates and strengthens the existing "bad" guidance, and adding vector::singleton to the example closes a gap in coverage.


This PR was automatically generated by the Docs Impact Monitor. Please review the changes carefully before merging.

Each file edit was generated by Claude based on the release notes and a review of the existing documentation content.

Automated update based on: Deprecated sui::dynamic_field::exists_ in favor of sui::dynamic_field::exists, deprecated sui::dynamic_field::remove_if_exists in favor of sui::dynamic_field::remove_opt, deprecated sui::dynamic_object_field::exists_ in favor of sui::dynamic_object_field::exists, and added sui::dynamic_object_field::remove_opt
Automated update based on: Deprecates vector::empty and vector::singleton in MoveStdlib
Automated update based on: Deprecated sui::dynamic_field::exists_ in favor of sui::dynamic_field::exists, deprecated sui::dynamic_field::remove_if_exists in favor of sui::dynamic_field::remove_opt, deprecated sui::dynamic_object_field::exists_ in favor of sui::dynamic_object_field::exists, and added sui::dynamic_object_field::remove_opt
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.

1 participant