File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ go 1.25.0
55require (
66 github.com/basgys/goxml2json v1.1.1-0.20231018121955-e66ee54ceaad
77 github.com/dlclark/regexp2 v1.11.5
8+ github.com/go-openapi/jsonpointer v0.22.4
89 github.com/goccy/go-yaml v1.19.1
910 github.com/pb33f/jsonpath v0.7.0
1011 github.com/pb33f/libopenapi v0.30.2
@@ -18,6 +19,7 @@ require (
1819 github.com/bahlo/generic-list-go v0.2.0 // indirect
1920 github.com/buger/jsonparser v1.1.1 // indirect
2021 github.com/davecgh/go-spew v1.1.1 // indirect
22+ github.com/go-openapi/swag/jsonname v0.25.4 // indirect
2123 github.com/pb33f/ordered-map/v2 v2.3.0 // indirect
2224 github.com/pmezard/go-difflib v1.0.0 // indirect
2325 golang.org/x/net v0.48.0 // indirect
Original file line number Diff line number Diff line change @@ -11,6 +11,12 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
1111github.com/davecgh/go-spew v1.1.1 /go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38 =
1212github.com/dlclark/regexp2 v1.11.5 h1:Q/sSnsKerHeCkc/jSTNq1oCm7KiVgUMZRDUoRu0JQZQ =
1313github.com/dlclark/regexp2 v1.11.5 /go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8 =
14+ github.com/go-openapi/jsonpointer v0.22.4 h1:dZtK82WlNpVLDW2jlA1YCiVJFVqkED1MegOUy9kR5T4 =
15+ github.com/go-openapi/jsonpointer v0.22.4 /go.mod h1:elX9+UgznpFhgBuaMQ7iu4lvvX1nvNsesQ3oxmYTw80 =
16+ github.com/go-openapi/swag/jsonname v0.25.4 h1:bZH0+MsS03MbnwBXYhuTttMOqk+5KcQ9869Vye1bNHI =
17+ github.com/go-openapi/swag/jsonname v0.25.4 /go.mod h1:GPVEk9CWVhNvWhZgrnvRA6utbAltopbKwDu8mXNUMag =
18+ github.com/go-openapi/testify/v2 v2.0.2 h1:X999g3jeLcoY8qctY/c/Z8iBHTbwLz7R2WXd6Ub6wls =
19+ github.com/go-openapi/testify/v2 v2.0.2 /go.mod h1:HCPmvFFnheKK2BuwSA0TbbdxJ3I16pjwMkYkP4Ywn54 =
1420github.com/goccy/go-yaml v1.19.1 h1:3rG3+v8pkhRqoQ/88NYNMHYVGYztCOCIZ7UQhu7H+NE =
1521github.com/goccy/go-yaml v1.19.1 /go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA =
1622github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE =
Original file line number Diff line number Diff line change @@ -6,14 +6,14 @@ package helpers
66import (
77 "fmt"
88 "strings"
9+
10+ "github.com/go-openapi/jsonpointer"
911)
1012
1113// EscapeJSONPointerSegment escapes a single segment for use in a JSON Pointer (RFC 6901).
1214// It replaces '~' with '~0' and '/' with '~1'.
1315func EscapeJSONPointerSegment (segment string ) string {
14- escaped := strings .ReplaceAll (segment , "~" , "~0" )
15- escaped = strings .ReplaceAll (escaped , "/" , "~1" )
16- return escaped
16+ return jsonpointer .Escape (segment )
1717}
1818
1919// ConstructParameterJSONPointer constructs a full JSON Pointer path for a parameter
You can’t perform that action at this time.
0 commit comments