Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.81"
".": "0.1.0-alpha.82"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/stainless%2Fstainless-v0-ef33241ec003fafbf4f2ffe434c3d8c2ac0ba929137942185663ff59974d2138.yml
openapi_spec_hash: 87bd0d9c684517522cbbbd48bbe8ad83
config_hash: 038aa9961f259a8ee53e61dfb2454763
config_hash: 63178ec4b1d2ea5636c8619cffcf129b
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 0.1.0-alpha.82 (2026-03-12)

Full Changelog: [v0.1.0-alpha.81...v0.1.0-alpha.82](https://github.com/stainless-api/stainless-api-cli/compare/v0.1.0-alpha.81...v0.1.0-alpha.82)

### Bug Fixes

* fix api-key being passed into command ([74a2a46](https://github.com/stainless-api/stainless-api-cli/commit/74a2a46a697ca526395d7ee360c54204d5f86656))
* fix auth ([ace94ad](https://github.com/stainless-api/stainless-api-cli/commit/ace94ad5a0ee88b334b5752e12cfa8c60e9a88ca))
* fix for test cases with newlines in YAML and better error reporting ([d7ddfce](https://github.com/stainless-api/stainless-api-cli/commit/d7ddfcefaf919400d052b9741eb4f61163c6da62))

## 0.1.0-alpha.81 (2026-03-11)

Full Changelog: [v0.1.0-alpha.80...v0.1.0-alpha.81](https://github.com/stainless-api/stainless-api-cli/compare/v0.1.0-alpha.80...v0.1.0-alpha.81)
Expand Down
5 changes: 5 additions & 0 deletions internal/requestflag/requestflag.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type Flag[
Sources cli.ValueSourceChain // sources to load flag value from
Required bool // whether the flag is required or not
Hidden bool // whether to hide the flag in help output
Local bool // whether or not this flag should be applied to subcommands
Default T // default value for this flag if not set by from any source
Aliases []string // aliases that are allowed for this flag
Validator func(T) error // custom function to validate this flag value
Expand Down Expand Up @@ -55,6 +56,10 @@ type InRequest interface {
IsBodyRoot() bool
}

func (f Flag[T]) IsLocal() bool {
return f.Local
}

func (f Flag[T]) GetQueryPath() string {
return f.QueryPath
}
Expand Down
10 changes: 8 additions & 2 deletions pkg/cmd/cmdutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,14 @@ func getDefaultRequestOptions(cmd *cli.Command) []option.RequestOption {
option.WithHeader("X-Stainless-Package-Version", Version),
option.WithHeader("X-Stainless-Runtime", "cli"),
option.WithHeader("X-Stainless-CLI-Command", cmd.FullName()),
option.WithAPIKey(cmd.String("api-key")),
option.WithProject(cmd.String("project")),
}

if cmd.IsSet("api-key") {
opts = append(opts, option.WithAPIKey(cmd.String("api-key")))
}

if cmd.IsSet("project") {
opts = append(opts, option.WithProject(cmd.String("project")))
}

// Override base URL if the --base-url flag is provided
Expand Down
23 changes: 12 additions & 11 deletions pkg/cmd/flagoptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,19 +227,20 @@ func flagOptions(

if len(pipeData) > 0 {
var bodyData any
if err := yaml.Unmarshal(pipeData, &bodyData); err == nil {
if bodyMap, ok := bodyData.(map[string]any); ok {
if flagMap, ok := requestContents.Body.(map[string]any); ok {
maps.Copy(bodyMap, flagMap)
requestContents.Body = bodyMap
} else {
bodyData = requestContents.Body
}
} else if flagMap, ok := requestContents.Body.(map[string]any); ok && len(flagMap) > 0 {
return nil, fmt.Errorf("Cannot merge flags with a body that is not a map: %v", bodyData)
if err := yaml.Unmarshal(pipeData, &bodyData); err != nil {
return nil, fmt.Errorf("Failed to parse piped data as YAML/JSON:\n%w", err)
}
if bodyMap, ok := bodyData.(map[string]any); ok {
if flagMap, ok := requestContents.Body.(map[string]any); ok {
maps.Copy(bodyMap, flagMap)
requestContents.Body = bodyMap
} else {
requestContents.Body = bodyData
bodyData = requestContents.Body
}
} else if flagMap, ok := requestContents.Body.(map[string]any); ok && len(flagMap) > 0 {
return nil, fmt.Errorf("Cannot merge flags with a body that is not a map: %v", bodyData)
} else {
requestContents.Body = bodyData
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

package cmd

const Version = "0.1.0-alpha.81" // x-release-please-version
const Version = "0.1.0-alpha.82" // x-release-please-version
Loading