Skip to content

Fix partial update flag mode for resources that require full PUT payloads #18

@guoqqqi

Description

@guoqqqi

Summary

Live CLI validation against API7 EE found that several update commands fail when using flag mode because they send only the changed fields to endpoints that require a full PUT payload.

Affected commands:

  • a7 credential update: omits existing name and plugins when only --desc or --labels is provided.
  • a7 proto update: omits existing content when only --desc or --labels is provided.
  • a7 gateway-group update: omits required name when only --description or --labels is provided.

Expected behavior

Flag-based update commands should behave as partial updates from the user perspective:

  1. Read the current resource.
  2. Merge only the fields provided by flags.
  3. Send a full PUT payload that satisfies the API schema.

File-based update mode should keep replacing the resource with the provided file payload.

Validation target

Add unit tests to ensure the generated PUT payload preserves existing required fields when omitted by flags.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions