Skip to content

Conversation

@cnaples79
Copy link

Summary

  • Adds support for multiple fixture files to the fixtures command
  • Allows users to run multiple fixtures in a single command
  • Processes fixture files sequentially in the order provided

Rationale

Previously, users needed to chain multiple stripe fixtures commands using &&:

stripe fixtures ./subscription.created.json && stripe fixtures ./teardown.json

This change allows a simpler syntax:

stripe fixtures ./subscription.created.json ./teardown.json

This improves developer experience by reducing repetition and making it easier to run multiple fixtures together.

Changes Made

  • pkg/cmd/fixtures.go:

    • Changed argument validator from ExactArgs(1) to MinimumNArgs(1) to accept one or more files
    • Added loop to process each fixture file sequentially
    • Each file is executed in order with proper error handling
  • pkg/validators/cmds.go:

    • Implemented MinimumNArgs() validator function
    • Follows the same pattern as existing MaximumNArgs() and ExactArgs() validators
    • Provides clear error messages when too few arguments are provided

Test Plan

  • Built the CLI successfully on Android/Linux (aarch64)
  • Tested help output: ./stripe fixtures --help displays correctly
  • Tested error handling: ./stripe fixtures shows appropriate error message
  • Verified the binary compiles and runs correctly

The implementation maintains backward compatibility - single file usage continues to work as before.

Fixes #910

The fixtures command previously only accepted a single file argument.
This change allows users to pass multiple fixture files which will be
processed sequentially, eliminating the need to chain multiple commands
with && operators.

Changes:
- Updated fixtures command to accept at least one argument (MinimumNArgs)
  instead of exactly one argument (ExactArgs)
- Added loop to process each fixture file sequentially
- Implemented MinimumNArgs validator function in validators package
  to support the new argument validation

Usage:
  stripe fixtures file1.json file2.json file3.json

Fixes stripe#910
@cnaples79 cnaples79 requested a review from a team as a code owner October 5, 2025 02:09
@cla-assistant
Copy link

cla-assistant bot commented Oct 5, 2025

CLA assistant check
All committers have signed the CLA.

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.

Stripe fixtures support for multiple file inputs

1 participant