Skip to content

Type asana compact fields as always present - #1113

Merged
github-actions[bot] merged 1 commit into
ruby:mainfrom
apiology:asana-compact-fields-non-nil
Oct 22, 2026
Merged

github-actions[bot] merged 1 commit into
ruby:mainfrom
apiology:asana-compact-fields-non-nil

Conversation

@apiology

Copy link
Copy Markdown
Contributor

Claude: This PR was written by Claude Code on behalf of @apiology.

Problem

A task's name types as nilable:

# Steep, with implicitly_returns_nil! in the Steepfile:
# [error] Type `(::String | nil)` does not have method `upcase`
client.tasks.find_by_id("1").name.upcase

Callers must nil-check names, story text and timestamps that Asana returns on every request whose opt_fields doesn't exclude them; per Asana's input/output options, only the gid is guaranteed ("The gid of included objects will always be returned, regardless of the field options"), so a request whose fields omits one still gets nil, which this change accepts.

Solution

Declare the fields in each resource's compact representation (the *Compact schemas in Asana's OpenAPI spec) as plain attr_readers, keeping optional types for fields the spec marks nullable: true.

Asana returns the fields of a resource's compact representation (the
*Compact schemas in its OpenAPI spec) unless a request's opt_fields
leaves them out. Declaring them implicitly-returns-nil made consumers
that enable Steep's implicitly_returns_nil! nil-check names, story
timestamps and the like on every read.

Declare those fields as plain attr_readers, accepting that a request
whose fields option omits one yields nil, and say so in the comment
that explains the file's nil conventions. Fields the API can return
as null keep their optional types.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wo4FerFK9aaxrGrmVE9ncZ
@apiology
apiology marked this pull request as ready for review October 22, 2026 19:33
@github-actions

Copy link
Copy Markdown

@apiology Thanks for your contribution!

Please follow the instructions below for each change.
See also: https://github.com/ruby/gem_rbs_collection/blob/main/docs/CONTRIBUTING.md

Available commands

You can use the following commands by commenting on this PR.

  • /merge: Merge this PR if CI passes

asana

You changed RBS files for an existing gem.
You can merge this PR yourself because you are a reviewer of this gem.
Just comment /merge to merge this PR.

You can also request a review from other reviewers if you want.

@apiology

Copy link
Copy Markdown
Contributor Author

/merge

@github-actions
github-actions Bot merged commit ca341ff into ruby:main Oct 22, 2026
7 checks passed
apiology added a commit to apiology/checkoff that referenced this pull request Oct 22, 2026
Move ruby/gem_rbs_collection from ee06947 to ca341ff, which includes
ruby/gem_rbs_collection#1113, typing asana compact fields as always
present.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wo4FerFK9aaxrGrmVE9ncZ
apiology added a commit to apiology/checkoff that referenced this pull request Oct 22, 2026
Bring in the rbs_collection.lock.yaml refresh to ruby/gem_rbs_collection
ca341ff, which includes ruby/gem_rbs_collection#1113.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wo4FerFK9aaxrGrmVE9ncZ
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