Skip to content

fix: always include expiration field in service-account create request#29

Merged
overtrue merged 4 commits intomainfrom
copilot/fix-service-account-creation-error
Mar 7, 2026
Merged

fix: always include expiration field in service-account create request#29
overtrue merged 4 commits intomainfrom
copilot/fix-service-account-creation-error

Conversation

Copy link
Contributor

Copilot AI commented Mar 7, 2026

admin service-account create fails when --expiry is omitted because skip_serializing_if = "Option::is_none" on the expiry field drops the expiration key entirely from the JSON body. RustFS requires the field to be present.

  • Remove skip_serializing_if from CreateServiceAccountRequest.expiry so it serializes as null when unset
  • Add unit tests for both None and Some serialization paths

Before:

{"accessKey":"abc","secretKey":"abc"}

After:

{"accessKey":"abc","secretKey":"abc","expiration":null}
Original prompt

This section details on the original issue you should resolve

<issue_title>admin service-account create returns Error specifying missing expiration</issue_title>
<issue_description>```
rc.exe admin service-account create abc abc
✗ Failed to create service account: Invalid path: InvalidRequestunmarshal body failed, e: Error("missing field expiration", line: 1, column: 37)

CLI : v0.1.4
RustFS : 1.0.0-alpha.85</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

The CreateServiceAccountRequest was using skip_serializing_if on the
expiry field, which omitted the expiration key from the JSON body when
not provided. RustFS server requires this field to be present. Remove
the skip_serializing_if attribute so the field always serializes (as
null when not set).

Co-authored-by: overtrue <1472352+overtrue@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix error specifying missing expiration in service account creation fix: always include expiration field in service-account create request Mar 7, 2026
@overtrue overtrue marked this pull request as ready for review March 7, 2026 13:30
Copilot AI review requested due to automatic review settings March 7, 2026 13:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes admin service-account create requests against RustFS by ensuring the JSON body always includes the expiration field, even when --expiry is omitted, and adds tests to prevent regressions.

Changes:

  • Remove skip_serializing_if = "Option::is_none" from CreateServiceAccountRequest.expiry so it serializes as "expiration": null when unset.
  • Add unit tests covering both expiry: None and expiry: Some(...) serialization paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

overtrue and others added 2 commits March 7, 2026 21:44
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: 安正超 <anzhengchao@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: 安正超 <anzhengchao@gmail.com>
@overtrue overtrue merged commit b2288ad into main Mar 7, 2026
13 checks passed
@overtrue overtrue deleted the copilot/fix-service-account-creation-error branch March 7, 2026 13:50
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.

admin service-account create returns Error specifying missing expiration

3 participants