Skip to content
Open
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 cmd/openapi/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
require (
github.com/atotto/clipboard v0.1.4 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/blackwell-systems/gcf-go v1.5.0 // indirect
github.com/blackwell-systems/gcf-go v1.7.1 // indirect
github.com/charmbracelet/colorprofile v0.4.1 // indirect
github.com/charmbracelet/x/ansi v0.11.6 // indirect
github.com/charmbracelet/x/cellbuf v0.0.15 // indirect
Expand Down
4 changes: 2 additions & 2 deletions cmd/openapi/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
github.com/blackwell-systems/gcf-go v1.5.0 h1:ZOWyxvRF1TZOmzPYXVO1dOTU6VRslNaJgnzSDDh8hL4=
github.com/blackwell-systems/gcf-go v1.5.0/go.mod h1:hYxLOn6JHzNNNH7wfgRXWETX2lMtRtjG8FEX45I6SAI=
github.com/blackwell-systems/gcf-go v1.7.1 h1:hpdCf/GHXS/CrsXsHnnIw6hXBHhtC2dopGOdiFMnsc4=
github.com/blackwell-systems/gcf-go v1.7.1/go.mod h1:hYxLOn6JHzNNNH7wfgRXWETX2lMtRtjG8FEX45I6SAI=
github.com/charmbracelet/bubbles v1.0.0 h1:12J8/ak/uCZEMQ6KU7pcfwceyjLlWsDLAxB5fXonfvc=
github.com/charmbracelet/bubbles v1.0.0/go.mod h1:9d/Zd5GdnauMI5ivUIVisuEm3ave1XwXtD1ckyV6r3E=
github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw=
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/speakeasy-api/openapi
go 1.25.0

require (
github.com/blackwell-systems/gcf-go v1.5.0
github.com/blackwell-systems/gcf-go v1.7.1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This upgrade has oq-visible output changes that are missing from the PR description. FormatGCF passes array fields as nested []string values. With v1.5.0, a representative tags/scopes value is formatted as a scalar cell such as [pets public]; v1.7.1 recursively normalizes it and emits a real GCF array attachment (^ plus .tags [2]: pets,public). Strings shaped like ^{...} are also newly quoted instead of emitted bare.

These are worthwhile correctness fixes, but they are byte-level and semantic output changes. The stated petstore smoke query does not exercise them because the default operation fields contain no arrays, and oq/format_test.go has no GCF coverage. Please document/accept the compatibility change explicitly and add golden coverage for at least an array-valued projection and a ^{...} string before merging.

github.com/santhosh-tekuri/jsonschema/v6 v6.0.2
github.com/speakeasy-api/jsonpath v0.6.3
github.com/stretchr/testify v1.11.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/blackwell-systems/gcf-go v1.5.0 h1:ZOWyxvRF1TZOmzPYXVO1dOTU6VRslNaJgnzSDDh8hL4=
github.com/blackwell-systems/gcf-go v1.5.0/go.mod h1:hYxLOn6JHzNNNH7wfgRXWETX2lMtRtjG8FEX45I6SAI=
github.com/blackwell-systems/gcf-go v1.7.1 h1:hpdCf/GHXS/CrsXsHnnIw6hXBHhtC2dopGOdiFMnsc4=
github.com/blackwell-systems/gcf-go v1.7.1/go.mod h1:hYxLOn6JHzNNNH7wfgRXWETX2lMtRtjG8FEX45I6SAI=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
53 changes: 53 additions & 0 deletions oq/format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,56 @@ func TestToonValue_ArrayEscapesSemicolonElements(t *testing.T) {

assert.Equal(t, `"v1;deprecated";"v2;current"`, encoded, "array elements containing the delimiter should be quoted individually")
}

// TestFormatGCF_ArrayValuedProjection pins the GCF output for a projection that
// includes an array-valued field. FormatGCF passes array fields to the encoder as
// []string, which are emitted as a GCF array attachment (a "^" marker on the row
// plus a ".scopes [N]: ..." continuation line) rather than a single scalar cell.
// This golden covers the array path that the default petstore smoke query does not
// exercise (its operation fields contain no arrays).
func TestFormatGCF_ArrayValuedProjection(t *testing.T) {
t.Parallel()

// SecurityRequirement rows read schemeName/scopes directly off the Row, so this
// drives FormatGCF end to end without needing a populated SchemaGraph.
result := &Result{
Rows: []Row{{
Kind: SecurityRequirementResult,
SchemeName: "petstore_auth",
Scopes: []string{"read:pets", "write:pets"},
}},
Fields: []string{"schemeName", "scopes"},
}

got := FormatGCF(result, nil)

want := "GCF profile=generic\n" +
"## [1]{schemeName,scopes}\n" +
"@0 petstore_auth|^\n" +
".scopes [2]: read:pets,write:pets\n"
assert.Equal(t, want, got, "array-valued fields should emit as a GCF array attachment")
}

// TestFormatGCF_MarkerShapedStringQuoted pins the GCF output for a string value
// shaped like a GCF marker ("^{...}"). Such values are quoted rather than emitted
// bare so they round-trip as literal strings instead of being read as markup.
func TestFormatGCF_MarkerShapedStringQuoted(t *testing.T) {
t.Parallel()

result := &Result{
Rows: []Row{{
Kind: SecurityRequirementResult,
SchemeName: "^{oauth}",
Scopes: []string{"read"},
}},
Fields: []string{"schemeName", "scopes"},
}

got := FormatGCF(result, nil)

want := "GCF profile=generic\n" +
"## [1]{schemeName,scopes}\n" +
"@0 \"^{oauth}\"|^\n" +
".scopes [1]: read\n"
assert.Equal(t, want, got, "marker-shaped string values should be quoted")
}