Skip to content

deck file patch with path lengths > 128 characters #198

@mheap

Description

@mheap

Running deck file patch on an OpenAPI spec where the path is > 128 characters in length throws an error:

# deck file patch -s simple20.yaml -o output20.yaml --selector=$..info --value='version:"2.2.0"' --verbose 2

2024/06/03 11:24:42 "level"=2 "msg"="parsed patch-instruction" "key"="version" "value"="2.2.0"

2024/06/03 11:24:42 "level"=2 "msg"="applying value-flags"
panic: invalid character '?' looking for beginning of object key string

goroutine 1 [running]:
github.com/kong/go-apiops/jsonbasics.ConvertToJSONInterface(0x101364468?)
github.com/kong/go-apiops@v0.1.29/jsonbasics/jsonbasics.go:340 +0x90
github.com/kong/go-apiops/jsonbasics.ConvertToJSONobject(0x14000619bf0?)
github.com/kong/go-apiops@v0.1.29/jsonbasics/jsonbasics.go:346 +0x1c
github.com/kong/deck/cmd.executePatch(0x140004a2c00?, {0x14000461100?, 0x0, 0x8})
github.com/kong/deck/cmd/file_patch.go:102 +0x8b0
github.com/spf13/cobra.(*Command).execute(0x140004bf800, {0x14000461080, 0x8, 0x8})
github.com/spf13/cobra@v1.8.0/command.go:983 +0x840
github.com/spf13/cobra.(*Command).ExecuteC(0x14000442000)
github.com/spf13/cobra@v1.8.0/command.go:1115 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
github.com/spf13/cobra@v1.8.0/command.go:1039
github.com/spf13/cobra.(*Command).ExecuteContext(...)
github.com/spf13/cobra@v1.8.0/command.go:1032
github.com/kong/deck/cmd.Execute({0x1013615e0?, 0x14000393db0})
github.com/kong/deck/cmd/root.go:264 +0x68
main.main()
github.com/kong/deck/main.go:31 +0x20

Related GH issues:

go-yaml/yaml#1031
go-yaml/yaml#849

Proposed resolution: Fork go-yaml and use our own fork until the upstream PR is accepted

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions