Skip to content

Commit 072b81c

Browse files
authored
chore: carefully upgrade openapi-overlay (#14)
* chore: carefully upgrade openapi-overlay * chore: only show the error, when there is a filter expression * chore: go mod tidy * chore: fix comment * chore: some testing, a bit of abstraction * chore: regen snapshots
1 parent ce88d83 commit 072b81c

15 files changed

+198
-27
lines changed

go.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@ module github.com/speakeasy-api/openapi-overlay
33
go 1.22
44

55
require (
6-
github.com/speakeasy-api/jsonpath v0.5.0
6+
github.com/speakeasy-api/jsonpath v0.6.0
77
github.com/spf13/cobra v1.7.0
88
github.com/stretchr/testify v1.9.0
9+
github.com/vmware-labs/yaml-jsonpath v0.3.2
910
gopkg.in/yaml.v3 v3.0.1
1011
)
1112

1213
require (
1314
github.com/davecgh/go-spew v1.1.1 // indirect
15+
github.com/dprotaso/go-yit v0.0.0-20191028211022-135eb7262960 // indirect
1416
github.com/inconshreveable/mousetrap v1.1.0 // indirect
15-
github.com/kr/text v0.1.0 // indirect
1617
github.com/pmezard/go-difflib v1.0.0 // indirect
1718
github.com/spf13/pflag v1.0.5 // indirect
1819
)

go.sum

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,62 @@
11
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
2+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
23
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
34
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5+
github.com/dprotaso/go-yit v0.0.0-20191028211022-135eb7262960 h1:aRd8M7HJVZOqn/vhOzrGcQH0lNAMkqMn+pXUYkatmcA=
6+
github.com/dprotaso/go-yit v0.0.0-20191028211022-135eb7262960/go.mod h1:9HQzr9D/0PGwMEbC3d5AB7oi67+h4TsQqItC1GVYG58=
7+
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
8+
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
9+
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
10+
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
411
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
512
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
613
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
714
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
815
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
916
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
1017
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
18+
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
19+
github.com/onsi/ginkgo v1.10.2 h1:uqH7bpe+ERSiDa34FDOF7RikN6RzXgduUF8yarlZp94=
20+
github.com/onsi/ginkgo v1.10.2/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
21+
github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME=
22+
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
1123
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1224
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
1325
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
14-
github.com/speakeasy-api/jsonpath v0.5.0 h1:hc6XlmFROc2a14XyQAZmSUQO+cuShq9TyevPEElINII=
15-
github.com/speakeasy-api/jsonpath v0.5.0/go.mod h1:ymb2iSkyOycmzKwbEAYPJV/yi2rSmvBCLZJcyD+VVWw=
26+
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
27+
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
28+
github.com/speakeasy-api/jsonpath v0.6.0 h1:IhtFOV9EbXplhyRqsVhHoBmmYjblIRh5D1/g8DHMXJ8=
29+
github.com/speakeasy-api/jsonpath v0.6.0/go.mod h1:ymb2iSkyOycmzKwbEAYPJV/yi2rSmvBCLZJcyD+VVWw=
1630
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
1731
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
1832
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
1933
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
34+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
35+
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
36+
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
2037
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
2138
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
39+
github.com/vmware-labs/yaml-jsonpath v0.3.2 h1:/5QKeCBGdsInyDCyVNLbXyilb61MXGi9NP674f9Hobk=
40+
github.com/vmware-labs/yaml-jsonpath v0.3.2/go.mod h1:U6whw1z03QyqgWdgXxvVnQ90zN1BWz5V+51Ewf8k+rQ=
41+
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd h1:nTDtHvHSdCn1m6ITfMRqtOd/9+7a3s8RBNOZ3eYZzJA=
42+
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
43+
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
44+
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs=
45+
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
46+
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
47+
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
2248
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
2349
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
2450
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
51+
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
52+
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
53+
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
54+
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
55+
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
56+
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
57+
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
58+
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
59+
gopkg.in/yaml.v3 v3.0.0-20191026110619-0b21df46bc1d/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
60+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2561
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
2662
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

pkg/overlay/apply.go

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package overlay
22

33
import (
44
"fmt"
5-
"github.com/speakeasy-api/jsonpath/pkg/jsonpath"
65
"github.com/speakeasy-api/jsonpath/pkg/jsonpath/config"
6+
"github.com/speakeasy-api/jsonpath/pkg/jsonpath/token"
77
"gopkg.in/yaml.v3"
88
"strings"
99
)
@@ -14,9 +14,9 @@ func (o *Overlay) ApplyTo(root *yaml.Node) error {
1414
for _, action := range o.Actions {
1515
var err error
1616
if action.Remove {
17-
err = applyRemoveAction(root, action)
17+
err = o.applyRemoveAction(root, action, nil)
1818
} else {
19-
err = applyUpdateAction(root, action, &[]string{})
19+
err = o.applyUpdateAction(root, action, &[]string{})
2020
}
2121

2222
if err != nil {
@@ -30,33 +30,46 @@ func (o *Overlay) ApplyTo(root *yaml.Node) error {
3030
func (o *Overlay) ApplyToStrict(root *yaml.Node) (error, []string) {
3131
multiError := []string{}
3232
warnings := []string{}
33+
hasFilterExpression := false
3334
for i, action := range o.Actions {
34-
err := validateSelectorHasAtLeastOneTarget(root, action)
35+
tokens := token.NewTokenizer(action.Target, config.WithPropertyNameExtension()).Tokenize()
36+
for _, tok := range tokens {
37+
if tok.Token == token.FILTER {
38+
hasFilterExpression = true
39+
}
40+
}
41+
42+
actionWarnings := []string{}
43+
err := o.validateSelectorHasAtLeastOneTarget(root, action)
3544
if err != nil {
3645
multiError = append(multiError, err.Error())
3746
}
3847
if action.Remove {
39-
err = applyRemoveAction(root, action)
48+
err = o.applyRemoveAction(root, action, &actionWarnings)
4049
} else {
41-
actionWarnings := []string{}
42-
err = applyUpdateAction(root, action, &actionWarnings)
43-
for _, warning := range actionWarnings {
44-
warnings = append(warnings, fmt.Sprintf("update action (%v / %v) target=%s: %s", i+1, len(o.Actions), action.Target, warning))
45-
}
50+
err = o.applyUpdateAction(root, action, &actionWarnings)
4651
}
52+
for _, warning := range actionWarnings {
53+
warnings = append(warnings, fmt.Sprintf("update action (%v / %v) target=%s: %s", i+1, len(o.Actions), action.Target, warning))
54+
}
55+
}
56+
57+
if hasFilterExpression && !o.UsesRFC9535() {
58+
warnings = append(warnings, "overlay has a filter expression but lacks `x-speakeasy-jsonpath: rfc9535` extension. Deprecated jsonpath behaviour in use. See overlay.speakeasy.com for the implementation playground.")
4759
}
60+
4861
if len(multiError) > 0 {
4962
return fmt.Errorf("error applying overlay (strict): %v", strings.Join(multiError, ",")), warnings
5063
}
5164
return nil, warnings
5265
}
5366

54-
func validateSelectorHasAtLeastOneTarget(root *yaml.Node, action Action) error {
67+
func (o *Overlay) validateSelectorHasAtLeastOneTarget(root *yaml.Node, action Action) error {
5568
if action.Target == "" {
5669
return nil
5770
}
5871

59-
p, err := jsonpath.NewPath(action.Target)
72+
p, err := o.NewPath(action.Target, nil)
6073
if err != nil {
6174
return err
6275
}
@@ -70,14 +83,14 @@ func validateSelectorHasAtLeastOneTarget(root *yaml.Node, action Action) error {
7083
return nil
7184
}
7285

73-
func applyRemoveAction(root *yaml.Node, action Action) error {
86+
func (o *Overlay) applyRemoveAction(root *yaml.Node, action Action, warnings *[]string) error {
7487
if action.Target == "" {
7588
return nil
7689
}
7790

7891
idx := newParentIndex(root)
7992

80-
p, err := jsonpath.NewPath(action.Target, config.WithPropertyNameExtension())
93+
p, err := o.NewPath(action.Target, warnings)
8194
if err != nil {
8295
return err
8396
}
@@ -104,8 +117,13 @@ func removeNode(idx parentIndex, node *yaml.Node) {
104117
if child == node {
105118
switch parent.Kind {
106119
case yaml.MappingNode:
107-
// we have to delete the key too
108-
parent.Content = append(parent.Content[:i-1], parent.Content[i+1:]...)
120+
if i%2 == 1 {
121+
// if we select a value, we should delete the key too
122+
parent.Content = append(parent.Content[:i-1], parent.Content[i+1:]...)
123+
} else {
124+
// if we select a key, we should delete the value
125+
parent.Content = append(parent.Content[:i], parent.Content[i+2:]...)
126+
}
109127
return
110128
case yaml.SequenceNode:
111129
parent.Content = append(parent.Content[:i], parent.Content[i+1:]...)
@@ -115,7 +133,7 @@ func removeNode(idx parentIndex, node *yaml.Node) {
115133
}
116134
}
117135

118-
func applyUpdateAction(root *yaml.Node, action Action, warnings *[]string) error {
136+
func (o *Overlay) applyUpdateAction(root *yaml.Node, action Action, warnings *[]string) error {
119137
if action.Target == "" {
120138
return nil
121139
}
@@ -124,7 +142,7 @@ func applyUpdateAction(root *yaml.Node, action Action, warnings *[]string) error
124142
return nil
125143
}
126144

127-
p, err := jsonpath.NewPath(action.Target, config.WithPropertyNameExtension())
145+
p, err := o.NewPath(action.Target, warnings)
128146
if err != nil {
129147
return err
130148
}

pkg/overlay/apply_test.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package overlay_test
22

33
import (
44
"bytes"
5+
"github.com/speakeasy-api/jsonpath/pkg/jsonpath"
56
"github.com/speakeasy-api/openapi-overlay/pkg/loader"
67
"github.com/stretchr/testify/assert"
78
"github.com/stretchr/testify/require"
@@ -75,3 +76,42 @@ func TestApplyToStrict(t *testing.T) {
7576
assert.Equal(t, "update action (2 / 2) target=$.info.title: does nothing", warnings[0])
7677
NodeMatchesFile(t, node, "testdata/openapi-strict-onechange.yaml")
7778
}
79+
80+
func TestApplyToOld(t *testing.T) {
81+
t.Parallel()
82+
83+
nodeOld, err := loader.LoadSpecification("testdata/openapi.yaml")
84+
require.NoError(t, err)
85+
86+
nodeNew, err := loader.LoadSpecification("testdata/openapi.yaml")
87+
require.NoError(t, err)
88+
89+
o, err := loader.LoadOverlay("testdata/overlay-old.yaml")
90+
require.NoError(t, err)
91+
92+
err, warnings := o.ApplyToStrict(nodeOld)
93+
require.NoError(t, err)
94+
require.Len(t, warnings, 2)
95+
require.Contains(t, warnings[0], "invalid rfc9535 jsonpath")
96+
require.Contains(t, warnings[1], "x-speakeasy-jsonpath: rfc9535")
97+
98+
path, err := jsonpath.NewPath(`$.paths["/anything/selectGlobalServer"]`)
99+
require.NoError(t, err)
100+
result := path.Query(nodeOld)
101+
require.NoError(t, err)
102+
require.Equal(t, 0, len(result))
103+
o.JSONPathVersion = "rfc9535"
104+
err, warnings = o.ApplyToStrict(nodeNew)
105+
require.ErrorContains(t, err, "unexpected token") // should error out: invalid nodepath
106+
// now lets fix it.
107+
o.Actions[0].Target = "$.paths.*[?(@[\"x-my-ignore\"])]"
108+
err, warnings = o.ApplyToStrict(nodeNew)
109+
require.ErrorContains(t, err, "did not match any targets")
110+
// Now lets fix it.
111+
o.Actions[0].Target = "$.paths[?(@[\"x-my-ignore\"])]" // @ should always refer to the child node in RFC 9535..
112+
err, warnings = o.ApplyToStrict(nodeNew)
113+
require.NoError(t, err)
114+
result = path.Query(nodeNew)
115+
require.NoError(t, err)
116+
require.Equal(t, 0, len(result))
117+
}

pkg/overlay/compare.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ func Compare(title string, y1 *yaml.Node, y2 yaml.Node) (*Overlay, error) {
1818
}
1919

2020
return &Overlay{
21-
Version: "1.0.0",
21+
Version: "1.0.0",
22+
JSONPathVersion: "rfc9535",
2223
Info: Info{
2324
Title: title,
2425
Version: "0.0.0",

pkg/overlay/compare_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package overlay_test
22

33
import (
4-
"github.com/speakeasy-api/jsonpath/pkg/overlay"
54
"github.com/speakeasy-api/openapi-overlay/pkg/loader"
5+
"github.com/speakeasy-api/openapi-overlay/pkg/overlay"
66
"github.com/stretchr/testify/assert"
77
"github.com/stretchr/testify/require"
88
"os"

pkg/overlay/jsonpath.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package overlay
2+
3+
import (
4+
"fmt"
5+
"github.com/speakeasy-api/jsonpath/pkg/jsonpath"
6+
"github.com/speakeasy-api/jsonpath/pkg/jsonpath/config"
7+
"github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath"
8+
"gopkg.in/yaml.v3"
9+
)
10+
11+
type Queryable interface {
12+
Query(root *yaml.Node) []*yaml.Node
13+
}
14+
15+
type yamlPathQueryable struct {
16+
path *yamlpath.Path
17+
}
18+
19+
func (y yamlPathQueryable) Query(root *yaml.Node) []*yaml.Node {
20+
if y.path == nil {
21+
return []*yaml.Node{}
22+
}
23+
// errors aren't actually possible from yamlpath.
24+
result, _ := y.path.Find(root)
25+
return result
26+
}
27+
28+
func (o *Overlay) NewPath(target string, warnings *[]string) (Queryable, error) {
29+
rfcJSONPath, rfcJSONPathErr := jsonpath.NewPath(target, config.WithPropertyNameExtension())
30+
if o.UsesRFC9535() {
31+
return rfcJSONPath, rfcJSONPathErr
32+
}
33+
if rfcJSONPathErr != nil && warnings != nil {
34+
*warnings = append(*warnings, fmt.Sprintf("invalid rfc9535 jsonpath %s: %s\nThis will be treated as an error in the future. Please fix and opt into the new implementation with `\"x-speakeasy-jsonpath\": rfc9535` in the root of your overlay. See overlay.speakeasy.com for an implementation playground.", target, rfcJSONPathErr.Error()))
35+
}
36+
37+
path, err := yamlpath.NewPath(target)
38+
return mustExecute(path), err
39+
}
40+
41+
func (o *Overlay) UsesRFC9535() bool {
42+
return o.JSONPathVersion == "rfc9535"
43+
}
44+
45+
func mustExecute(path *yamlpath.Path) yamlPathQueryable {
46+
return yamlPathQueryable{path}
47+
}

pkg/overlay/schema.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ type Extensions map[string]any
1313
type Overlay struct {
1414
Extensions `yaml:"-,inline"`
1515

16-
// Version is the version of the overlay configuration. As the RFC was never
17-
// really ratifies, this value does not mean much.
16+
// Version is the version of the overlay configuration. This is only ever expected to be 1.0.0
1817
Version string `yaml:"overlay"`
1918

19+
// JSONPathVersion should be set to rfc9535, and is used for backwards compatability purposes
20+
JSONPathVersion string `yaml:"x-speakeasy-jsonpath,omitempty"`
21+
2022
// Info describes the metadata for the overlay.
2123
Info Info `yaml:"info"`
2224

pkg/overlay/testdata/openapi-overlayed.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ tags:
4646
- name: orders
4747
description: The orders endpoints.
4848
- name: authentication
49-
description: The authentication endpoints.
49+
x-something: else
5050
- name: config
5151
- name: Testing
5252
description: just a description

pkg/overlay/testdata/openapi-strict-onechange.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ tags:
4747
description: The orders endpoints.
4848
- name: authentication
4949
description: The authentication endpoints.
50+
x-something: else
5051
- name: config
5152
paths:
5253
x-speakeasy-errors:

0 commit comments

Comments
 (0)