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 arazzo/arazzo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ var stressTests = []struct {
args: args{
location: "https://raw.githubusercontent.com/ritza-co/e2e-testing-arazzo/c0615c3708a1e4c0fcaeb79edae78ddc4eb5ba82/arazzo.yaml",
validationIgnores: []string{
"[42:24] error validation-invalid-syntax invalid jsonpath expression: Error at line 1, column 8: unexpected token", // legit invalid RFC 9535 syntax
"[42:24] error validation-invalid-syntax invalid jsonpath expression: Error at line 1, column 9: unexpected token when parsing segment", // legit invalid RFC 9535 syntax
},
},
wantTitle: "Build-a-Bot Workflow",
Expand Down
45 changes: 45 additions & 0 deletions arazzo/criterion/criterion_validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,3 +474,48 @@ func TestCriterion_Validate_WithTypes(t *testing.T) {
})
}
}

func TestCriterion_Validate_JsonPathKeywordMemberNames_Success(t *testing.T) {
t.Parallel()

// RFC 9535 member-name-shorthand allows function names (value, length, count,
// match, search) and keywords (true, false, null) as member names.
tests := []struct {
name string
condition string
}{
{name: "value member followed by index", condition: "$.value[0]"},
{name: "value member followed by wildcard", condition: "$.value[*]"},
{name: "value member followed by filter", condition: "$.value[?(@.id == 'x')]"},
{name: "value member followed by child", condition: "$.value.id"},
{name: "descendant value member", condition: "$..value[0]"},
{name: "value member inside filter query", condition: "$[?@.value[0] == 1]"},
{name: "length member followed by index", condition: "$.length[0]"},
Comment thread
TristanSpeakEasy marked this conversation as resolved.
Resolved
{name: "count member followed by index", condition: "$.count[0]"},
{name: "match member followed by index", condition: "$.match[0]"},
{name: "search member followed by index", condition: "$.search[0]"},
{name: "keyword members", condition: "$.true.false.null"},
{name: "value function call", condition: "$[?value(@.a) == 1]"},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

c := &criterion.Criterion{
Context: pointer.From(expression.Expression("$response.body")),
Condition: tt.condition,
Type: criterion.CriterionTypeUnion{
Type: pointer.From(criterion.CriterionTypeJsonPath),
},
}

err := c.Sync(t.Context())
require.NoError(t, err, "sync should succeed")

errs := c.Validate()
assert.Empty(t, errs, "validation should succeed")
assert.True(t, c.Valid, "criterion should be valid")
})
}
}
2 changes: 1 addition & 1 deletion cmd/openapi/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ require (
github.com/muesli/cancelreader v0.2.2 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3 // indirect
github.com/speakeasy-api/jsonpath v0.7.0 // indirect
github.com/speakeasy-api/jsonpath v0.7.1 // indirect
github.com/speakeasy-api/yaml-jsonpath v0.0.0-20261016002013-07e5f48e6d17 // indirect
github.com/spf13/pflag v1.0.9 // indirect
github.com/xo/terminfo v1.0.0 // 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 @@ -68,8 +68,8 @@ github.com/santhosh-tekuri/jsonschema/v6 v6.0.3 h1:1EYB5IzjZawrrnELUi78f9fPu57Hu
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU=
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
github.com/speakeasy-api/jsonpath v0.7.0 h1:Pz7dS2AfuB745mnEcmg4qyS7wTJFiHH9zjW5kFX9b4E=
github.com/speakeasy-api/jsonpath v0.7.0/go.mod h1:b9upx/gIKYwyKVcgRxvmdyKwAykzk88FCnNH3cwbw8w=
github.com/speakeasy-api/jsonpath v0.7.1 h1:vpBDKeT6av0v/g6oTwCfGh27iRDfMPaTQ2GvKK51TkQ=
github.com/speakeasy-api/jsonpath v0.7.1/go.mod h1:b9upx/gIKYwyKVcgRxvmdyKwAykzk88FCnNH3cwbw8w=
github.com/speakeasy-api/openapi v1.26.3-0.20261102103018-bb4439a5fcc1 h1:/7XBrBdRjH+V1SisA55rzT9Q2+f8DzlpXKkzNeJdzQE=
github.com/speakeasy-api/openapi v1.26.3-0.20261102103018-bb4439a5fcc1/go.mod h1:mBpPJFcBwcARRpedUYhZY3tzWFZ19eJKtZGUJsc+KW0=
github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261102103018-bb4439a5fcc1 h1:W27n3pNt9dNSCPF9nV0CFiCkNaEt3fUTZtAcGdcWJKo=
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.26.0
require (
github.com/blackwell-systems/gcf-go v1.8.0
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3
github.com/speakeasy-api/jsonpath v0.7.0
github.com/speakeasy-api/jsonpath v0.7.1
github.com/speakeasy-api/yaml-jsonpath v0.0.0-20261016002013-07e5f48e6d17
github.com/stretchr/testify v1.12.1
go.yaml.in/yaml/v3 v3.0.6
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ github.com/santhosh-tekuri/jsonschema/v6 v6.0.3 h1:1EYB5IzjZawrrnELUi78f9fPu57Hu
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU=
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
github.com/speakeasy-api/jsonpath v0.7.0 h1:Pz7dS2AfuB745mnEcmg4qyS7wTJFiHH9zjW5kFX9b4E=
github.com/speakeasy-api/jsonpath v0.7.0/go.mod h1:b9upx/gIKYwyKVcgRxvmdyKwAykzk88FCnNH3cwbw8w=
github.com/speakeasy-api/jsonpath v0.7.1 h1:vpBDKeT6av0v/g6oTwCfGh27iRDfMPaTQ2GvKK51TkQ=
github.com/speakeasy-api/jsonpath v0.7.1/go.mod h1:b9upx/gIKYwyKVcgRxvmdyKwAykzk88FCnNH3cwbw8w=
github.com/speakeasy-api/yaml-jsonpath v0.0.0-20261016002013-07e5f48e6d17 h1:GczZJYqsf1WvvdkFvviAaP5wLrqxRPed8TmbKFsoLFk=
github.com/speakeasy-api/yaml-jsonpath v0.0.0-20261016002013-07e5f48e6d17/go.mod h1:EMfEapMn2EVhphaczz62z+JnkJgCFixiF1G7z3tUbzg=
github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE=
Expand Down
4 changes: 2 additions & 2 deletions jsonschema/oas3/tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ github.com/shirou/gopsutil/v4 v4.26.6 h1:Mzr/npDtQC/xpeEuQKHZt8Zo9CmPvhTj8nkR8w5
github.com/shirou/gopsutil/v4 v4.26.6/go.mod h1:LZ6ewCSkBqUpvSOf+LsTGnRinC6iaNUNMGBtDkJBaLQ=
github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w=
github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g=
github.com/speakeasy-api/jsonpath v0.7.0 h1:Pz7dS2AfuB745mnEcmg4qyS7wTJFiHH9zjW5kFX9b4E=
github.com/speakeasy-api/jsonpath v0.7.0/go.mod h1:b9upx/gIKYwyKVcgRxvmdyKwAykzk88FCnNH3cwbw8w=
github.com/speakeasy-api/jsonpath v0.7.1 h1:vpBDKeT6av0v/g6oTwCfGh27iRDfMPaTQ2GvKK51TkQ=
github.com/speakeasy-api/jsonpath v0.7.1/go.mod h1:b9upx/gIKYwyKVcgRxvmdyKwAykzk88FCnNH3cwbw8w=
github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4=
github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0=
github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE=
Expand Down
4 changes: 2 additions & 2 deletions openapi/linter/converter/tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 h1:BHT72Gu3keYf3ZEu2J
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3 h1:1EYB5IzjZawrrnELUi78f9fPu57HuXjmddZPjrls/28=
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU=
github.com/speakeasy-api/jsonpath v0.7.0 h1:Pz7dS2AfuB745mnEcmg4qyS7wTJFiHH9zjW5kFX9b4E=
github.com/speakeasy-api/jsonpath v0.7.0/go.mod h1:b9upx/gIKYwyKVcgRxvmdyKwAykzk88FCnNH3cwbw8w=
github.com/speakeasy-api/jsonpath v0.7.1 h1:vpBDKeT6av0v/g6oTwCfGh27iRDfMPaTQ2GvKK51TkQ=
github.com/speakeasy-api/jsonpath v0.7.1/go.mod h1:b9upx/gIKYwyKVcgRxvmdyKwAykzk88FCnNH3cwbw8w=
github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE=
github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg=
go.yaml.in/yaml/v3 v3.0.6 h1:zcDfvjXEqTQmpjniUBLc91xYJMB2c4QOFxEF/LCEckM=
Expand Down
4 changes: 2 additions & 2 deletions openapi/linter/customrules/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 h1:BHT72Gu3keYf3ZEu2J
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3 h1:1EYB5IzjZawrrnELUi78f9fPu57HuXjmddZPjrls/28=
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU=
github.com/speakeasy-api/jsonpath v0.7.0 h1:Pz7dS2AfuB745mnEcmg4qyS7wTJFiHH9zjW5kFX9b4E=
github.com/speakeasy-api/jsonpath v0.7.0/go.mod h1:b9upx/gIKYwyKVcgRxvmdyKwAykzk88FCnNH3cwbw8w=
github.com/speakeasy-api/jsonpath v0.7.1 h1:vpBDKeT6av0v/g6oTwCfGh27iRDfMPaTQ2GvKK51TkQ=
github.com/speakeasy-api/jsonpath v0.7.1/go.mod h1:b9upx/gIKYwyKVcgRxvmdyKwAykzk88FCnNH3cwbw8w=
github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE=
github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg=
go.yaml.in/yaml/v3 v3.0.6 h1:zcDfvjXEqTQmpjniUBLc91xYJMB2c4QOFxEF/LCEckM=
Expand Down
Loading