From 1fa8b9d1938c7105c3b11518f274ea80fbc9135f Mon Sep 17 00:00:00 2001 From: AdamMagued Date: Sun, 11 Oct 2026 18:14:20 +0300 Subject: [PATCH 01/14] chore: migrate from gopkg.in/yaml.v3 to go.yaml.in/yaml/v3 --- arazzo/arazzo_order_test.go | 2 +- arazzo/arazzo_test.go | 2 +- arazzo/core/criterion.go | 2 +- arazzo/core/criterion_syncchanges_test.go | 2 +- arazzo/core/criterion_test.go | 2 +- arazzo/core/reusable.go | 2 +- arazzo/core/reusable_test.go | 2 +- arazzo/criterion/condition.go | 2 +- arazzo/requestbody_test.go | 2 +- arazzo/reusable.go | 2 +- arazzo/successaction.go | 2 +- cmd/openapi/commands/openapi/bootstrap.go | 2 +- cmd/openapi/commands/overlay/apply.go | 2 +- cmd/openapi/commands/overlay/compare.go | 2 +- cmd/openapi/go.mod | 4 +-- expression/core/value.go | 2 +- expression/value.go | 2 +- expression/value_test.go | 2 +- extensions/core/extensions.go | 2 +- extensions/core/extensions_test.go | 2 +- extensions/extensions.go | 2 +- extensions/extensions_isequal_test.go | 2 +- extensions/extensions_test.go | 2 +- go.mod | 2 +- hashing/hashing.go | 2 +- hashing/hashing_test.go | 2 +- internal/interfaces/interfaces.go | 2 +- internal/interfaces/interfaces_test.go | 2 +- internal/testutils/utils.go | 2 +- internal/testutils/utils_test.go | 2 +- json/json.go | 2 +- json/json_test.go | 2 +- jsonpointer/jsonpointer.go | 2 +- jsonpointer/models_yaml_fallback_test.go | 2 +- jsonpointer/yamlnode.go | 2 +- jsonpointer/yamlnode_test.go | 2 +- jsonschema/oas3/core/jsonschema_test.go | 2 +- jsonschema/oas3/core/xml_test.go | 2 +- jsonschema/oas3/resolution.go | 2 +- jsonschema/oas3/resolution_defs.go | 2 +- jsonschema/oas3/resolution_defs_test.go | 2 +- jsonschema/oas3/resolution_external.go | 2 +- jsonschema/oas3/resolution_external_test.go | 2 +- jsonschema/oas3/resolution_test.go | 2 +- jsonschema/oas3/schema_getters_test.go | 2 +- jsonschema/oas3/schema_isequal_test.go | 2 +- jsonschema/oas3/validation.go | 2 +- linter/config.go | 2 +- linter/config_loader.go | 2 +- linter/fix/engine.go | 2 +- linter/fix/engine_test.go | 2 +- linter/fix/terminal_prompter_test.go | 2 +- linter/format/format_test.go | 2 +- marshaller/coremodel.go | 2 +- marshaller/coremodel_getters_test.go | 2 +- marshaller/coremodel_jsonpath_test.go | 15 ++++++--- marshaller/coremodel_jsonpointer_test.go | 2 +- marshaller/extensions.go | 2 +- marshaller/factory.go | 2 +- marshaller/marshal.go | 2 +- marshaller/model.go | 2 +- marshaller/model_test.go | 2 +- marshaller/node.go | 2 +- marshaller/node_test.go | 2 +- marshaller/nodecollector.go | 2 +- marshaller/nodecollector_test.go | 2 +- marshaller/populator.go | 2 +- marshaller/populator_test.go | 2 +- .../populator_unmarshalextensionmodel_test.go | 2 +- marshaller/sequencedmap.go | 2 +- marshaller/sequencedmap_test.go | 2 +- marshaller/syncer.go | 2 +- marshaller/syncing_test.go | 2 +- marshaller/tests/core/models.go | 2 +- marshaller/tests/models.go | 2 +- marshaller/unmarshaller.go | 2 +- marshaller/unmarshaller_test.go | 2 +- marshaller/unmarshalling_test.go | 2 +- openapi/bootstrap_test.go | 2 +- openapi/core/callbacks.go | 2 +- openapi/core/callbacks_test.go | 2 +- openapi/core/paths.go | 2 +- openapi/core/paths_test.go | 2 +- openapi/core/reference.go | 2 +- openapi/core/reference_test.go | 2 +- openapi/core/responses.go | 2 +- openapi/core/responses_test.go | 2 +- openapi/core/security.go | 2 +- openapi/core/security_test.go | 2 +- openapi/index.go | 2 +- openapi/index_node_operation_test.go | 2 +- openapi/join_test.go | 2 +- openapi/linter/converter/generate.go | 2 +- openapi/linter/converter/generate_test.go | 2 +- openapi/linter/converter/parse.go | 2 +- openapi/linter/customrules/go.mod | 4 +-- openapi/linter/customrules/runtime.go | 2 +- openapi/linter/linter_test.go | 2 +- .../linter/rules/description_duplication.go | 2 +- .../linter/rules/duplicated_entry_in_enum.go | 2 +- openapi/linter/rules/fix_helpers.go | 2 +- openapi/linter/rules/fix_helpers_test.go | 2 +- openapi/linter/rules/fix_integration_test.go | 2 +- openapi/linter/rules/host_trailing_slash.go | 2 +- openapi/linter/rules/markdown_descriptions.go | 2 +- openapi/linter/rules/oas3_no_nullable.go | 2 +- openapi/linter/rules/oas_schema_check.go | 2 +- .../rules/operation_success_response.go | 2 +- .../linter/rules/owasp_jwt_best_practices.go | 2 +- .../rules/owasp_no_additional_properties.go | 2 +- .../rules/owasp_security_hosts_https_oas3.go | 2 +- openapi/linter/rules/path_trailing_slash.go | 2 +- openapi/linter/rules/rule_fixes_test.go | 2 +- openapi/linter/rules/tags_alphabetical.go | 2 +- openapi/linter/rules/typed_enum.go | 2 +- openapi/linter/rules/unused_components.go | 2 +- openapi/localize.go | 2 +- openapi/openapi.go | 2 +- openapi/reference.go | 2 +- openapi/sanitize.go | 2 +- openapi/upgrade.go | 2 +- openapi/upgrade_test.go | 2 +- oq/foldedscalar_format_test.go | 2 +- oq/format.go | 2 +- overlay/README.md | 2 +- overlay/apply.go | 2 +- overlay/apply_test.go | 8 +++-- overlay/compare.go | 2 +- overlay/compare_test.go | 2 +- overlay/foldedscalar_test.go | 2 +- overlay/format_test.go | 2 +- overlay/jsonpath.go | 32 ++++++++++++++++--- overlay/loader/spec.go | 2 +- overlay/loader/spec_test.go | 2 +- overlay/overlay_examples_test.go | 2 +- overlay/parents.go | 2 +- overlay/parse.go | 2 +- overlay/schema.go | 2 +- overlay/upgrade_test.go | 2 +- overlay/utils.go | 2 +- overlay/utils_test.go | 2 +- overlay/validate_test.go | 2 +- references/resolution.go | 2 +- references/resolution_test.go | 2 +- sequencedmap/map.go | 2 +- sequencedmap/map_advanced_test.go | 2 +- sequencedmap/yaml_unmarshal_test.go | 2 +- sortfmt/edge_cases_test.go | 2 +- sortfmt/format.go | 2 +- sortfmt/format_test.go | 2 +- sortfmt/writer.go | 2 +- swagger/core/paths.go | 2 +- swagger/core/paths_test.go | 2 +- swagger/core/reference.go | 2 +- swagger/core/reference_test.go | 2 +- swagger/core/response.go | 2 +- swagger/core/response_test.go | 2 +- swagger/roundtrip_test.go | 2 +- validation/errors.go | 2 +- validation/fix.go | 2 +- validation/utils_test.go | 2 +- validation/validation_test.go | 2 +- values/core/eithervalue.go | 2 +- values/core/eithervalue_test.go | 2 +- values/core/value.go | 2 +- values/value.go | 2 +- yml/config.go | 2 +- yml/config_test.go | 2 +- yml/foldedscalar.go | 4 +-- yml/foldedscalar_test.go | 4 +-- yml/nodekind.go | 2 +- yml/nodekind_test.go | 2 +- yml/walk.go | 2 +- yml/walk_test.go | 2 +- yml/yml.go | 2 +- yml/yml_test.go | 2 +- 176 files changed, 220 insertions(+), 189 deletions(-) diff --git a/arazzo/arazzo_order_test.go b/arazzo/arazzo_order_test.go index fcebe7d6..2e9cfffc 100644 --- a/arazzo/arazzo_order_test.go +++ b/arazzo/arazzo_order_test.go @@ -10,7 +10,7 @@ import ( "github.com/speakeasy-api/openapi/expression" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestArazzo_ArrayOrdering_ReorderWorkflows_Success(t *testing.T) { diff --git a/arazzo/arazzo_test.go b/arazzo/arazzo_test.go index 506c27fe..2f0f1b52 100644 --- a/arazzo/arazzo_test.go +++ b/arazzo/arazzo_test.go @@ -25,7 +25,7 @@ import ( "github.com/speakeasy-api/openapi/yml" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // TODO make it possible to choose json or yaml output diff --git a/arazzo/core/criterion.go b/arazzo/core/criterion.go index 50b3c9ef..7903bc6b 100644 --- a/arazzo/core/criterion.go +++ b/arazzo/core/criterion.go @@ -11,7 +11,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/speakeasy-api/openapi/validation" "github.com/speakeasy-api/openapi/yml" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type CriterionExpressionType struct { diff --git a/arazzo/core/criterion_syncchanges_test.go b/arazzo/core/criterion_syncchanges_test.go index 7c02ef96..5ba88eb8 100644 --- a/arazzo/core/criterion_syncchanges_test.go +++ b/arazzo/core/criterion_syncchanges_test.go @@ -6,7 +6,7 @@ import ( "github.com/speakeasy-api/openapi/pointer" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestCriterionTypeUnion_SyncChanges_WithStringType_Success(t *testing.T) { diff --git a/arazzo/core/criterion_test.go b/arazzo/core/criterion_test.go index fb35a1d5..b159ea40 100644 --- a/arazzo/core/criterion_test.go +++ b/arazzo/core/criterion_test.go @@ -7,7 +7,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/speakeasy-api/openapi/pointer" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func createCriterionWithRootNode(c Criterion, rootNode *yaml.Node) Criterion { diff --git a/arazzo/core/reusable.go b/arazzo/core/reusable.go index c9022a16..db91ecdb 100644 --- a/arazzo/core/reusable.go +++ b/arazzo/core/reusable.go @@ -11,7 +11,7 @@ import ( "github.com/speakeasy-api/openapi/validation" values "github.com/speakeasy-api/openapi/values/core" "github.com/speakeasy-api/openapi/yml" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type Reusable[T marshaller.CoreModeler] struct { diff --git a/arazzo/core/reusable_test.go b/arazzo/core/reusable_test.go index 96aeea43..bdebba07 100644 --- a/arazzo/core/reusable_test.go +++ b/arazzo/core/reusable_test.go @@ -5,7 +5,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestReusable_Unmarshal_WithReference_Success(t *testing.T) { diff --git a/arazzo/criterion/condition.go b/arazzo/criterion/condition.go index 1289a91c..137b709d 100644 --- a/arazzo/criterion/condition.go +++ b/arazzo/criterion/condition.go @@ -7,7 +7,7 @@ import ( "github.com/speakeasy-api/openapi/expression" "github.com/speakeasy-api/openapi/validation" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // Operator represents the operator used to compare the value of a criterion. diff --git a/arazzo/requestbody_test.go b/arazzo/requestbody_test.go index 8f8cbe7b..1f18ce89 100644 --- a/arazzo/requestbody_test.go +++ b/arazzo/requestbody_test.go @@ -8,7 +8,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/speakeasy-api/openapi/pointer" "github.com/stretchr/testify/assert" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestRequestBody_Validate_JSONPathInPayload_Success(t *testing.T) { diff --git a/arazzo/reusable.go b/arazzo/reusable.go index d7a2c0a0..78c804ec 100644 --- a/arazzo/reusable.go +++ b/arazzo/reusable.go @@ -15,7 +15,7 @@ import ( "github.com/speakeasy-api/openapi/sequencedmap" "github.com/speakeasy-api/openapi/validation" "github.com/speakeasy-api/openapi/values" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type ( diff --git a/arazzo/successaction.go b/arazzo/successaction.go index 8fc3e5e0..70ed3cb5 100644 --- a/arazzo/successaction.go +++ b/arazzo/successaction.go @@ -15,7 +15,7 @@ import ( "github.com/speakeasy-api/openapi/pointer" "github.com/speakeasy-api/openapi/validation" walkpkg "github.com/speakeasy-api/openapi/walk" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // SuccessActionType represents the type of action to take on success. diff --git a/cmd/openapi/commands/openapi/bootstrap.go b/cmd/openapi/commands/openapi/bootstrap.go index 6ab6313a..112caa38 100644 --- a/cmd/openapi/commands/openapi/bootstrap.go +++ b/cmd/openapi/commands/openapi/bootstrap.go @@ -8,7 +8,7 @@ import ( "github.com/speakeasy-api/openapi/openapi" "github.com/speakeasy-api/openapi/yml" "github.com/spf13/cobra" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) var bootstrapCmd = &cobra.Command{ diff --git a/cmd/openapi/commands/overlay/apply.go b/cmd/openapi/commands/overlay/apply.go index 342c7167..0464da1a 100644 --- a/cmd/openapi/commands/overlay/apply.go +++ b/cmd/openapi/commands/overlay/apply.go @@ -8,7 +8,7 @@ import ( overlayPkg "github.com/speakeasy-api/openapi/overlay" "github.com/speakeasy-api/openapi/overlay/loader" "github.com/spf13/cobra" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) var ( diff --git a/cmd/openapi/commands/overlay/compare.go b/cmd/openapi/commands/overlay/compare.go index 630bc5c4..0ed303b9 100644 --- a/cmd/openapi/commands/overlay/compare.go +++ b/cmd/openapi/commands/overlay/compare.go @@ -8,7 +8,7 @@ import ( overlayPkg "github.com/speakeasy-api/openapi/overlay" "github.com/speakeasy-api/openapi/overlay/loader" "github.com/spf13/cobra" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) var ( diff --git a/cmd/openapi/go.mod b/cmd/openapi/go.mod index 7bd62573..ff23d2b0 100644 --- a/cmd/openapi/go.mod +++ b/cmd/openapi/go.mod @@ -10,7 +10,7 @@ require ( github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261006003233-cb82fbf0afec github.com/spf13/cobra v1.10.2 github.com/stretchr/testify v1.12.1 - gopkg.in/yaml.v3 v3.0.1 + go.yaml.in/yaml/v3 v3.0.5 ) require ( @@ -40,8 +40,8 @@ require ( github.com/spf13/pflag v1.0.9 // indirect github.com/vmware-labs/yaml-jsonpath v0.3.2 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect - go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sync v0.23.0 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/text v0.42.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/expression/core/value.go b/expression/core/value.go index 69effc25..5450a99b 100644 --- a/expression/core/value.go +++ b/expression/core/value.go @@ -1,5 +1,5 @@ package core -import "gopkg.in/yaml.v3" +import "go.yaml.in/yaml/v3" type ValueOrExpression = *yaml.Node diff --git a/expression/value.go b/expression/value.go index b549b637..47c74501 100644 --- a/expression/value.go +++ b/expression/value.go @@ -1,7 +1,7 @@ package expression import ( - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // ValueOrExpression represents a raw value or expression in the Arazzo document. diff --git a/expression/value_test.go b/expression/value_test.go index bf125345..81183db0 100644 --- a/expression/value_test.go +++ b/expression/value_test.go @@ -6,7 +6,7 @@ import ( "github.com/speakeasy-api/openapi/expression" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestGetValueOrExpressionValue_Success(t *testing.T) { diff --git a/extensions/core/extensions.go b/extensions/core/extensions.go index 333c4348..ce1f035b 100644 --- a/extensions/core/extensions.go +++ b/extensions/core/extensions.go @@ -5,7 +5,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/speakeasy-api/openapi/sequencedmap" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type ( diff --git a/extensions/core/extensions_test.go b/extensions/core/extensions_test.go index f2156518..85ace23d 100644 --- a/extensions/core/extensions_test.go +++ b/extensions/core/extensions_test.go @@ -11,7 +11,7 @@ import ( "github.com/speakeasy-api/openapi/sequencedmap" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type TestCoreModel struct { diff --git a/extensions/extensions.go b/extensions/extensions.go index c527701c..5564734b 100644 --- a/extensions/extensions.go +++ b/extensions/extensions.go @@ -10,7 +10,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/speakeasy-api/openapi/sequencedmap" "github.com/speakeasy-api/openapi/yml" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) const ( diff --git a/extensions/extensions_isequal_test.go b/extensions/extensions_isequal_test.go index a8852dda..109d0f88 100644 --- a/extensions/extensions_isequal_test.go +++ b/extensions/extensions_isequal_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/stretchr/testify/assert" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestExtensions_IsEqual_Success(t *testing.T) { diff --git a/extensions/extensions_test.go b/extensions/extensions_test.go index 88c1e0ec..fd6cc55a 100644 --- a/extensions/extensions_test.go +++ b/extensions/extensions_test.go @@ -13,7 +13,7 @@ import ( "github.com/speakeasy-api/openapi/sequencedmap" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type ModelWithExtensions struct { diff --git a/go.mod b/go.mod index 9a57dc30..b3f4aed4 100644 --- a/go.mod +++ b/go.mod @@ -10,6 +10,7 @@ require ( github.com/vmware-labs/yaml-jsonpath v0.3.2 golang.org/x/sync v0.23.0 golang.org/x/text v0.42.0 + go.yaml.in/yaml/v3 v3.0.5 gopkg.in/yaml.v3 v3.0.1 ) @@ -18,7 +19,6 @@ require ( github.com/dprotaso/go-yit v0.0.0-20191028211022-135eb7262960 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/rogpeppe/go-internal v1.14.1 // indirect - go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/net v0.56.0 // indirect golang.org/x/sys v0.47.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect diff --git a/hashing/hashing.go b/hashing/hashing.go index 7fd99955..e0a26062 100644 --- a/hashing/hashing.go +++ b/hashing/hashing.go @@ -9,7 +9,7 @@ import ( "strings" "github.com/speakeasy-api/openapi/internal/interfaces" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func Hash(v any) string { diff --git a/hashing/hashing_test.go b/hashing/hashing_test.go index e18bae7d..de20fdb3 100644 --- a/hashing/hashing_test.go +++ b/hashing/hashing_test.go @@ -14,7 +14,7 @@ import ( "github.com/speakeasy-api/openapi/yml" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type testEnum string diff --git a/internal/interfaces/interfaces.go b/internal/interfaces/interfaces.go index e7494d79..2f09829f 100644 --- a/internal/interfaces/interfaces.go +++ b/internal/interfaces/interfaces.go @@ -6,7 +6,7 @@ import ( "reflect" "github.com/speakeasy-api/openapi/validation" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type Validator[T any] interface { diff --git a/internal/interfaces/interfaces_test.go b/internal/interfaces/interfaces_test.go index 0dc1a45a..66716ae4 100644 --- a/internal/interfaces/interfaces_test.go +++ b/internal/interfaces/interfaces_test.go @@ -8,7 +8,7 @@ import ( "github.com/speakeasy-api/openapi/validation" "github.com/stretchr/testify/assert" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // Test implementations for Model interface diff --git a/internal/testutils/utils.go b/internal/testutils/utils.go index acc48161..79efa950 100644 --- a/internal/testutils/utils.go +++ b/internal/testutils/utils.go @@ -15,7 +15,7 @@ import ( "github.com/speakeasy-api/openapi/yml" "github.com/stretchr/testify/assert" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // TODO use these more in tests diff --git a/internal/testutils/utils_test.go b/internal/testutils/utils_test.go index e4f7ba06..c12a2b2b 100644 --- a/internal/testutils/utils_test.go +++ b/internal/testutils/utils_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/stretchr/testify/assert" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestCreateStringYamlNode_Success(t *testing.T) { diff --git a/json/json.go b/json/json.go index 87f14e29..3996e6a6 100644 --- a/json/json.go +++ b/json/json.go @@ -9,7 +9,7 @@ import ( "strings" "github.com/speakeasy-api/openapi/yml" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // YAMLToJSON converts a YAML node to JSON using a custom JSON writer that preserves formatting. diff --git a/json/json_test.go b/json/json_test.go index ab2f868a..a5fc1d8f 100644 --- a/json/json_test.go +++ b/json/json_test.go @@ -7,7 +7,7 @@ import ( "github.com/speakeasy-api/openapi/json" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestYAMLToJSON_Success(t *testing.T) { diff --git a/jsonpointer/jsonpointer.go b/jsonpointer/jsonpointer.go index 3abb7d02..0c992d5f 100644 --- a/jsonpointer/jsonpointer.go +++ b/jsonpointer/jsonpointer.go @@ -9,7 +9,7 @@ import ( "github.com/speakeasy-api/openapi/errors" "github.com/speakeasy-api/openapi/internal/interfaces" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) const ( diff --git a/jsonpointer/models_yaml_fallback_test.go b/jsonpointer/models_yaml_fallback_test.go index 5f175134..af876409 100644 --- a/jsonpointer/models_yaml_fallback_test.go +++ b/jsonpointer/models_yaml_fallback_test.go @@ -7,7 +7,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // TestModel represents a simple model for testing YAML fallback diff --git a/jsonpointer/yamlnode.go b/jsonpointer/yamlnode.go index 541294fe..997dd4c1 100644 --- a/jsonpointer/yamlnode.go +++ b/jsonpointer/yamlnode.go @@ -4,7 +4,7 @@ import ( "fmt" "strconv" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func getYamlNodeTarget(node *yaml.Node, currentPart navigationPart, stack []navigationPart, currentPath string, o *options) (any, []navigationPart, error) { diff --git a/jsonpointer/yamlnode_test.go b/jsonpointer/yamlnode_test.go index b94cc502..315f7371 100644 --- a/jsonpointer/yamlnode_test.go +++ b/jsonpointer/yamlnode_test.go @@ -5,7 +5,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestGetTarget_YamlNode_Success(t *testing.T) { diff --git a/jsonschema/oas3/core/jsonschema_test.go b/jsonschema/oas3/core/jsonschema_test.go index 297fe11f..78dd94dc 100644 --- a/jsonschema/oas3/core/jsonschema_test.go +++ b/jsonschema/oas3/core/jsonschema_test.go @@ -6,7 +6,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestJSONSchema_Unmarshal_BooleanValue_Success(t *testing.T) { diff --git a/jsonschema/oas3/core/xml_test.go b/jsonschema/oas3/core/xml_test.go index 493a8b86..ee462ff7 100644 --- a/jsonschema/oas3/core/xml_test.go +++ b/jsonschema/oas3/core/xml_test.go @@ -6,7 +6,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func parseYAML(t *testing.T, yml string) *yaml.Node { diff --git a/jsonschema/oas3/resolution.go b/jsonschema/oas3/resolution.go index d4b5874f..9a451996 100644 --- a/jsonschema/oas3/resolution.go +++ b/jsonschema/oas3/resolution.go @@ -9,7 +9,7 @@ import ( "github.com/speakeasy-api/openapi/internal/utils" "github.com/speakeasy-api/openapi/marshaller" "github.com/speakeasy-api/openapi/references" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // ResolveOptions represent the options available when resolving a JSON Schema reference. diff --git a/jsonschema/oas3/resolution_defs.go b/jsonschema/oas3/resolution_defs.go index 97b09daf..4d7dd86f 100644 --- a/jsonschema/oas3/resolution_defs.go +++ b/jsonschema/oas3/resolution_defs.go @@ -8,7 +8,7 @@ import ( "github.com/speakeasy-api/openapi/internal/utils" "github.com/speakeasy-api/openapi/jsonpointer" "github.com/speakeasy-api/openapi/references" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // GetRootNoder is an interface for objects that can return a YAML root node. diff --git a/jsonschema/oas3/resolution_defs_test.go b/jsonschema/oas3/resolution_defs_test.go index e6ff438a..c3a47866 100644 --- a/jsonschema/oas3/resolution_defs_test.go +++ b/jsonschema/oas3/resolution_defs_test.go @@ -7,7 +7,7 @@ import ( "github.com/speakeasy-api/openapi/references" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestTryResolveLocalDefs_NilAndBooleanSchema(t *testing.T) { diff --git a/jsonschema/oas3/resolution_external.go b/jsonschema/oas3/resolution_external.go index a97d1896..3dc116fb 100644 --- a/jsonschema/oas3/resolution_external.go +++ b/jsonschema/oas3/resolution_external.go @@ -9,7 +9,7 @@ import ( "github.com/speakeasy-api/openapi/jsonpointer" "github.com/speakeasy-api/openapi/marshaller" "github.com/speakeasy-api/openapi/references" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // resolveExternalAnchorReference handles resolution of anchor references (e.g., "file.json#anchor") diff --git a/jsonschema/oas3/resolution_external_test.go b/jsonschema/oas3/resolution_external_test.go index ead1e742..fc94d7a3 100644 --- a/jsonschema/oas3/resolution_external_test.go +++ b/jsonschema/oas3/resolution_external_test.go @@ -10,7 +10,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestResolveExternalAnchorReference_Success(t *testing.T) { diff --git a/jsonschema/oas3/resolution_test.go b/jsonschema/oas3/resolution_test.go index 5100bb26..dd8387fc 100644 --- a/jsonschema/oas3/resolution_test.go +++ b/jsonschema/oas3/resolution_test.go @@ -18,7 +18,7 @@ import ( "github.com/speakeasy-api/openapi/references" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // MockResolutionTarget implements references.ResolutionTarget for testing diff --git a/jsonschema/oas3/schema_getters_test.go b/jsonschema/oas3/schema_getters_test.go index 064e7929..4ea191d7 100644 --- a/jsonschema/oas3/schema_getters_test.go +++ b/jsonschema/oas3/schema_getters_test.go @@ -10,7 +10,7 @@ import ( "github.com/speakeasy-api/openapi/sequencedmap" "github.com/speakeasy-api/openapi/values" "github.com/stretchr/testify/assert" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestSchema_NilOptionalGetters_ReturnDefaults(t *testing.T) { diff --git a/jsonschema/oas3/schema_isequal_test.go b/jsonschema/oas3/schema_isequal_test.go index 53abf8f0..851f8cdc 100644 --- a/jsonschema/oas3/schema_isequal_test.go +++ b/jsonschema/oas3/schema_isequal_test.go @@ -9,7 +9,7 @@ import ( "github.com/speakeasy-api/openapi/sequencedmap" "github.com/speakeasy-api/openapi/values" "github.com/stretchr/testify/assert" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestSchema_IsEqual_Success(t *testing.T) { diff --git a/jsonschema/oas3/validation.go b/jsonschema/oas3/validation.go index 07716155..a44e65d4 100644 --- a/jsonschema/oas3/validation.go +++ b/jsonschema/oas3/validation.go @@ -19,7 +19,7 @@ import ( "github.com/speakeasy-api/openapi/validation" "golang.org/x/text/language" "golang.org/x/text/message" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // custom file to cover for missing openapi 3.0 json schema diff --git a/linter/config.go b/linter/config.go index 97d199e7..22b4a543 100644 --- a/linter/config.go +++ b/linter/config.go @@ -9,7 +9,7 @@ import ( "github.com/speakeasy-api/openapi/references" "github.com/speakeasy-api/openapi/validation" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // Config represents the linter configuration diff --git a/linter/config_loader.go b/linter/config_loader.go index 0400cdf1..d2743081 100644 --- a/linter/config_loader.go +++ b/linter/config_loader.go @@ -5,7 +5,7 @@ import ( "io" "os" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // LoadConfig loads lint configuration from a YAML reader. diff --git a/linter/fix/engine.go b/linter/fix/engine.go index c0cb5025..e4610430 100644 --- a/linter/fix/engine.go +++ b/linter/fix/engine.go @@ -7,7 +7,7 @@ import ( "github.com/speakeasy-api/openapi/openapi" "github.com/speakeasy-api/openapi/validation" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // Mode controls how fixes are applied. diff --git a/linter/fix/engine_test.go b/linter/fix/engine_test.go index 1606c669..17181a3e 100644 --- a/linter/fix/engine_test.go +++ b/linter/fix/engine_test.go @@ -9,7 +9,7 @@ import ( "github.com/speakeasy-api/openapi/validation" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // mockFix is a non-interactive fix for testing. diff --git a/linter/fix/terminal_prompter_test.go b/linter/fix/terminal_prompter_test.go index 3c8e0232..b9bc1be5 100644 --- a/linter/fix/terminal_prompter_test.go +++ b/linter/fix/terminal_prompter_test.go @@ -11,7 +11,7 @@ import ( "github.com/speakeasy-api/openapi/validation" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestTerminalPrompter_Choice_Success(t *testing.T) { diff --git a/linter/format/format_test.go b/linter/format/format_test.go index ed42e411..8c7be52e 100644 --- a/linter/format/format_test.go +++ b/linter/format/format_test.go @@ -10,7 +10,7 @@ import ( "github.com/speakeasy-api/openapi/validation" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // testFix is a minimal validation.Fix for testing formatter output. diff --git a/marshaller/coremodel.go b/marshaller/coremodel.go index 8ea33f6a..2ded820a 100644 --- a/marshaller/coremodel.go +++ b/marshaller/coremodel.go @@ -11,7 +11,7 @@ import ( "github.com/speakeasy-api/openapi/json" "github.com/speakeasy-api/openapi/validation" "github.com/speakeasy-api/openapi/yml" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type CoreModeler interface { diff --git a/marshaller/coremodel_getters_test.go b/marshaller/coremodel_getters_test.go index db1c035b..d7afba65 100644 --- a/marshaller/coremodel_getters_test.go +++ b/marshaller/coremodel_getters_test.go @@ -5,7 +5,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/stretchr/testify/assert" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestCoreModel_GetRootNodeLine_Success(t *testing.T) { diff --git a/marshaller/coremodel_jsonpath_test.go b/marshaller/coremodel_jsonpath_test.go index 5e4903ea..77728aa1 100644 --- a/marshaller/coremodel_jsonpath_test.go +++ b/marshaller/coremodel_jsonpath_test.go @@ -7,7 +7,9 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" + legacyYaml "gopkg.in/yaml.v3" + "unsafe" ) func TestCoreModel_GetJSONPath_Success(t *testing.T) { @@ -178,12 +180,13 @@ func findNodeByJSONPath(t *testing.T, rootNode *yaml.Node, jsonPath string) *yam require.NoError(t, err, "JSONPath should be valid: %s", jsonPath) // Query the YAML node directly - result := path.Query(rootNode) + legacyRoot := (*legacyYaml.Node)(unsafe.Pointer(rootNode)) + result := path.Query(legacyRoot) require.NotEmpty(t, result, "JSONPath query should return results: %s", jsonPath) // The result should be a slice of *yaml.Node, so return the first one if len(result) > 0 { - return result[0] + return (*yaml.Node)(unsafe.Pointer(result[0])) } return nil } @@ -196,7 +199,8 @@ func verifyJSONPathWorks(t *testing.T, rootNode *yaml.Node, jsonPath string, exp path, err := jsonpath.NewPath(jsonPath) require.NoError(t, err, "generated JSONPath should be valid: %s", jsonPath) - result := path.Query(rootNode) + legacyRoot := (*legacyYaml.Node)(unsafe.Pointer(rootNode)) + result := path.Query(legacyRoot) require.NotEmpty(t, result, "JSONPath query should return results: %s", jsonPath) // Special case for root node: the query might return the document node @@ -210,8 +214,9 @@ func verifyJSONPathWorks(t *testing.T, rootNode *yaml.Node, jsonPath string, exp // Verify the result contains our expected node // The result is a slice of nodes, so we check if our target node is in there found := false + legacyExpected := (*legacyYaml.Node)(unsafe.Pointer(expectedNode)) for _, node := range result { - if node == expectedNode { + if node == legacyExpected { found = true break } diff --git a/marshaller/coremodel_jsonpointer_test.go b/marshaller/coremodel_jsonpointer_test.go index f4d34bfa..85310e3f 100644 --- a/marshaller/coremodel_jsonpointer_test.go +++ b/marshaller/coremodel_jsonpointer_test.go @@ -9,7 +9,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestCoreModel_GetJSONPointer_Success(t *testing.T) { diff --git a/marshaller/extensions.go b/marshaller/extensions.go index 4f62ed60..670e044d 100644 --- a/marshaller/extensions.go +++ b/marshaller/extensions.go @@ -9,7 +9,7 @@ import ( "unsafe" "github.com/speakeasy-api/openapi/yml" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type Extension = *yaml.Node diff --git a/marshaller/factory.go b/marshaller/factory.go index d9713980..2a682d49 100644 --- a/marshaller/factory.go +++ b/marshaller/factory.go @@ -7,7 +7,7 @@ import ( "sync" "github.com/speakeasy-api/openapi/sequencedmap" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // TypeFactory represents a function that creates a new instance of a specific type diff --git a/marshaller/marshal.go b/marshaller/marshal.go index 8924231a..6bde7118 100644 --- a/marshaller/marshal.go +++ b/marshaller/marshal.go @@ -6,7 +6,7 @@ import ( "io" "github.com/speakeasy-api/openapi/yml" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // Marshallable represents a high-level model that can be marshaled diff --git a/marshaller/model.go b/marshaller/model.go index ec7feae7..4d382cb8 100644 --- a/marshaller/model.go +++ b/marshaller/model.go @@ -4,7 +4,7 @@ import ( "reflect" "sync" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // CoreAccessor provides type-safe access to the core field in models diff --git a/marshaller/model_test.go b/marshaller/model_test.go index 1e1822c1..b08556a9 100644 --- a/marshaller/model_test.go +++ b/marshaller/model_test.go @@ -6,7 +6,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/speakeasy-api/openapi/marshaller/tests/core" "github.com/stretchr/testify/assert" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // TestModel_GetPropertyNode_Success tests the GetPropertyNode method with valid inputs diff --git a/marshaller/node.go b/marshaller/node.go index f6190795..32b72caa 100644 --- a/marshaller/node.go +++ b/marshaller/node.go @@ -5,7 +5,7 @@ import ( "reflect" "github.com/speakeasy-api/openapi/yml" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type NodeMutator interface { diff --git a/marshaller/node_test.go b/marshaller/node_test.go index d0085b03..4faa6ec9 100644 --- a/marshaller/node_test.go +++ b/marshaller/node_test.go @@ -5,7 +5,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type testCase[T any] struct { diff --git a/marshaller/nodecollector.go b/marshaller/nodecollector.go index 39d1b5e2..c44efc71 100644 --- a/marshaller/nodecollector.go +++ b/marshaller/nodecollector.go @@ -3,7 +3,7 @@ package marshaller import ( "reflect" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // NodeCollector provides utilities for collecting yaml.Node pointers from core models. diff --git a/marshaller/nodecollector_test.go b/marshaller/nodecollector_test.go index edc24445..97910d6a 100644 --- a/marshaller/nodecollector_test.go +++ b/marshaller/nodecollector_test.go @@ -6,7 +6,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // Test models to verify CollectLeafNodes behavior diff --git a/marshaller/populator.go b/marshaller/populator.go index d5b75eb5..15ca1b8b 100644 --- a/marshaller/populator.go +++ b/marshaller/populator.go @@ -5,7 +5,7 @@ import ( "reflect" "github.com/speakeasy-api/openapi/internal/interfaces" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // Pre-computed reflection types for performance diff --git a/marshaller/populator_test.go b/marshaller/populator_test.go index f26ed688..bae189f2 100644 --- a/marshaller/populator_test.go +++ b/marshaller/populator_test.go @@ -9,7 +9,7 @@ import ( "github.com/speakeasy-api/openapi/yml" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestPopulateWithContext_YAMLNode_Success(t *testing.T) { diff --git a/marshaller/populator_unmarshalextensionmodel_test.go b/marshaller/populator_unmarshalextensionmodel_test.go index 6f3e422b..7928901b 100644 --- a/marshaller/populator_unmarshalextensionmodel_test.go +++ b/marshaller/populator_unmarshalextensionmodel_test.go @@ -11,7 +11,7 @@ import ( "github.com/speakeasy-api/openapi/sequencedmap" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func init() { diff --git a/marshaller/sequencedmap.go b/marshaller/sequencedmap.go index 7ca7e248..0c33fc22 100644 --- a/marshaller/sequencedmap.go +++ b/marshaller/sequencedmap.go @@ -13,7 +13,7 @@ import ( "github.com/speakeasy-api/openapi/validation" "github.com/speakeasy-api/openapi/yml" "golang.org/x/sync/errgroup" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // MapGetter interface for syncing operations diff --git a/marshaller/sequencedmap_test.go b/marshaller/sequencedmap_test.go index e4aa0767..672b3c04 100644 --- a/marshaller/sequencedmap_test.go +++ b/marshaller/sequencedmap_test.go @@ -8,7 +8,7 @@ import ( "github.com/speakeasy-api/openapi/sequencedmap" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // SequencedMap test case for successful operations diff --git a/marshaller/syncer.go b/marshaller/syncer.go index ea529340..f3392076 100644 --- a/marshaller/syncer.go +++ b/marshaller/syncer.go @@ -7,7 +7,7 @@ import ( "github.com/speakeasy-api/openapi/internal/interfaces" "github.com/speakeasy-api/openapi/yml" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type Syncer interface { diff --git a/marshaller/syncing_test.go b/marshaller/syncing_test.go index 3ea0d242..26fa3422 100644 --- a/marshaller/syncing_test.go +++ b/marshaller/syncing_test.go @@ -12,7 +12,7 @@ import ( "github.com/speakeasy-api/openapi/sequencedmap" "github.com/speakeasy-api/openapi/values" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestSync_PrimitiveTypes_Success(t *testing.T) { diff --git a/marshaller/tests/core/models.go b/marshaller/tests/core/models.go index a624300e..2931b3a4 100644 --- a/marshaller/tests/core/models.go +++ b/marshaller/tests/core/models.go @@ -8,7 +8,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/speakeasy-api/openapi/sequencedmap" valuescore "github.com/speakeasy-api/openapi/values/core" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // TestPrimitiveModel covers all primitive marshaller.Node field types diff --git a/marshaller/tests/models.go b/marshaller/tests/models.go index 4c699211..35bda40a 100644 --- a/marshaller/tests/models.go +++ b/marshaller/tests/models.go @@ -7,7 +7,7 @@ import ( "github.com/speakeasy-api/openapi/sequencedmap" "github.com/speakeasy-api/openapi/values" valuescore "github.com/speakeasy-api/openapi/values/core" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // High-level model counterparts for population testing using marshaller.Model diff --git a/marshaller/unmarshaller.go b/marshaller/unmarshaller.go index b0f6ffef..c32b7e29 100644 --- a/marshaller/unmarshaller.go +++ b/marshaller/unmarshaller.go @@ -13,7 +13,7 @@ import ( "github.com/speakeasy-api/openapi/validation" "github.com/speakeasy-api/openapi/yml" "golang.org/x/sync/errgroup" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // Pre-computed reflection types for performance (reusing from populator.go where possible) diff --git a/marshaller/unmarshaller_test.go b/marshaller/unmarshaller_test.go index 97fd240f..13081f21 100644 --- a/marshaller/unmarshaller_test.go +++ b/marshaller/unmarshaller_test.go @@ -12,7 +12,7 @@ import ( "github.com/speakeasy-api/openapi/yml" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestUnmarshal_DocumentInput_Error(t *testing.T) { diff --git a/marshaller/unmarshalling_test.go b/marshaller/unmarshalling_test.go index 021df20a..09c574f7 100644 --- a/marshaller/unmarshalling_test.go +++ b/marshaller/unmarshalling_test.go @@ -10,7 +10,7 @@ import ( "github.com/speakeasy-api/openapi/validation" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestUnmarshal_PrimitiveTypes_Success(t *testing.T) { diff --git a/openapi/bootstrap_test.go b/openapi/bootstrap_test.go index 8c1309f2..4e9ed7ae 100644 --- a/openapi/bootstrap_test.go +++ b/openapi/bootstrap_test.go @@ -9,7 +9,7 @@ import ( "github.com/speakeasy-api/openapi/yml" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestBootstrap_Success(t *testing.T) { diff --git a/openapi/core/callbacks.go b/openapi/core/callbacks.go index 38c8df6c..41928d7c 100644 --- a/openapi/core/callbacks.go +++ b/openapi/core/callbacks.go @@ -4,7 +4,7 @@ import ( "github.com/speakeasy-api/openapi/extensions/core" "github.com/speakeasy-api/openapi/marshaller" "github.com/speakeasy-api/openapi/sequencedmap" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type Callback struct { diff --git a/openapi/core/callbacks_test.go b/openapi/core/callbacks_test.go index 0a3795a5..b2754986 100644 --- a/openapi/core/callbacks_test.go +++ b/openapi/core/callbacks_test.go @@ -6,7 +6,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestNewCallback_Success(t *testing.T) { diff --git a/openapi/core/paths.go b/openapi/core/paths.go index 2a31581c..7329fb18 100644 --- a/openapi/core/paths.go +++ b/openapi/core/paths.go @@ -4,7 +4,7 @@ import ( "github.com/speakeasy-api/openapi/extensions/core" "github.com/speakeasy-api/openapi/marshaller" "github.com/speakeasy-api/openapi/sequencedmap" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type Paths struct { diff --git a/openapi/core/paths_test.go b/openapi/core/paths_test.go index fca396be..1898ec23 100644 --- a/openapi/core/paths_test.go +++ b/openapi/core/paths_test.go @@ -6,7 +6,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestNewPaths_Success(t *testing.T) { diff --git a/openapi/core/reference.go b/openapi/core/reference.go index ee5d2882..ca52f13e 100644 --- a/openapi/core/reference.go +++ b/openapi/core/reference.go @@ -10,7 +10,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/speakeasy-api/openapi/validation" "github.com/speakeasy-api/openapi/yml" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type Reference[T marshaller.CoreModeler] struct { diff --git a/openapi/core/reference_test.go b/openapi/core/reference_test.go index 99db6947..751dbfd3 100644 --- a/openapi/core/reference_test.go +++ b/openapi/core/reference_test.go @@ -7,7 +7,7 @@ import ( "github.com/speakeasy-api/openapi/pointer" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestReference_Unmarshal_Success(t *testing.T) { diff --git a/openapi/core/responses.go b/openapi/core/responses.go index e9e9e423..3d535018 100644 --- a/openapi/core/responses.go +++ b/openapi/core/responses.go @@ -4,7 +4,7 @@ import ( "github.com/speakeasy-api/openapi/extensions/core" "github.com/speakeasy-api/openapi/marshaller" "github.com/speakeasy-api/openapi/sequencedmap" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type Responses struct { diff --git a/openapi/core/responses_test.go b/openapi/core/responses_test.go index 292753be..fff18cc9 100644 --- a/openapi/core/responses_test.go +++ b/openapi/core/responses_test.go @@ -6,7 +6,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestNewResponses_Success(t *testing.T) { diff --git a/openapi/core/security.go b/openapi/core/security.go index ec204904..449e959b 100644 --- a/openapi/core/security.go +++ b/openapi/core/security.go @@ -4,7 +4,7 @@ import ( "github.com/speakeasy-api/openapi/extensions/core" "github.com/speakeasy-api/openapi/marshaller" "github.com/speakeasy-api/openapi/sequencedmap" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type SecurityScheme struct { diff --git a/openapi/core/security_test.go b/openapi/core/security_test.go index 6e962931..b340439a 100644 --- a/openapi/core/security_test.go +++ b/openapi/core/security_test.go @@ -6,7 +6,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestNewSecurityRequirement_Success(t *testing.T) { diff --git a/openapi/index.go b/openapi/index.go index d7a9f2a6..3ea8a18d 100644 --- a/openapi/index.go +++ b/openapi/index.go @@ -14,7 +14,7 @@ import ( "github.com/speakeasy-api/openapi/pointer" "github.com/speakeasy-api/openapi/references" "github.com/speakeasy-api/openapi/validation" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // CircularClassification represents the classification of a circular reference. diff --git a/openapi/index_node_operation_test.go b/openapi/index_node_operation_test.go index 475a0c6d..9de07738 100644 --- a/openapi/index_node_operation_test.go +++ b/openapi/index_node_operation_test.go @@ -8,7 +8,7 @@ import ( "github.com/speakeasy-api/openapi/references" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestBuildIndex_NodeToOperations_WithOption_Success(t *testing.T) { diff --git a/openapi/join_test.go b/openapi/join_test.go index 5d54f90b..c3861065 100644 --- a/openapi/join_test.go +++ b/openapi/join_test.go @@ -9,7 +9,7 @@ import ( "github.com/speakeasy-api/openapi/openapi" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestJoin_Counter_Success(t *testing.T) { diff --git a/openapi/linter/converter/generate.go b/openapi/linter/converter/generate.go index c8852bf9..85d7ce14 100644 --- a/openapi/linter/converter/generate.go +++ b/openapi/linter/converter/generate.go @@ -9,7 +9,7 @@ import ( "github.com/speakeasy-api/openapi/linter" "github.com/speakeasy-api/openapi/validation" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // GenerateOptions configures the output generation. diff --git a/openapi/linter/converter/generate_test.go b/openapi/linter/converter/generate_test.go index cbbb9670..65a8859c 100644 --- a/openapi/linter/converter/generate_test.go +++ b/openapi/linter/converter/generate_test.go @@ -10,7 +10,7 @@ import ( "github.com/speakeasy-api/openapi/validation" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestGenerate_SpectralBasic(t *testing.T) { diff --git a/openapi/linter/converter/parse.go b/openapi/linter/converter/parse.go index 778e1e53..21873b83 100644 --- a/openapi/linter/converter/parse.go +++ b/openapi/linter/converter/parse.go @@ -7,7 +7,7 @@ import ( "sort" "strconv" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // Parse reads a Spectral, Vacuum, or Legacy Speakeasy config and returns diff --git a/openapi/linter/customrules/go.mod b/openapi/linter/customrules/go.mod index 5d72eae9..267886c7 100644 --- a/openapi/linter/customrules/go.mod +++ b/openapi/linter/customrules/go.mod @@ -10,7 +10,7 @@ require ( github.com/go-sourcemap/sourcemap v2.1.4+incompatible github.com/speakeasy-api/openapi v1.25.5-0.20261006003233-cb82fbf0afec github.com/stretchr/testify v1.12.1 - gopkg.in/yaml.v3 v3.0.1 + go.yaml.in/yaml/v3 v3.0.5 ) require ( @@ -18,8 +18,8 @@ require ( github.com/google/pprof v0.0.0-20230207041349-798e818bf904 // indirect github.com/kr/text v0.2.0 // indirect github.com/santhosh-tekuri/jsonschema/v6 v6.0.3 // indirect - go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/sync v0.23.0 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/text v0.42.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/openapi/linter/customrules/runtime.go b/openapi/linter/customrules/runtime.go index 6b906b81..986ac44c 100644 --- a/openapi/linter/customrules/runtime.go +++ b/openapi/linter/customrules/runtime.go @@ -7,7 +7,7 @@ import ( "github.com/dop251/goja" "github.com/speakeasy-api/openapi/validation" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // Runtime wraps a goja JavaScript runtime with custom rule support. diff --git a/openapi/linter/linter_test.go b/openapi/linter/linter_test.go index 08b50d4f..d8056b8c 100644 --- a/openapi/linter/linter_test.go +++ b/openapi/linter/linter_test.go @@ -20,7 +20,7 @@ import ( "github.com/speakeasy-api/openapi/validation" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type mockVirtualFS struct { diff --git a/openapi/linter/rules/description_duplication.go b/openapi/linter/rules/description_duplication.go index a4725404..86bc2b80 100644 --- a/openapi/linter/rules/description_duplication.go +++ b/openapi/linter/rules/description_duplication.go @@ -8,7 +8,7 @@ import ( "github.com/speakeasy-api/openapi/openapi" "github.com/speakeasy-api/openapi/validation" "github.com/speakeasy-api/openapi/yml" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) const RuleStyleDescriptionDuplication = "style-description-duplication" diff --git a/openapi/linter/rules/duplicated_entry_in_enum.go b/openapi/linter/rules/duplicated_entry_in_enum.go index 5cf94507..a4b2e16f 100644 --- a/openapi/linter/rules/duplicated_entry_in_enum.go +++ b/openapi/linter/rules/duplicated_entry_in_enum.go @@ -7,7 +7,7 @@ import ( "github.com/speakeasy-api/openapi/linter" "github.com/speakeasy-api/openapi/openapi" "github.com/speakeasy-api/openapi/validation" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) const RuleSemanticDuplicatedEnum = "semantic-duplicated-enum" diff --git a/openapi/linter/rules/fix_helpers.go b/openapi/linter/rules/fix_helpers.go index 31815bb8..bf4cc43d 100644 --- a/openapi/linter/rules/fix_helpers.go +++ b/openapi/linter/rules/fix_helpers.go @@ -9,7 +9,7 @@ import ( "github.com/speakeasy-api/openapi/pointer" "github.com/speakeasy-api/openapi/validation" "github.com/speakeasy-api/openapi/yml" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // addErrorResponseFix adds a skeleton error response to an operation's responses node. diff --git a/openapi/linter/rules/fix_helpers_test.go b/openapi/linter/rules/fix_helpers_test.go index 674eab75..f1396f19 100644 --- a/openapi/linter/rules/fix_helpers_test.go +++ b/openapi/linter/rules/fix_helpers_test.go @@ -8,7 +8,7 @@ import ( "github.com/speakeasy-api/openapi/yml" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // ============================================================ diff --git a/openapi/linter/rules/fix_integration_test.go b/openapi/linter/rules/fix_integration_test.go index 9bf7a844..8052946b 100644 --- a/openapi/linter/rules/fix_integration_test.go +++ b/openapi/linter/rules/fix_integration_test.go @@ -12,7 +12,7 @@ import ( "github.com/speakeasy-api/openapi/validation" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // These integration tests verify that fixes actually resolve the violations diff --git a/openapi/linter/rules/host_trailing_slash.go b/openapi/linter/rules/host_trailing_slash.go index aa3126aa..a2cf3e14 100644 --- a/openapi/linter/rules/host_trailing_slash.go +++ b/openapi/linter/rules/host_trailing_slash.go @@ -8,7 +8,7 @@ import ( "github.com/speakeasy-api/openapi/linter" "github.com/speakeasy-api/openapi/openapi" "github.com/speakeasy-api/openapi/validation" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) const RuleStyleOAS3HostTrailingSlash = "style-oas3-host-trailing-slash" diff --git a/openapi/linter/rules/markdown_descriptions.go b/openapi/linter/rules/markdown_descriptions.go index b38160d4..71fbcb0c 100644 --- a/openapi/linter/rules/markdown_descriptions.go +++ b/openapi/linter/rules/markdown_descriptions.go @@ -1,7 +1,7 @@ package rules import ( - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // GetFieldValueNode gets the YAML value node for a specific field from any object with a GetCore() method. diff --git a/openapi/linter/rules/oas3_no_nullable.go b/openapi/linter/rules/oas3_no_nullable.go index ec7cb719..338a2fa0 100644 --- a/openapi/linter/rules/oas3_no_nullable.go +++ b/openapi/linter/rules/oas3_no_nullable.go @@ -8,7 +8,7 @@ import ( "github.com/speakeasy-api/openapi/openapi" "github.com/speakeasy-api/openapi/validation" "github.com/speakeasy-api/openapi/yml" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) const RuleOAS3NoNullable = "oas3-no-nullable" diff --git a/openapi/linter/rules/oas_schema_check.go b/openapi/linter/rules/oas_schema_check.go index ecb5ae70..3869b034 100644 --- a/openapi/linter/rules/oas_schema_check.go +++ b/openapi/linter/rules/oas_schema_check.go @@ -11,7 +11,7 @@ import ( "github.com/speakeasy-api/openapi/linter" "github.com/speakeasy-api/openapi/openapi" "github.com/speakeasy-api/openapi/validation" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) const RuleOasSchemaCheck = "oas-schema-check" diff --git a/openapi/linter/rules/operation_success_response.go b/openapi/linter/rules/operation_success_response.go index 4a73ce74..baf35a3f 100644 --- a/openapi/linter/rules/operation_success_response.go +++ b/openapi/linter/rules/operation_success_response.go @@ -9,7 +9,7 @@ import ( "github.com/speakeasy-api/openapi/linter" "github.com/speakeasy-api/openapi/openapi" "github.com/speakeasy-api/openapi/validation" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) const RuleStyleOperationSuccessResponse = "style-operation-success-response" diff --git a/openapi/linter/rules/owasp_jwt_best_practices.go b/openapi/linter/rules/owasp_jwt_best_practices.go index 5a65a5cb..089f2518 100644 --- a/openapi/linter/rules/owasp_jwt_best_practices.go +++ b/openapi/linter/rules/owasp_jwt_best_practices.go @@ -9,7 +9,7 @@ import ( "github.com/speakeasy-api/openapi/openapi" "github.com/speakeasy-api/openapi/validation" "github.com/speakeasy-api/openapi/yml" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) const RuleOwaspJWTBestPractices = "owasp-jwt-best-practices" diff --git a/openapi/linter/rules/owasp_no_additional_properties.go b/openapi/linter/rules/owasp_no_additional_properties.go index f7c35fe1..bd7ec77e 100644 --- a/openapi/linter/rules/owasp_no_additional_properties.go +++ b/openapi/linter/rules/owasp_no_additional_properties.go @@ -8,7 +8,7 @@ import ( "github.com/speakeasy-api/openapi/openapi" "github.com/speakeasy-api/openapi/validation" "github.com/speakeasy-api/openapi/yml" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) const RuleOwaspNoAdditionalProperties = "owasp-no-additional-properties" diff --git a/openapi/linter/rules/owasp_security_hosts_https_oas3.go b/openapi/linter/rules/owasp_security_hosts_https_oas3.go index 365df6ae..f68802bd 100644 --- a/openapi/linter/rules/owasp_security_hosts_https_oas3.go +++ b/openapi/linter/rules/owasp_security_hosts_https_oas3.go @@ -9,7 +9,7 @@ import ( "github.com/speakeasy-api/openapi/openapi" "github.com/speakeasy-api/openapi/validation" "github.com/speakeasy-api/openapi/yml" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) const RuleOwaspSecurityHostsHttpsOAS3 = "owasp-security-hosts-https-oas3" diff --git a/openapi/linter/rules/path_trailing_slash.go b/openapi/linter/rules/path_trailing_slash.go index e758ef27..e42fbfea 100644 --- a/openapi/linter/rules/path_trailing_slash.go +++ b/openapi/linter/rules/path_trailing_slash.go @@ -8,7 +8,7 @@ import ( "github.com/speakeasy-api/openapi/linter" "github.com/speakeasy-api/openapi/openapi" "github.com/speakeasy-api/openapi/validation" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) const RuleStylePathTrailingSlash = "style-path-trailing-slash" diff --git a/openapi/linter/rules/rule_fixes_test.go b/openapi/linter/rules/rule_fixes_test.go index 92fd988e..27321358 100644 --- a/openapi/linter/rules/rule_fixes_test.go +++ b/openapi/linter/rules/rule_fixes_test.go @@ -9,7 +9,7 @@ import ( "github.com/speakeasy-api/openapi/yml" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // ============================================================ diff --git a/openapi/linter/rules/tags_alphabetical.go b/openapi/linter/rules/tags_alphabetical.go index ac525435..cd9e1d11 100644 --- a/openapi/linter/rules/tags_alphabetical.go +++ b/openapi/linter/rules/tags_alphabetical.go @@ -10,7 +10,7 @@ import ( "github.com/speakeasy-api/openapi/openapi" "github.com/speakeasy-api/openapi/validation" "github.com/speakeasy-api/openapi/yml" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) const RuleStyleTagsAlphabetical = "style-tags-alphabetical" diff --git a/openapi/linter/rules/typed_enum.go b/openapi/linter/rules/typed_enum.go index 75147cb8..ef4ab1bd 100644 --- a/openapi/linter/rules/typed_enum.go +++ b/openapi/linter/rules/typed_enum.go @@ -10,7 +10,7 @@ import ( "github.com/speakeasy-api/openapi/linter" "github.com/speakeasy-api/openapi/openapi" "github.com/speakeasy-api/openapi/validation" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) const RuleSemanticTypedEnum = "semantic-typed-enum" diff --git a/openapi/linter/rules/unused_components.go b/openapi/linter/rules/unused_components.go index 020cfc58..3ccc61e5 100644 --- a/openapi/linter/rules/unused_components.go +++ b/openapi/linter/rules/unused_components.go @@ -10,7 +10,7 @@ import ( "github.com/speakeasy-api/openapi/openapi" "github.com/speakeasy-api/openapi/references" "github.com/speakeasy-api/openapi/validation" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) const RuleSemanticUnusedComponent = "semantic-unused-component" diff --git a/openapi/localize.go b/openapi/localize.go index f5dc3cdf..bc0f896c 100644 --- a/openapi/localize.go +++ b/openapi/localize.go @@ -15,7 +15,7 @@ import ( "github.com/speakeasy-api/openapi/sequencedmap" "github.com/speakeasy-api/openapi/system" "github.com/speakeasy-api/openapi/yml" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // LocalizeNamingStrategy defines how external reference files should be named when localized. diff --git a/openapi/openapi.go b/openapi/openapi.go index bfcf2efa..3101f37e 100644 --- a/openapi/openapi.go +++ b/openapi/openapi.go @@ -15,7 +15,7 @@ import ( "github.com/speakeasy-api/openapi/pointer" "github.com/speakeasy-api/openapi/sequencedmap" "github.com/speakeasy-api/openapi/validation" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // Version is the version of the OpenAPI Specification that this package conforms to. diff --git a/openapi/reference.go b/openapi/reference.go index 7aecb76f..cf9a9f53 100644 --- a/openapi/reference.go +++ b/openapi/reference.go @@ -15,7 +15,7 @@ import ( "github.com/speakeasy-api/openapi/pointer" "github.com/speakeasy-api/openapi/references" "github.com/speakeasy-api/openapi/validation" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type ( diff --git a/openapi/sanitize.go b/openapi/sanitize.go index 6308e67c..4423e2e4 100644 --- a/openapi/sanitize.go +++ b/openapi/sanitize.go @@ -11,7 +11,7 @@ import ( "github.com/speakeasy-api/openapi/extensions" "github.com/speakeasy-api/openapi/jsonschema/oas3" "github.com/speakeasy-api/openapi/marshaller" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // ExtensionFilter specifies patterns for filtering extensions using allowed and denied lists. diff --git a/openapi/upgrade.go b/openapi/upgrade.go index ec056ac0..cc7957f1 100644 --- a/openapi/upgrade.go +++ b/openapi/upgrade.go @@ -10,7 +10,7 @@ import ( "github.com/speakeasy-api/openapi/jsonschema/oas3" "github.com/speakeasy-api/openapi/marshaller" "github.com/speakeasy-api/openapi/sequencedmap" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type UpgradeOptions struct { diff --git a/openapi/upgrade_test.go b/openapi/upgrade_test.go index 29b63f4f..92727b15 100644 --- a/openapi/upgrade_test.go +++ b/openapi/upgrade_test.go @@ -12,7 +12,7 @@ import ( "github.com/speakeasy-api/openapi/openapi" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestUpgrade_Success(t *testing.T) { diff --git a/oq/foldedscalar_format_test.go b/oq/foldedscalar_format_test.go index aa6e76d6..4fce5f2c 100644 --- a/oq/foldedscalar_format_test.go +++ b/oq/foldedscalar_format_test.go @@ -10,7 +10,7 @@ import ( "github.com/speakeasy-api/openapi/references" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // The trailing table row is indented one space further than the rows above it, which diff --git a/oq/format.go b/oq/format.go index 10c68eb3..dfc2d5cb 100644 --- a/oq/format.go +++ b/oq/format.go @@ -9,7 +9,7 @@ import ( "github.com/speakeasy-api/openapi/graph" "github.com/speakeasy-api/openapi/oq/expr" "github.com/speakeasy-api/openapi/yml" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // FormatTable formats a result as a simple table string. diff --git a/overlay/README.md b/overlay/README.md index 6a005f32..bcebc83b 100644 --- a/overlay/README.md +++ b/overlay/README.md @@ -30,7 +30,7 @@ - **Remove, Update, and Copy Actions**: Support for remove actions (pruning nodes), update actions (merging values), and copy actions (duplicating or moving nodes) - **Flexible Input/Output**: Works with both YAML and JSON formats - **Batch Operations**: Apply multiple modifications to large numbers of nodes in a single operation -- **YAML v1.2 Support**: Uses [gopkg.in/yaml.v3](https://pkg.go.dev/gopkg.in/yaml.v3) for YAML v1.2 parsing (superset of JSON) +- **YAML v1.2 Support**: Uses [go.yaml.in/yaml/v3](https://pkg.go.dev/go.yaml.in/yaml/v3) for YAML v1.2 parsing (superset of JSON) ## About OpenAPI Overlays diff --git a/overlay/apply.go b/overlay/apply.go index 170734c8..568e6f98 100644 --- a/overlay/apply.go +++ b/overlay/apply.go @@ -7,7 +7,7 @@ import ( "github.com/speakeasy-api/jsonpath/pkg/jsonpath/config" "github.com/speakeasy-api/jsonpath/pkg/jsonpath/token" "github.com/speakeasy-api/openapi/yml" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // ApplyTo will take an overlay and apply its changes to the given YAML diff --git a/overlay/apply_test.go b/overlay/apply_test.go index 88199973..c9b00211 100644 --- a/overlay/apply_test.go +++ b/overlay/apply_test.go @@ -11,7 +11,9 @@ import ( "github.com/speakeasy-api/openapi/overlay/loader" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" + legacyYaml "gopkg.in/yaml.v3" + "unsafe" ) // NodeMatchesFile is a test that marshals the YAML file from the given node, @@ -911,7 +913,7 @@ func TestApplyToOld(t *testing.T) { path, err := jsonpath.NewPath(`$.paths["/anything/selectGlobalServer"]`) require.NoError(t, err) - result := path.Query(nodeOld) + result := path.Query((*legacyYaml.Node)(unsafe.Pointer(nodeOld))) require.NoError(t, err) require.Empty(t, result) o.JSONPathVersion = "rfc9535" @@ -925,7 +927,7 @@ func TestApplyToOld(t *testing.T) { o.Actions[0].Target = "$.paths[?(@[\"x-my-ignore\"])]" // @ should always refer to the child node in RFC 9535.. _, err = o.ApplyToStrict(nodeNew) require.NoError(t, err) - result = path.Query(nodeNew) + result = path.Query((*legacyYaml.Node)(unsafe.Pointer(nodeNew))) require.NoError(t, err) require.Empty(t, result) } diff --git a/overlay/compare.go b/overlay/compare.go index 06360a49..23c67939 100644 --- a/overlay/compare.go +++ b/overlay/compare.go @@ -6,7 +6,7 @@ import ( "log" "strings" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // Compare compares input specifications from two files and returns an overlay diff --git a/overlay/compare_test.go b/overlay/compare_test.go index 10ec184f..6a00b891 100644 --- a/overlay/compare_test.go +++ b/overlay/compare_test.go @@ -7,7 +7,7 @@ import ( "github.com/speakeasy-api/openapi/overlay/loader" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestCompare(t *testing.T) { diff --git a/overlay/foldedscalar_test.go b/overlay/foldedscalar_test.go index 9414ca6d..0115019a 100644 --- a/overlay/foldedscalar_test.go +++ b/overlay/foldedscalar_test.go @@ -8,7 +8,7 @@ import ( "github.com/speakeasy-api/openapi/overlay" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // The trailing table row is indented one space further than the rows above it, diff --git a/overlay/format_test.go b/overlay/format_test.go index 0701b7f4..2a251f3b 100644 --- a/overlay/format_test.go +++ b/overlay/format_test.go @@ -9,7 +9,7 @@ import ( "github.com/speakeasy-api/openapi/overlay" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestOverlay_Format_Success(t *testing.T) { diff --git a/overlay/jsonpath.go b/overlay/jsonpath.go index 2ccc3c73..8192dfcf 100644 --- a/overlay/jsonpath.go +++ b/overlay/jsonpath.go @@ -2,12 +2,14 @@ package overlay import ( "fmt" + "unsafe" "github.com/speakeasy-api/jsonpath/pkg/jsonpath" "github.com/speakeasy-api/jsonpath/pkg/jsonpath/config" "github.com/speakeasy-api/openapi/internal/version" "github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" + legacyYaml "gopkg.in/yaml.v3" ) // Queryable is an interface for querying YAML nodes using JSONPath expressions. @@ -15,6 +17,23 @@ type Queryable interface { Query(root *yaml.Node) []*yaml.Node } +type rfcJSONPathQueryable struct { + path *jsonpath.JSONPath +} + +func (r rfcJSONPathQueryable) Query(root *yaml.Node) []*yaml.Node { + if r.path == nil { + return []*yaml.Node{} + } + legacyRoot := (*legacyYaml.Node)(unsafe.Pointer(root)) + legacyResults := r.path.Query(legacyRoot) + results := make([]*yaml.Node, len(legacyResults)) + for i, n := range legacyResults { + results[i] = (*yaml.Node)(unsafe.Pointer(n)) + } + return results +} + type yamlPathQueryable struct { path *yamlpath.Path } @@ -23,9 +42,14 @@ func (y yamlPathQueryable) Query(root *yaml.Node) []*yaml.Node { if y.path == nil { return []*yaml.Node{} } + legacyRoot := (*legacyYaml.Node)(unsafe.Pointer(root)) // errors aren't actually possible from yamlpath. - result, _ := y.path.Find(root) - return result + legacyResults, _ := y.path.Find(legacyRoot) + results := make([]*yaml.Node, len(legacyResults)) + for i, n := range legacyResults { + results[i] = (*yaml.Node)(unsafe.Pointer(n)) + } + return results } // NewPath creates a new JSONPath queryable from the given target expression. @@ -35,7 +59,7 @@ func (y yamlPathQueryable) Query(root *yaml.Node) []*yaml.Node { func (o *Overlay) NewPath(target string, warnings *[]string) (Queryable, error) { rfcJSONPath, rfcJSONPathErr := jsonpath.NewPath(target, config.WithPropertyNameExtension()) if o.UsesRFC9535() { - return rfcJSONPath, rfcJSONPathErr + return rfcJSONPathQueryable{path: rfcJSONPath}, rfcJSONPathErr } // For version < 1.1.0 without explicit rfc9535, warn about future incompatibility diff --git a/overlay/loader/spec.go b/overlay/loader/spec.go index 95401ddd..32a9a795 100644 --- a/overlay/loader/spec.go +++ b/overlay/loader/spec.go @@ -11,7 +11,7 @@ import ( "strings" "github.com/speakeasy-api/openapi/overlay" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // GetOverlayExtendsPath returns the path to file if the extends URL is a file diff --git a/overlay/loader/spec_test.go b/overlay/loader/spec_test.go index 1a6b70b9..d677c156 100644 --- a/overlay/loader/spec_test.go +++ b/overlay/loader/spec_test.go @@ -10,7 +10,7 @@ import ( "github.com/speakeasy-api/openapi/overlay" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // pathToFileURL converts a file path to a proper file:// URL diff --git a/overlay/overlay_examples_test.go b/overlay/overlay_examples_test.go index 0f3eb5f0..7d24cc00 100644 --- a/overlay/overlay_examples_test.go +++ b/overlay/overlay_examples_test.go @@ -7,7 +7,7 @@ import ( "github.com/speakeasy-api/openapi/overlay" "github.com/speakeasy-api/openapi/overlay/loader" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // Example_applying demonstrates how to apply an overlay to an OpenAPI document. diff --git a/overlay/parents.go b/overlay/parents.go index a2b4942c..65d269bf 100644 --- a/overlay/parents.go +++ b/overlay/parents.go @@ -1,6 +1,6 @@ package overlay -import "gopkg.in/yaml.v3" +import "go.yaml.in/yaml/v3" type parentIndex map[*yaml.Node]*yaml.Node diff --git a/overlay/parse.go b/overlay/parse.go index 3a7e817c..4a118d01 100644 --- a/overlay/parse.go +++ b/overlay/parse.go @@ -6,7 +6,7 @@ import ( "os" "path/filepath" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // ParseReader parses an overlay from the given reader. diff --git a/overlay/schema.go b/overlay/schema.go index 7a4e6db2..24c35282 100644 --- a/overlay/schema.go +++ b/overlay/schema.go @@ -4,7 +4,7 @@ import ( "bytes" "github.com/speakeasy-api/openapi/internal/version" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // Version constants for the Overlay specification diff --git a/overlay/upgrade_test.go b/overlay/upgrade_test.go index a335a44c..7b87a053 100644 --- a/overlay/upgrade_test.go +++ b/overlay/upgrade_test.go @@ -6,7 +6,7 @@ import ( "github.com/speakeasy-api/openapi/overlay" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestUpgrade_Success(t *testing.T) { diff --git a/overlay/utils.go b/overlay/utils.go index 38439706..8923e7be 100644 --- a/overlay/utils.go +++ b/overlay/utils.go @@ -3,7 +3,7 @@ package overlay import ( "fmt" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func NewTargetSelector(path, method string) string { diff --git a/overlay/utils_test.go b/overlay/utils_test.go index 8c96a0ab..b1270a94 100644 --- a/overlay/utils_test.go +++ b/overlay/utils_test.go @@ -5,7 +5,7 @@ import ( "github.com/speakeasy-api/openapi/overlay" "github.com/stretchr/testify/assert" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestNewTargetSelector_Success(t *testing.T) { diff --git a/overlay/validate_test.go b/overlay/validate_test.go index d68dc571..e98ff03c 100644 --- a/overlay/validate_test.go +++ b/overlay/validate_test.go @@ -6,7 +6,7 @@ import ( "github.com/speakeasy-api/openapi/overlay" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestOverlay_Validate(t *testing.T) { diff --git a/references/resolution.go b/references/resolution.go index c310840f..d863f218 100644 --- a/references/resolution.go +++ b/references/resolution.go @@ -12,7 +12,7 @@ import ( "github.com/speakeasy-api/openapi/internal/utils" "github.com/speakeasy-api/openapi/jsonpointer" "github.com/speakeasy-api/openapi/system" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type ResolutionTarget interface { diff --git a/references/resolution_test.go b/references/resolution_test.go index afa8bd48..60ec4071 100644 --- a/references/resolution_test.go +++ b/references/resolution_test.go @@ -16,7 +16,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller/tests" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // MockResolutionTarget implements ResolutionTarget for testing diff --git a/sequencedmap/map.go b/sequencedmap/map.go index 8c5f2c49..e62639c6 100644 --- a/sequencedmap/map.go +++ b/sequencedmap/map.go @@ -15,7 +15,7 @@ import ( "github.com/speakeasy-api/openapi/internal/interfaces" "github.com/speakeasy-api/openapi/internal/utils" "github.com/speakeasy-api/openapi/yml" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // OrderType represents the different ways to order iteration through the map diff --git a/sequencedmap/map_advanced_test.go b/sequencedmap/map_advanced_test.go index 011d6a9e..a9205b65 100644 --- a/sequencedmap/map_advanced_test.go +++ b/sequencedmap/map_advanced_test.go @@ -5,7 +5,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestMap_NavigateWithKey_Success(t *testing.T) { diff --git a/sequencedmap/yaml_unmarshal_test.go b/sequencedmap/yaml_unmarshal_test.go index f5ec1fbd..fca46786 100644 --- a/sequencedmap/yaml_unmarshal_test.go +++ b/sequencedmap/yaml_unmarshal_test.go @@ -6,7 +6,7 @@ import ( "github.com/speakeasy-api/openapi/sequencedmap" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestSequencedMap_Standard_Yaml_Unmarshal(t *testing.T) { diff --git a/sortfmt/edge_cases_test.go b/sortfmt/edge_cases_test.go index 3f367566..a01037dc 100644 --- a/sortfmt/edge_cases_test.go +++ b/sortfmt/edge_cases_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestFormat_ReadError(t *testing.T) { diff --git a/sortfmt/format.go b/sortfmt/format.go index 64a5a512..58bee745 100644 --- a/sortfmt/format.go +++ b/sortfmt/format.go @@ -22,7 +22,7 @@ import ( "strings" "unicode/utf8" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) var alphabetizedMapKeys = map[string]struct{}{ diff --git a/sortfmt/format_test.go b/sortfmt/format_test.go index 247508c1..0278b03d 100644 --- a/sortfmt/format_test.go +++ b/sortfmt/format_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestFormat_MatchesSortedJSONStyle(t *testing.T) { diff --git a/sortfmt/writer.go b/sortfmt/writer.go index c0a3261e..474a8dd0 100644 --- a/sortfmt/writer.go +++ b/sortfmt/writer.go @@ -9,7 +9,7 @@ import ( "strings" "unicode/utf16" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // Write serializes a sorted YAML node using the JSON representation produced diff --git a/swagger/core/paths.go b/swagger/core/paths.go index c05967f5..08b01337 100644 --- a/swagger/core/paths.go +++ b/swagger/core/paths.go @@ -4,7 +4,7 @@ import ( "github.com/speakeasy-api/openapi/extensions/core" "github.com/speakeasy-api/openapi/marshaller" "github.com/speakeasy-api/openapi/sequencedmap" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // Paths holds the relative paths to the individual endpoints. diff --git a/swagger/core/paths_test.go b/swagger/core/paths_test.go index 0a4a3709..b37a9662 100644 --- a/swagger/core/paths_test.go +++ b/swagger/core/paths_test.go @@ -6,7 +6,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func parseYAML(t *testing.T, yml string) *yaml.Node { diff --git a/swagger/core/reference.go b/swagger/core/reference.go index 32efa31b..044087f2 100644 --- a/swagger/core/reference.go +++ b/swagger/core/reference.go @@ -10,7 +10,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/speakeasy-api/openapi/validation" "github.com/speakeasy-api/openapi/yml" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // Reference represents either a reference to a component or an inline object. diff --git a/swagger/core/reference_test.go b/swagger/core/reference_test.go index 58865efc..fe71408a 100644 --- a/swagger/core/reference_test.go +++ b/swagger/core/reference_test.go @@ -6,7 +6,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestReference_Unmarshal_Success(t *testing.T) { diff --git a/swagger/core/response.go b/swagger/core/response.go index a3210121..0d258b04 100644 --- a/swagger/core/response.go +++ b/swagger/core/response.go @@ -6,7 +6,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/speakeasy-api/openapi/sequencedmap" values "github.com/speakeasy-api/openapi/values/core" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // Responses is a container for the expected responses of an operation. diff --git a/swagger/core/response_test.go b/swagger/core/response_test.go index 5b3cb88e..08fe6569 100644 --- a/swagger/core/response_test.go +++ b/swagger/core/response_test.go @@ -6,7 +6,7 @@ import ( "github.com/speakeasy-api/openapi/marshaller" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestNewResponses_Success(t *testing.T) { diff --git a/swagger/roundtrip_test.go b/swagger/roundtrip_test.go index fe0c0a44..358b2bdb 100644 --- a/swagger/roundtrip_test.go +++ b/swagger/roundtrip_test.go @@ -13,7 +13,7 @@ import ( "github.com/speakeasy-api/openapi/yml" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type roundTripTest struct { diff --git a/validation/errors.go b/validation/errors.go index a37100aa..4f6d8eaa 100644 --- a/validation/errors.go +++ b/validation/errors.go @@ -3,7 +3,7 @@ package validation import ( "fmt" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type Severity string diff --git a/validation/fix.go b/validation/fix.go index 0364e3d7..bd272af8 100644 --- a/validation/fix.go +++ b/validation/fix.go @@ -1,6 +1,6 @@ package validation -import "gopkg.in/yaml.v3" +import "go.yaml.in/yaml/v3" // PromptType describes what kind of user input a fix needs. type PromptType int diff --git a/validation/utils_test.go b/validation/utils_test.go index 71fc92e2..6bc668c6 100644 --- a/validation/utils_test.go +++ b/validation/utils_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // Test SortValidationErrors function diff --git a/validation/validation_test.go b/validation/validation_test.go index d53c2ed9..a2a1d176 100644 --- a/validation/validation_test.go +++ b/validation/validation_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // Test the Error type methods diff --git a/values/core/eithervalue.go b/values/core/eithervalue.go index b280f0e7..a11b3cb2 100644 --- a/values/core/eithervalue.go +++ b/values/core/eithervalue.go @@ -10,7 +10,7 @@ import ( "github.com/speakeasy-api/openapi/internal/interfaces" "github.com/speakeasy-api/openapi/marshaller" "github.com/speakeasy-api/openapi/validation" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type EitherValue[L any, R any] struct { diff --git a/values/core/eithervalue_test.go b/values/core/eithervalue_test.go index 6270c21d..eb05d5d2 100644 --- a/values/core/eithervalue_test.go +++ b/values/core/eithervalue_test.go @@ -11,7 +11,7 @@ import ( "github.com/speakeasy-api/openapi/validation" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type TestEitherValue[L any, R any] struct { diff --git a/values/core/value.go b/values/core/value.go index 027e7ed5..c3c35a67 100644 --- a/values/core/value.go +++ b/values/core/value.go @@ -1,6 +1,6 @@ package core -import "gopkg.in/yaml.v3" +import "go.yaml.in/yaml/v3" // Value represents a raw value in an OpenAPI or Arazzo document. type Value = *yaml.Node diff --git a/values/value.go b/values/value.go index a255214c..4beb8c4b 100644 --- a/values/value.go +++ b/values/value.go @@ -1,6 +1,6 @@ package values -import "gopkg.in/yaml.v3" +import "go.yaml.in/yaml/v3" // Value represents a raw value in an OpenAPI or Arazzo document. type Value = *yaml.Node diff --git a/yml/config.go b/yml/config.go index 0bb9aede..d15ada27 100644 --- a/yml/config.go +++ b/yml/config.go @@ -5,7 +5,7 @@ import ( "context" "strconv" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) type contextKey string diff --git a/yml/config_test.go b/yml/config_test.go index 92d9ea24..096916ea 100644 --- a/yml/config_test.go +++ b/yml/config_test.go @@ -7,7 +7,7 @@ import ( "github.com/speakeasy-api/openapi/yml" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestContextKey_String_Success(t *testing.T) { diff --git a/yml/foldedscalar.go b/yml/foldedscalar.go index 5e62442d..9403b864 100644 --- a/yml/foldedscalar.go +++ b/yml/foldedscalar.go @@ -3,7 +3,7 @@ package yml import ( "strings" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // Block indentation is stripped on decode, so leading whitespace means more-indented. @@ -23,7 +23,7 @@ func hasMoreIndentedLine(value string) bool { // StabilizeFoldedScalars restyles folded block scalars that contain a more-indented // line as literal blocks, leaving every other node untouched. // -// gopkg.in/yaml.v3 injects a line break before a more-indented line in a folded scalar +// go.yaml.in/yaml/v3 injects a line break before a more-indented line in a folded scalar // on every encode, so a document that is decoded and re-encoded repeatedly accumulates // blank lines inside such scalars. The break lands inside the scalar, so it becomes part // of the decoded value rather than cosmetic whitespace. Literal blocks reproduce their diff --git a/yml/foldedscalar_test.go b/yml/foldedscalar_test.go index b5044384..dcf975e8 100644 --- a/yml/foldedscalar_test.go +++ b/yml/foldedscalar_test.go @@ -6,7 +6,7 @@ import ( "github.com/speakeasy-api/openapi/yml" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) // The trailing table row is indented one space further than the rows above it, @@ -240,7 +240,7 @@ func TestStabilizeFoldedScalars_HandlesAnchoredScalars(t *testing.T) { } } -// Fails once gopkg.in/yaml.v3 fixes the emitter, at which point StabilizeFoldedScalars can go. +// Fails once go.yaml.in/yaml/v3 fixes the emitter, at which point StabilizeFoldedScalars can go. func TestFoldedScalarGrowsWithoutStabilizer(t *testing.T) { t.Parallel() diff --git a/yml/nodekind.go b/yml/nodekind.go index a90996f7..c58a9473 100644 --- a/yml/nodekind.go +++ b/yml/nodekind.go @@ -1,6 +1,6 @@ package yml -import "gopkg.in/yaml.v3" +import "go.yaml.in/yaml/v3" // NodeKindToString returns a human-readable string representation of a yaml.Kind. // This helper function is useful for creating more user-friendly error messages diff --git a/yml/nodekind_test.go b/yml/nodekind_test.go index 9163a198..363dad2c 100644 --- a/yml/nodekind_test.go +++ b/yml/nodekind_test.go @@ -5,7 +5,7 @@ import ( "github.com/speakeasy-api/openapi/yml" "github.com/stretchr/testify/assert" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestNodeKindToString(t *testing.T) { diff --git a/yml/walk.go b/yml/walk.go index 46bd0065..6350ab20 100644 --- a/yml/walk.go +++ b/yml/walk.go @@ -4,7 +4,7 @@ import ( "context" "github.com/speakeasy-api/openapi/errors" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) const ( diff --git a/yml/walk_test.go b/yml/walk_test.go index aa13115f..f6fa2a62 100644 --- a/yml/walk_test.go +++ b/yml/walk_test.go @@ -8,7 +8,7 @@ import ( "github.com/speakeasy-api/openapi/yml" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestWalk_Success(t *testing.T) { diff --git a/yml/yml.go b/yml/yml.go index 46d3362b..5af0162c 100644 --- a/yml/yml.go +++ b/yml/yml.go @@ -5,7 +5,7 @@ import ( "reflect" "strconv" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func CreateOrUpdateKeyNode(ctx context.Context, key string, keyNode *yaml.Node) *yaml.Node { diff --git a/yml/yml_test.go b/yml/yml_test.go index 3a7318ee..d810c673 100644 --- a/yml/yml_test.go +++ b/yml/yml_test.go @@ -7,7 +7,7 @@ import ( "github.com/speakeasy-api/openapi/yml" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" ) func TestCreateOrUpdateKeyNode_Success(t *testing.T) { From 2990fd8c4377cc3dfcf2008459194f78e4630b38 Mon Sep 17 00:00:00 2001 From: AdamMagued Date: Wed, 14 Oct 2026 06:59:49 +0300 Subject: [PATCH 02/14] fix: address review feedback on yaml.v3 migration compatibility and formatting --- go.mod | 2 +- hashing/hashing.go | 6 +++ hashing/yaml_migration_test.go | 41 +++++++++++++++ jsonpointer/jsonpointer.go | 14 +++++ jsonpointer/legacy_yaml_test.go | 37 +++++++++++++ jsonschema/oas3/validation.go | 2 +- linter/fix/engine.go | 12 +++++ linter/fix/legacy_fix_test.go | 35 +++++++++++++ marshaller/sequencedmap.go | 2 +- marshaller/unmarshaller.go | 2 +- overlay/jsonpath.go | 12 +++-- sequencedmap/map.go | 51 +++++++++++++++++- sequencedmap/yaml_migration_test.go | 81 +++++++++++++++++++++++++++++ validation/fix.go | 14 ++++- values/value.go | 17 +++++- values/value_test.go | 30 +++++++++++ 16 files changed, 346 insertions(+), 12 deletions(-) create mode 100644 hashing/yaml_migration_test.go create mode 100644 jsonpointer/legacy_yaml_test.go create mode 100644 linter/fix/legacy_fix_test.go create mode 100644 sequencedmap/yaml_migration_test.go create mode 100644 values/value_test.go diff --git a/go.mod b/go.mod index b3f4aed4..fc682814 100644 --- a/go.mod +++ b/go.mod @@ -8,9 +8,9 @@ require ( github.com/speakeasy-api/jsonpath v0.6.3 github.com/stretchr/testify v1.12.1 github.com/vmware-labs/yaml-jsonpath v0.3.2 + go.yaml.in/yaml/v3 v3.0.5 golang.org/x/sync v0.23.0 golang.org/x/text v0.42.0 - go.yaml.in/yaml/v3 v3.0.5 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/hashing/hashing.go b/hashing/hashing.go index e0a26062..269a6317 100644 --- a/hashing/hashing.go +++ b/hashing/hashing.go @@ -10,6 +10,8 @@ import ( "github.com/speakeasy-api/openapi/internal/interfaces" "go.yaml.in/yaml/v3" + gopkgyaml "gopkg.in/yaml.v3" + "unsafe" ) func Hash(v any) string { @@ -79,6 +81,8 @@ func toHashableString(v any) string { // Check if this is a yaml.Node if node, ok := v.(yaml.Node); ok { builder.WriteString(yamlNodeToHashableString(&node)) + } else if legacyNode, ok := v.(gopkgyaml.Node); ok { + builder.WriteString(yamlNodeToHashableString((*yaml.Node)(unsafe.Pointer(&legacyNode)))) //nolint:gosec // zero-copy conversion between identical Node memory layouts } else { builder.WriteString(structToHashableString(v)) } @@ -110,6 +114,8 @@ func toHashableString(v any) string { builder.WriteString(strconv.FormatUint(v, 10)) case *yaml.Node: builder.WriteString(yamlNodeToHashableString(v)) + case *gopkgyaml.Node: + builder.WriteString(yamlNodeToHashableString((*yaml.Node)(unsafe.Pointer(v)))) //nolint:gosec // zero-copy conversion between identical Node memory layouts default: fmt.Fprintf(&builder, "%v", v) } diff --git a/hashing/yaml_migration_test.go b/hashing/yaml_migration_test.go new file mode 100644 index 00000000..c2a1a237 --- /dev/null +++ b/hashing/yaml_migration_test.go @@ -0,0 +1,41 @@ +package hashing_test + +import ( + "testing" + + "github.com/speakeasy-api/openapi/hashing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + goyaml "go.yaml.in/yaml/v3" + legacyyaml "gopkg.in/yaml.v3" +) + +func TestHash_YAMLNodeParity(t *testing.T) { + t.Parallel() + + yamlData := `info: + title: Test API + version: "1.0" +paths: + /test: + get: + responses: + "200": + description: OK +` + var modernNode goyaml.Node + err := goyaml.Unmarshal([]byte(yamlData), &modernNode) + require.NoError(t, err) + + var legacyNode legacyyaml.Node + err = legacyyaml.Unmarshal([]byte(yamlData), &legacyNode) + require.NoError(t, err) + + modernHashPtr := hashing.Hash(&modernNode) + legacyHashPtr := hashing.Hash(&legacyNode) + assert.Equal(t, modernHashPtr, legacyHashPtr, "legacy and modern yaml node pointers should yield identical hash") + + modernHashVal := hashing.Hash(modernNode) + legacyHashVal := hashing.Hash(legacyNode) + assert.Equal(t, modernHashVal, legacyHashVal, "legacy and modern yaml node values should yield identical hash") +} diff --git a/jsonpointer/jsonpointer.go b/jsonpointer/jsonpointer.go index 0c992d5f..aadafa4b 100644 --- a/jsonpointer/jsonpointer.go +++ b/jsonpointer/jsonpointer.go @@ -10,6 +10,8 @@ import ( "github.com/speakeasy-api/openapi/errors" "github.com/speakeasy-api/openapi/internal/interfaces" "go.yaml.in/yaml/v3" + gopkgyaml "gopkg.in/yaml.v3" + "unsafe" ) const ( @@ -106,6 +108,12 @@ func getCurrentStackTarget(source any, stack []navigationPart, currentPath strin if yamlNode, ok := source.(yaml.Node); ok { return getYamlNodeTarget(&yamlNode, navigationPart{}, []navigationPart{}, currentPath, o) } + if legacyNode, ok := source.(*gopkgyaml.Node); ok { + return getYamlNodeTarget((*yaml.Node)(unsafe.Pointer(legacyNode)), navigationPart{}, []navigationPart{}, currentPath, o) //nolint:gosec // zero-copy conversion between identical Node memory layouts + } + if legacyNode, ok := source.(gopkgyaml.Node); ok { + return getYamlNodeTarget((*yaml.Node)(unsafe.Pointer(&legacyNode)), navigationPart{}, []navigationPart{}, currentPath, o) //nolint:gosec // zero-copy conversion between identical Node memory layouts + } return source, stack, nil } @@ -125,6 +133,12 @@ func getTarget(source any, currentPart navigationPart, stack []navigationPart, c if yamlNode, ok := source.(yaml.Node); ok { return getYamlNodeTarget(&yamlNode, currentPart, stack, currentPath, o) } + if legacyNode, ok := source.(*gopkgyaml.Node); ok { + return getYamlNodeTarget((*yaml.Node)(unsafe.Pointer(legacyNode)), currentPart, stack, currentPath, o) //nolint:gosec // zero-copy conversion between identical Node memory layouts + } + if legacyNode, ok := source.(gopkgyaml.Node); ok { + return getYamlNodeTarget((*yaml.Node)(unsafe.Pointer(&legacyNode)), currentPart, stack, currentPath, o) //nolint:gosec // zero-copy conversion between identical Node memory layouts + } sourceType := reflect.TypeOf(source) if sourceType == nil { diff --git a/jsonpointer/legacy_yaml_test.go b/jsonpointer/legacy_yaml_test.go new file mode 100644 index 00000000..e9f6c659 --- /dev/null +++ b/jsonpointer/legacy_yaml_test.go @@ -0,0 +1,37 @@ +package jsonpointer_test + +import ( + "testing" + + "github.com/speakeasy-api/openapi/jsonpointer" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + legacyyaml "gopkg.in/yaml.v3" +) + +func TestGetTarget_LegacyYAMLNode(t *testing.T) { + t.Parallel() + + yamlData := `info: + title: Test API + version: 1.0.0 +paths: + /users: + get: + summary: Get users +` + var root legacyyaml.Node + err := legacyyaml.Unmarshal([]byte(yamlData), &root) + require.NoError(t, err) + + ptr := jsonpointer.JSONPointer("/info/title") + target, err := jsonpointer.GetTarget(&root, ptr) + require.NoError(t, err) + require.NotNil(t, target) + + // Also test value struct version + target2, err := jsonpointer.GetTarget(root, ptr) + require.NoError(t, err) + require.NotNil(t, target2) + assert.Equal(t, target, target2) +} diff --git a/jsonschema/oas3/validation.go b/jsonschema/oas3/validation.go index a44e65d4..893c8793 100644 --- a/jsonschema/oas3/validation.go +++ b/jsonschema/oas3/validation.go @@ -17,9 +17,9 @@ import ( "github.com/speakeasy-api/openapi/jsonschema/oas3/core" "github.com/speakeasy-api/openapi/marshaller" "github.com/speakeasy-api/openapi/validation" + "go.yaml.in/yaml/v3" "golang.org/x/text/language" "golang.org/x/text/message" - "go.yaml.in/yaml/v3" ) // custom file to cover for missing openapi 3.0 json schema diff --git a/linter/fix/engine.go b/linter/fix/engine.go index e4610430..35b486e2 100644 --- a/linter/fix/engine.go +++ b/linter/fix/engine.go @@ -8,6 +8,8 @@ import ( "github.com/speakeasy-api/openapi/openapi" "github.com/speakeasy-api/openapi/validation" "go.yaml.in/yaml/v3" + gopkgyaml "gopkg.in/yaml.v3" + "unsafe" ) // Mode controls how fixes are applied. @@ -250,6 +252,13 @@ func (e *Engine) ProcessErrors(ctx context.Context, doc *openapi.OpenAPI, errs [ } else { applyErr = fix.Apply(doc) } + } else if legacyFix, ok := fix.(validation.LegacyNodeFix); ok { + rootNode := doc.GetRootNode() + if rootNode != nil { + applyErr = legacyFix.ApplyNode((*gopkgyaml.Node)(unsafe.Pointer(rootNode))) //nolint:gosec // zero-copy conversion between identical Node memory layouts + } else { + applyErr = fix.Apply(doc) + } } else { applyErr = fix.Apply(doc) } @@ -286,5 +295,8 @@ func ApplyNodeFix(fix validation.Fix, doc *openapi.OpenAPI, rootNode *yaml.Node) if nodeFix, ok := fix.(validation.NodeFix); ok && rootNode != nil { return nodeFix.ApplyNode(rootNode) } + if legacyFix, ok := fix.(validation.LegacyNodeFix); ok && rootNode != nil { + return legacyFix.ApplyNode((*gopkgyaml.Node)(unsafe.Pointer(rootNode))) //nolint:gosec // zero-copy conversion between identical Node memory layouts + } return fix.Apply(doc) } diff --git a/linter/fix/legacy_fix_test.go b/linter/fix/legacy_fix_test.go new file mode 100644 index 00000000..7357780d --- /dev/null +++ b/linter/fix/legacy_fix_test.go @@ -0,0 +1,35 @@ +package fix_test + +import ( + "testing" + + "github.com/speakeasy-api/openapi/linter/fix" + "github.com/speakeasy-api/openapi/openapi" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.yaml.in/yaml/v3" + legacyyaml "gopkg.in/yaml.v3" +) + +type mockLegacyNodeFix struct { + mockFix + legacyNodeApplied bool +} + +func (f *mockLegacyNodeFix) ApplyNode(rootNode *legacyyaml.Node) error { + f.legacyNodeApplied = true + return nil +} + +func TestApplyNodeFix_WithLegacyNodeFix(t *testing.T) { + t.Parallel() + + f := &mockLegacyNodeFix{mockFix: mockFix{description: "legacy node fix"}} + rootNode := &yaml.Node{Kind: yaml.MappingNode} + doc := &openapi.OpenAPI{} + + err := fix.ApplyNodeFix(f, doc, rootNode) + require.NoError(t, err, "ApplyNodeFix should not fail") + assert.True(t, f.legacyNodeApplied, "Legacy ApplyNode should be called") + assert.False(t, f.applied, "Apply should not be called") +} diff --git a/marshaller/sequencedmap.go b/marshaller/sequencedmap.go index 0c33fc22..0f32ac78 100644 --- a/marshaller/sequencedmap.go +++ b/marshaller/sequencedmap.go @@ -12,8 +12,8 @@ import ( "github.com/speakeasy-api/openapi/internal/utils" "github.com/speakeasy-api/openapi/validation" "github.com/speakeasy-api/openapi/yml" - "golang.org/x/sync/errgroup" "go.yaml.in/yaml/v3" + "golang.org/x/sync/errgroup" ) // MapGetter interface for syncing operations diff --git a/marshaller/unmarshaller.go b/marshaller/unmarshaller.go index c32b7e29..e1e04d9e 100644 --- a/marshaller/unmarshaller.go +++ b/marshaller/unmarshaller.go @@ -12,8 +12,8 @@ import ( "github.com/speakeasy-api/openapi/internal/interfaces" "github.com/speakeasy-api/openapi/validation" "github.com/speakeasy-api/openapi/yml" - "golang.org/x/sync/errgroup" "go.yaml.in/yaml/v3" + "golang.org/x/sync/errgroup" ) // Pre-computed reflection types for performance (reusing from populator.go where possible) diff --git a/overlay/jsonpath.go b/overlay/jsonpath.go index 8192dfcf..a6df9a96 100644 --- a/overlay/jsonpath.go +++ b/overlay/jsonpath.go @@ -17,6 +17,10 @@ type Queryable interface { Query(root *yaml.Node) []*yaml.Node } +// Compile-time layout-compatibility guard verifying that go.yaml.in/yaml/v3.Node +// and gopkg.in/yaml.v3.Node have identical memory footprints. +const _ = unsafe.Sizeof(yaml.Node{}) == unsafe.Sizeof(legacyYaml.Node{}) + type rfcJSONPathQueryable struct { path *jsonpath.JSONPath } @@ -25,11 +29,11 @@ func (r rfcJSONPathQueryable) Query(root *yaml.Node) []*yaml.Node { if r.path == nil { return []*yaml.Node{} } - legacyRoot := (*legacyYaml.Node)(unsafe.Pointer(root)) + legacyRoot := (*legacyYaml.Node)(unsafe.Pointer(root)) //nolint:gosec // zero-copy conversion between identical Node memory layouts legacyResults := r.path.Query(legacyRoot) results := make([]*yaml.Node, len(legacyResults)) for i, n := range legacyResults { - results[i] = (*yaml.Node)(unsafe.Pointer(n)) + results[i] = (*yaml.Node)(unsafe.Pointer(n)) //nolint:gosec // zero-copy conversion between identical Node memory layouts } return results } @@ -42,12 +46,12 @@ func (y yamlPathQueryable) Query(root *yaml.Node) []*yaml.Node { if y.path == nil { return []*yaml.Node{} } - legacyRoot := (*legacyYaml.Node)(unsafe.Pointer(root)) + legacyRoot := (*legacyYaml.Node)(unsafe.Pointer(root)) //nolint:gosec // zero-copy conversion between identical Node memory layouts // errors aren't actually possible from yamlpath. legacyResults, _ := y.path.Find(legacyRoot) results := make([]*yaml.Node, len(legacyResults)) for i, n := range legacyResults { - results[i] = (*yaml.Node)(unsafe.Pointer(n)) + results[i] = (*yaml.Node)(unsafe.Pointer(n)) //nolint:gosec // zero-copy conversion between identical Node memory layouts } return results } diff --git a/sequencedmap/map.go b/sequencedmap/map.go index e62639c6..282dbf1b 100644 --- a/sequencedmap/map.go +++ b/sequencedmap/map.go @@ -16,6 +16,8 @@ import ( "github.com/speakeasy-api/openapi/internal/utils" "github.com/speakeasy-api/openapi/yml" "go.yaml.in/yaml/v3" + gopkgyaml "gopkg.in/yaml.v3" + "unsafe" ) // OrderType represents the different ways to order iteration through the map @@ -684,8 +686,11 @@ func (m *Map[K, V]) MarshalJSON() ([]byte, error) { return buf.Bytes(), nil } -// UnmarshalYAML implements the yaml.Unmarshaler interface for the Map type. +// UnmarshalYAML implements the go.yaml.in/yaml/v3.Unmarshaler interface for the Map type. // It unmarshals YAML data into the sequenced map, preserving the order of keys. +// +// Callers decoding with the legacy gopkg.in/yaml.v3 package can wrap the map with +// AsLegacyYAML() to preserve order-preserving decoding during migration. func (m *Map[K, V]) UnmarshalYAML(value *yaml.Node) error { if value.Kind != yaml.MappingNode { return fmt.Errorf("cannot unmarshal %s into sequencedmap.Map", value.ShortTag()) @@ -729,8 +734,11 @@ func (m *Map[K, V]) UnmarshalYAML(value *yaml.Node) error { return nil } -// MarshalYAML implements the yaml.Marshaler interface for the Map type. +// MarshalYAML implements the go.yaml.in/yaml/v3.Marshaler interface for the Map type. // It marshals the sequenced map to YAML, preserving the order of keys. +// +// Callers encoding with the legacy gopkg.in/yaml.v3 package can wrap the map with +// AsLegacyYAML() to emit valid mapping nodes during migration. func (m *Map[K, V]) MarshalYAML() (interface{}, error) { if m == nil { return nil, nil @@ -752,6 +760,45 @@ func (m *Map[K, V]) MarshalYAML() (interface{}, error) { return yml.CreateMapNode(context.Background(), content), nil } +// LegacyYAMLAdapter wraps a Map to implement the Unmarshaler and Marshaler interfaces +// for the legacy gopkg.in/yaml.v3 package during ecosystem migration. +type LegacyYAMLAdapter[K comparable, V any] struct { + Map *Map[K, V] +} + +// AsLegacyYAML returns an adapter that implements gopkg.in/yaml.v3's Marshaler and Unmarshaler. +func (m *Map[K, V]) AsLegacyYAML() *LegacyYAMLAdapter[K, V] { + return &LegacyYAMLAdapter[K, V]{Map: m} +} + +// NewLegacyYAMLAdapter creates a new legacy YAML adapter for the given map. +func NewLegacyYAMLAdapter[K comparable, V any](m *Map[K, V]) *LegacyYAMLAdapter[K, V] { + return &LegacyYAMLAdapter[K, V]{Map: m} +} + +// UnmarshalYAML implements gopkg.in/yaml.v3.Unmarshaler by delegating to Map.UnmarshalYAML. +func (a *LegacyYAMLAdapter[K, V]) UnmarshalYAML(value *gopkgyaml.Node) error { + if a == nil || a.Map == nil { + return errors.New("cannot unmarshal into nil Map") + } + return a.Map.UnmarshalYAML((*yaml.Node)(unsafe.Pointer(value))) //nolint:gosec // zero-copy conversion between identical Node memory layouts +} + +// MarshalYAML implements gopkg.in/yaml.v3.Marshaler by delegating to Map.MarshalYAML and returning *gopkg.in/yaml.v3.Node. +func (a *LegacyYAMLAdapter[K, V]) MarshalYAML() (interface{}, error) { + if a == nil || a.Map == nil { + return nil, nil + } + res, err := a.Map.MarshalYAML() + if err != nil { + return nil, err + } + if node, ok := res.(*yaml.Node); ok { + return (*gopkgyaml.Node)(unsafe.Pointer(node)), nil //nolint:gosec // zero-copy conversion between identical Node memory layouts + } + return res, nil +} + // compareKeys provides a generic comparison function for keys func compareKeys[K any](a, b K) int { return strings.Compare(utils.AnyToString(a), utils.AnyToString(b)) diff --git a/sequencedmap/yaml_migration_test.go b/sequencedmap/yaml_migration_test.go new file mode 100644 index 00000000..4e20d636 --- /dev/null +++ b/sequencedmap/yaml_migration_test.go @@ -0,0 +1,81 @@ +package sequencedmap_test + +import ( + "testing" + + "github.com/speakeasy-api/openapi/sequencedmap" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + goyaml "go.yaml.in/yaml/v3" + legacyyaml "gopkg.in/yaml.v3" +) + +func TestSequencedMap_NativeYAMLv3RoundTrip(t *testing.T) { + t.Parallel() + + yamlData := `first: 1 +second: 2 +third: 3 +` + var m sequencedmap.Map[string, int] + err := goyaml.Unmarshal([]byte(yamlData), &m) + require.NoError(t, err) + + assert.Equal(t, 3, m.Len()) + keys := make([]string, 0, m.Len()) + for k := range m.All() { + keys = append(keys, k) + } + assert.Equal(t, []string{"first", "second", "third"}, keys) + + marshaled, err := goyaml.Marshal(&m) + require.NoError(t, err) + assert.Equal(t, yamlData, string(marshaled)) +} + +func TestSequencedMap_LegacyYAMLAdapterRoundTrip(t *testing.T) { + t.Parallel() + + yamlData := `first: 1 +second: 2 +third: 3 +` + var m sequencedmap.Map[string, int] + adapter := m.AsLegacyYAML() + + err := legacyyaml.Unmarshal([]byte(yamlData), adapter) + require.NoError(t, err) + + assert.Equal(t, 3, m.Len()) + keys := make([]string, 0, m.Len()) + for k := range m.All() { + keys = append(keys, k) + } + assert.Equal(t, []string{"first", "second", "third"}, keys) + + marshaled, err := legacyyaml.Marshal(adapter) + require.NoError(t, err) + assert.Equal(t, yamlData, string(marshaled)) +} + +func TestSequencedMap_LegacyDirectBehaviorDocumented(t *testing.T) { + t.Parallel() + + yamlData := `first: 1 +second: 2 +` + // Direct unmarshal with legacy yaml does not invoke go.yaml.in/yaml/v3 UnmarshalYAML + var directMap sequencedmap.Map[string, int] + err := legacyyaml.Unmarshal([]byte(yamlData), &directMap) + require.NoError(t, err) + assert.Equal(t, 0, directMap.Len(), "unmarshaling without adapter leaves map empty under legacy yaml") + + // Wrapping with AsLegacyYAML restores order-preserving decoding + var adaptedMap sequencedmap.Map[string, int] + err = legacyyaml.Unmarshal([]byte(yamlData), adaptedMap.AsLegacyYAML()) + require.NoError(t, err) + assert.Equal(t, 2, adaptedMap.Len()) + v, ok := adaptedMap.Get("first") + assert.True(t, ok) + assert.Equal(t, 1, v) +} diff --git a/validation/fix.go b/validation/fix.go index bd272af8..21ddd3ca 100644 --- a/validation/fix.go +++ b/validation/fix.go @@ -1,6 +1,9 @@ package validation -import "go.yaml.in/yaml/v3" +import ( + "go.yaml.in/yaml/v3" + gopkgyaml "gopkg.in/yaml.v3" +) // PromptType describes what kind of user input a fix needs. type PromptType int @@ -75,3 +78,12 @@ type NodeFix interface { // rootNode is the document root node. ApplyNode(rootNode *yaml.Node) error } + +// LegacyNodeFix is an optional interface for fixes that implement ApplyNode +// with *gopkg.in/yaml.v3.Node. The fix engine adapts these fixes during migration. +type LegacyNodeFix interface { + Fix + + // ApplyNode applies the fix directly to the legacy YAML node tree. + ApplyNode(rootNode *gopkgyaml.Node) error +} diff --git a/values/value.go b/values/value.go index 4beb8c4b..5e0fc5b4 100644 --- a/values/value.go +++ b/values/value.go @@ -1,6 +1,21 @@ package values -import "go.yaml.in/yaml/v3" +import ( + "unsafe" + + "go.yaml.in/yaml/v3" + gopkgyaml "gopkg.in/yaml.v3" +) // Value represents a raw value in an OpenAPI or Arazzo document. type Value = *yaml.Node + +// FromLegacyNode converts a legacy gopkg.in/yaml.v3.Node pointer to a values.Value. +func FromLegacyNode(n *gopkgyaml.Node) Value { + return (*yaml.Node)(unsafe.Pointer(n)) //nolint:gosec // zero-copy conversion between identical Node memory layouts +} + +// ToLegacyNode converts a values.Value to a legacy gopkg.in/yaml.v3.Node pointer. +func ToLegacyNode(v Value) *gopkgyaml.Node { + return (*gopkgyaml.Node)(unsafe.Pointer(v)) //nolint:gosec // zero-copy conversion between identical Node memory layouts +} diff --git a/values/value_test.go b/values/value_test.go new file mode 100644 index 00000000..5549b0c9 --- /dev/null +++ b/values/value_test.go @@ -0,0 +1,30 @@ +package values_test + +import ( + "testing" + + "github.com/speakeasy-api/openapi/values" + "github.com/stretchr/testify/assert" + goyaml "go.yaml.in/yaml/v3" + legacyyaml "gopkg.in/yaml.v3" +) + +func TestValues_LegacyConversion(t *testing.T) { + t.Parallel() + + legacyNode := &legacyyaml.Node{ + Kind: legacyyaml.ScalarNode, + Value: "test-value", + Tag: "!!str", + } + + val := values.FromLegacyNode(legacyNode) + assert.NotNil(t, val) + assert.Equal(t, "test-value", val.Value) + assert.Equal(t, goyaml.ScalarNode, val.Kind) + + convertedBack := values.ToLegacyNode(val) + assert.NotNil(t, convertedBack) + assert.Equal(t, "test-value", convertedBack.Value) + assert.Equal(t, legacyyaml.ScalarNode, convertedBack.Kind) +} From 1f876e09ff4f1ad3d27dc3b7aed2cec41d997050 Mon Sep 17 00:00:00 2001 From: AdamMagued Date: Wed, 14 Oct 2026 07:19:23 +0300 Subject: [PATCH 03/14] fix: preserve legacy node types in jsonpointer and support nested legacy unmarshalers in sequencedmap --- jsonpointer/jsonpointer.go | 44 ++++++++++++-- jsonpointer/legacy_yaml_test.go | 8 +++ linter/fix/legacy_fix_test.go | 18 +++++- sequencedmap/map.go | 93 +++++++++++++++++++++++++++-- sequencedmap/yaml_migration_test.go | 66 ++++++++++++++++++++ 5 files changed, 218 insertions(+), 11 deletions(-) diff --git a/jsonpointer/jsonpointer.go b/jsonpointer/jsonpointer.go index aadafa4b..1b4508c7 100644 --- a/jsonpointer/jsonpointer.go +++ b/jsonpointer/jsonpointer.go @@ -6,12 +6,12 @@ import ( "reflect" "strconv" "strings" + "unsafe" "github.com/speakeasy-api/openapi/errors" "github.com/speakeasy-api/openapi/internal/interfaces" "go.yaml.in/yaml/v3" gopkgyaml "gopkg.in/yaml.v3" - "unsafe" ) const ( @@ -74,6 +74,10 @@ func (j JSONPointer) Validate() error { // WithStructTags can be used to set the type of struct tags to use when navigating structs. // If the struct implements any of the Navigable interfaces it will be used to navigate the source. func GetTarget(source any, pointer JSONPointer, opts ...option) (any, error) { + _, isLegacyPtr := source.(*gopkgyaml.Node) + _, isLegacyVal := source.(gopkgyaml.Node) + isLegacy := isLegacyPtr || isLegacyVal + o := getOptions(opts) stack, err := pointer.getNavigationStack() @@ -86,6 +90,12 @@ func GetTarget(source any, pointer JSONPointer, opts ...option) (any, error) { return nil, err } + if isLegacy { + if node, ok := target.(*yaml.Node); ok { + return (*gopkgyaml.Node)(unsafe.Pointer(node)), nil //nolint:gosec // zero-copy conversion between identical Node memory layouts + } + } + return target, nil } @@ -109,10 +119,22 @@ func getCurrentStackTarget(source any, stack []navigationPart, currentPath strin return getYamlNodeTarget(&yamlNode, navigationPart{}, []navigationPart{}, currentPath, o) } if legacyNode, ok := source.(*gopkgyaml.Node); ok { - return getYamlNodeTarget((*yaml.Node)(unsafe.Pointer(legacyNode)), navigationPart{}, []navigationPart{}, currentPath, o) //nolint:gosec // zero-copy conversion between identical Node memory layouts + res, st, err := getYamlNodeTarget((*yaml.Node)(unsafe.Pointer(legacyNode)), navigationPart{}, []navigationPart{}, currentPath, o) //nolint:gosec // zero-copy conversion between identical Node memory layouts + if err == nil { + if n, ok := res.(*yaml.Node); ok { + return (*gopkgyaml.Node)(unsafe.Pointer(n)), st, nil //nolint:gosec // zero-copy conversion between identical Node memory layouts + } + } + return res, st, err } if legacyNode, ok := source.(gopkgyaml.Node); ok { - return getYamlNodeTarget((*yaml.Node)(unsafe.Pointer(&legacyNode)), navigationPart{}, []navigationPart{}, currentPath, o) //nolint:gosec // zero-copy conversion between identical Node memory layouts + res, st, err := getYamlNodeTarget((*yaml.Node)(unsafe.Pointer(&legacyNode)), navigationPart{}, []navigationPart{}, currentPath, o) //nolint:gosec // zero-copy conversion between identical Node memory layouts + if err == nil { + if n, ok := res.(*yaml.Node); ok { + return (*gopkgyaml.Node)(unsafe.Pointer(n)), st, nil //nolint:gosec // zero-copy conversion between identical Node memory layouts + } + } + return res, st, err } return source, stack, nil } @@ -134,10 +156,22 @@ func getTarget(source any, currentPart navigationPart, stack []navigationPart, c return getYamlNodeTarget(&yamlNode, currentPart, stack, currentPath, o) } if legacyNode, ok := source.(*gopkgyaml.Node); ok { - return getYamlNodeTarget((*yaml.Node)(unsafe.Pointer(legacyNode)), currentPart, stack, currentPath, o) //nolint:gosec // zero-copy conversion between identical Node memory layouts + res, st, err := getYamlNodeTarget((*yaml.Node)(unsafe.Pointer(legacyNode)), currentPart, stack, currentPath, o) //nolint:gosec // zero-copy conversion between identical Node memory layouts + if err == nil { + if n, ok := res.(*yaml.Node); ok { + return (*gopkgyaml.Node)(unsafe.Pointer(n)), st, nil //nolint:gosec // zero-copy conversion between identical Node memory layouts + } + } + return res, st, err } if legacyNode, ok := source.(gopkgyaml.Node); ok { - return getYamlNodeTarget((*yaml.Node)(unsafe.Pointer(&legacyNode)), currentPart, stack, currentPath, o) //nolint:gosec // zero-copy conversion between identical Node memory layouts + res, st, err := getYamlNodeTarget((*yaml.Node)(unsafe.Pointer(&legacyNode)), currentPart, stack, currentPath, o) //nolint:gosec // zero-copy conversion between identical Node memory layouts + if err == nil { + if n, ok := res.(*yaml.Node); ok { + return (*gopkgyaml.Node)(unsafe.Pointer(n)), st, nil //nolint:gosec // zero-copy conversion between identical Node memory layouts + } + } + return res, st, err } sourceType := reflect.TypeOf(source) diff --git a/jsonpointer/legacy_yaml_test.go b/jsonpointer/legacy_yaml_test.go index e9f6c659..5111aa5b 100644 --- a/jsonpointer/legacy_yaml_test.go +++ b/jsonpointer/legacy_yaml_test.go @@ -28,10 +28,18 @@ paths: target, err := jsonpointer.GetTarget(&root, ptr) require.NoError(t, err) require.NotNil(t, target) + targetNode, ok := target.(*legacyyaml.Node) + require.True(t, ok, "expected *legacyyaml.Node from pointer input, got %T", target) + assert.Equal(t, legacyyaml.ScalarNode, targetNode.Kind) + assert.Equal(t, "Test API", targetNode.Value) // Also test value struct version target2, err := jsonpointer.GetTarget(root, ptr) require.NoError(t, err) require.NotNil(t, target2) + targetNode2, ok := target2.(*legacyyaml.Node) + require.True(t, ok, "expected *legacyyaml.Node from value input, got %T", target2) + assert.Equal(t, legacyyaml.ScalarNode, targetNode2.Kind) + assert.Equal(t, "Test API", targetNode2.Value) assert.Equal(t, target, target2) } diff --git a/linter/fix/legacy_fix_test.go b/linter/fix/legacy_fix_test.go index 7357780d..9db9198f 100644 --- a/linter/fix/legacy_fix_test.go +++ b/linter/fix/legacy_fix_test.go @@ -14,10 +14,18 @@ import ( type mockLegacyNodeFix struct { mockFix legacyNodeApplied bool + receivedKind legacyyaml.Kind + receivedContent []string } func (f *mockLegacyNodeFix) ApplyNode(rootNode *legacyyaml.Node) error { f.legacyNodeApplied = true + if rootNode != nil { + f.receivedKind = rootNode.Kind + for _, child := range rootNode.Content { + f.receivedContent = append(f.receivedContent, child.Value) + } + } return nil } @@ -25,11 +33,19 @@ func TestApplyNodeFix_WithLegacyNodeFix(t *testing.T) { t.Parallel() f := &mockLegacyNodeFix{mockFix: mockFix{description: "legacy node fix"}} - rootNode := &yaml.Node{Kind: yaml.MappingNode} + rootNode := &yaml.Node{ + Kind: yaml.MappingNode, + Content: []*yaml.Node{ + {Kind: yaml.ScalarNode, Value: "title"}, + {Kind: yaml.ScalarNode, Value: "Test API"}, + }, + } doc := &openapi.OpenAPI{} err := fix.ApplyNodeFix(f, doc, rootNode) require.NoError(t, err, "ApplyNodeFix should not fail") assert.True(t, f.legacyNodeApplied, "Legacy ApplyNode should be called") + assert.Equal(t, legacyyaml.MappingNode, f.receivedKind) + assert.Equal(t, []string{"title", "Test API"}, f.receivedContent) assert.False(t, f.applied, "Apply should not be called") } diff --git a/sequencedmap/map.go b/sequencedmap/map.go index 282dbf1b..9dbf5c44 100644 --- a/sequencedmap/map.go +++ b/sequencedmap/map.go @@ -11,13 +11,13 @@ import ( "reflect" "slices" "strings" + "unsafe" "github.com/speakeasy-api/openapi/internal/interfaces" "github.com/speakeasy-api/openapi/internal/utils" "github.com/speakeasy-api/openapi/yml" "go.yaml.in/yaml/v3" gopkgyaml "gopkg.in/yaml.v3" - "unsafe" ) // OrderType represents the different ways to order iteration through the map @@ -712,13 +712,13 @@ func (m *Map[K, V]) UnmarshalYAML(value *yaml.Node) error { // Unmarshal the key var key K - if err := keyNode.Decode(&key); err != nil { + if err := decodeYAMLNode(keyNode, &key); err != nil { return fmt.Errorf("failed to decode key: %w", err) } // Unmarshal the value var val V - if err := valueNode.Decode(&val); err != nil { + if err := decodeYAMLNode(valueNode, &val); err != nil { return fmt.Errorf("failed to decode value for key %v: %w", key, err) } @@ -747,11 +747,11 @@ func (m *Map[K, V]) MarshalYAML() (interface{}, error) { content := make([]*yaml.Node, 0, len(m.l)*2) for _, element := range m.l { var keyNode yaml.Node - if err := keyNode.Encode(element.Key); err != nil { + if err := encodeYAMLNode(element.Key, &keyNode); err != nil { return nil, err } var valueNode yaml.Node - if err := valueNode.Encode(element.Value); err != nil { + if err := encodeYAMLNode(element.Value, &valueNode); err != nil { return nil, err } content = append(content, &keyNode, &valueNode) @@ -760,6 +760,89 @@ func (m *Map[K, V]) MarshalYAML() (interface{}, error) { return yml.CreateMapNode(context.Background(), content), nil } +func decodeYAMLNode[T any](node *yaml.Node, target *T) error { + if u, ok := any(target).(interface{ UnmarshalYAML(*gopkgyaml.Node) error }); ok { + return u.UnmarshalYAML((*gopkgyaml.Node)(unsafe.Pointer(node))) //nolint:gosec // zero-copy conversion between identical Node memory layouts + } + + targetVal := reflect.ValueOf(target).Elem() + if targetVal.Kind() == reflect.Pointer && targetVal.IsNil() { + elemType := targetVal.Type().Elem() + newVal := reflect.New(elemType) + if u, ok := newVal.Interface().(interface{ UnmarshalYAML(*gopkgyaml.Node) error }); ok { + err := u.UnmarshalYAML((*gopkgyaml.Node)(unsafe.Pointer(node))) //nolint:gosec // zero-copy conversion between identical Node memory layouts + if err != nil { + return err + } + targetVal.Set(newVal) + return nil + } + } else if targetVal.Kind() == reflect.Pointer && !targetVal.IsNil() { + if u, ok := targetVal.Interface().(interface{ UnmarshalYAML(*gopkgyaml.Node) error }); ok { + return u.UnmarshalYAML((*gopkgyaml.Node)(unsafe.Pointer(node))) //nolint:gosec // zero-copy conversion between identical Node memory layouts + } + } + + return node.Decode(target) +} + +func encodeYAMLNode(val any, node *yaml.Node) error { + if val == nil { + node.Kind = yaml.ScalarNode + node.Tag = "!!null" + node.Value = "null" + return nil + } + + if m, ok := val.(interface{ MarshalYAML() (interface{}, error) }); ok { + res, err := m.MarshalYAML() + if err != nil { + return err + } + if legacyNode, ok := res.(*gopkgyaml.Node); ok { + *node = *((*yaml.Node)(unsafe.Pointer(legacyNode))) //nolint:gosec // zero-copy conversion between identical Node memory layouts + return nil + } + if legacyNode, ok := res.(gopkgyaml.Node); ok { + *node = *((*yaml.Node)(unsafe.Pointer(&legacyNode))) //nolint:gosec // zero-copy conversion between identical Node memory layouts + return nil + } + return node.Encode(res) + } + + valType := reflect.TypeOf(val) + if valType.Kind() != reflect.Pointer { + ptrVal := reflect.New(valType) + ptrVal.Elem().Set(reflect.ValueOf(val)) + if m, ok := ptrVal.Interface().(interface{ MarshalYAML() (interface{}, error) }); ok { + res, err := m.MarshalYAML() + if err != nil { + return err + } + if legacyNode, ok := res.(*gopkgyaml.Node); ok { + *node = *((*yaml.Node)(unsafe.Pointer(legacyNode))) //nolint:gosec // zero-copy conversion between identical Node memory layouts + return nil + } + if legacyNode, ok := res.(gopkgyaml.Node); ok { + *node = *((*yaml.Node)(unsafe.Pointer(&legacyNode))) //nolint:gosec // zero-copy conversion between identical Node memory layouts + return nil + } + return node.Encode(res) + } + } + + if legacyNode, ok := val.(*gopkgyaml.Node); ok { + *node = *((*yaml.Node)(unsafe.Pointer(legacyNode))) //nolint:gosec // zero-copy conversion between identical Node memory layouts + return nil + } + if legacyNode, ok := val.(gopkgyaml.Node); ok { + *node = *((*yaml.Node)(unsafe.Pointer(&legacyNode))) //nolint:gosec // zero-copy conversion between identical Node memory layouts + return nil + } + + return node.Encode(val) +} + // LegacyYAMLAdapter wraps a Map to implement the Unmarshaler and Marshaler interfaces // for the legacy gopkg.in/yaml.v3 package during ecosystem migration. type LegacyYAMLAdapter[K comparable, V any] struct { diff --git a/sequencedmap/yaml_migration_test.go b/sequencedmap/yaml_migration_test.go index 4e20d636..746bfdda 100644 --- a/sequencedmap/yaml_migration_test.go +++ b/sequencedmap/yaml_migration_test.go @@ -79,3 +79,69 @@ second: 2 assert.True(t, ok) assert.Equal(t, 1, v) } + +type legacyCustomValue struct { + customField string + receivedKind legacyyaml.Kind +} + +func (v *legacyCustomValue) UnmarshalYAML(value *legacyyaml.Node) error { + v.receivedKind = value.Kind + v.customField = "custom:" + value.Value + return nil +} + +func (v legacyCustomValue) MarshalYAML() (interface{}, error) { + return &legacyyaml.Node{ + Kind: legacyyaml.ScalarNode, + Value: v.customField, + }, nil +} + +func TestSequencedMap_LegacyValueUnmarshaler(t *testing.T) { + t.Parallel() + + yamlData := `first: alpha +second: beta +` + var m sequencedmap.Map[string, legacyCustomValue] + err := goyaml.Unmarshal([]byte(yamlData), &m) + require.NoError(t, err) + assert.Equal(t, 2, m.Len()) + + v1, ok := m.Get("first") + require.True(t, ok) + assert.Equal(t, "custom:alpha", v1.customField) + assert.Equal(t, legacyyaml.ScalarNode, v1.receivedKind) + + v2, ok := m.Get("second") + require.True(t, ok) + assert.Equal(t, "custom:beta", v2.customField) + assert.Equal(t, legacyyaml.ScalarNode, v2.receivedKind) + + marshaled, err := goyaml.Marshal(&m) + require.NoError(t, err) + assert.Equal(t, "first: custom:alpha\nsecond: custom:beta\n", string(marshaled)) +} + +func TestSequencedMap_LegacyPointerValueUnmarshalerWithAdapter(t *testing.T) { + t.Parallel() + + yamlData := `first: alpha +second: beta +` + var m sequencedmap.Map[string, *legacyCustomValue] + err := legacyyaml.Unmarshal([]byte(yamlData), m.AsLegacyYAML()) + require.NoError(t, err) + assert.Equal(t, 2, m.Len()) + + v1, ok := m.Get("first") + require.True(t, ok) + require.NotNil(t, v1) + assert.Equal(t, "custom:alpha", v1.customField) + assert.Equal(t, legacyyaml.ScalarNode, v1.receivedKind) + + marshaled, err := legacyyaml.Marshal(m.AsLegacyYAML()) + require.NoError(t, err) + assert.Equal(t, "first: custom:alpha\nsecond: custom:beta\n", string(marshaled)) +} From 7a1a246ec663cf70601657b0842e7f6ce95b64eb Mon Sep 17 00:00:00 2001 From: AdamMagued Date: Wed, 14 Oct 2026 07:24:03 +0300 Subject: [PATCH 04/14] cmd/openapi: update root and customrules dependency pseudo-versions --- cmd/openapi/go.mod | 4 ++-- cmd/openapi/go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/openapi/go.mod b/cmd/openapi/go.mod index ff23d2b0..e0a709f5 100644 --- a/cmd/openapi/go.mod +++ b/cmd/openapi/go.mod @@ -6,8 +6,8 @@ require ( charm.land/bubbles/v2 v2.2.1 charm.land/bubbletea/v2 v2.0.10 charm.land/lipgloss/v2 v2.0.6 - github.com/speakeasy-api/openapi v1.25.5-0.20261006003233-cb82fbf0afec - github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261006003233-cb82fbf0afec + github.com/speakeasy-api/openapi v1.25.6-0.20261014041923-1f876e09ff4f + github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261014041923-1f876e09ff4f github.com/spf13/cobra v1.10.2 github.com/stretchr/testify v1.12.1 go.yaml.in/yaml/v3 v3.0.5 diff --git a/cmd/openapi/go.sum b/cmd/openapi/go.sum index df00d166..fc587675 100644 --- a/cmd/openapi/go.sum +++ b/cmd/openapi/go.sum @@ -81,10 +81,10 @@ github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/speakeasy-api/jsonpath v0.6.3 h1:c+QPwzAOdrWvzycuc9HFsIZcxKIaWcNpC+xhOW9rJxU= github.com/speakeasy-api/jsonpath v0.6.3/go.mod h1:2cXloNuQ+RSXi5HTRaeBh7JEmjRXTiaKpFTdZiL7URI= -github.com/speakeasy-api/openapi v1.25.5-0.20261006003233-cb82fbf0afec h1:6kKVHb/RFni9Q6WOTohAVErZjrSJQUZWuG00CwPrYW4= -github.com/speakeasy-api/openapi v1.25.5-0.20261006003233-cb82fbf0afec/go.mod h1:1I7UiUg31bjkKGvUIy3p2y6rbKCAViWE2NEdVgbjkUE= -github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261006003233-cb82fbf0afec h1:vKAi8SAPdcEaFliQ01JUV/WK29eys291N2YR6hXKFXM= -github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261006003233-cb82fbf0afec/go.mod h1:qWKUonRxOUwjmdMiZNmOg9GNUWms7/2VdIkFq0qVpzU= +github.com/speakeasy-api/openapi v1.25.6-0.20261014041923-1f876e09ff4f h1:apJ8iD2ekKIYwESjSKsv4fXrfn3/0KkD21dipaJ4rtQ= +github.com/speakeasy-api/openapi v1.25.6-0.20261014041923-1f876e09ff4f/go.mod h1:S6+UCkeeRABWizHcwmgGepTLamZM2Xv3m3YNSc2Hrp8= +github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261014041923-1f876e09ff4f h1:L3ECBhL6cI2wgx3Y498CBgBEg3bx9anHEDb0eAxWGlI= +github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261014041923-1f876e09ff4f/go.mod h1:3OXTNvxoTf3COrcuhxGuZPj3vb9SMEXCgV2r6tGCG5M= github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY= From 90410c909f576c2e81d7cfae538d0a79783f40ca Mon Sep 17 00:00:00 2001 From: Tristan Cartledge Date: Fri, 16 Oct 2026 09:21:46 +1000 Subject: [PATCH 05/14] fix: encode typed-nil legacy yaml nodes as null in sequencedmap --- sequencedmap/map.go | 84 +++++++++++++++++------------ sequencedmap/yaml_migration_test.go | 29 ++++++++++ 2 files changed, 78 insertions(+), 35 deletions(-) diff --git a/sequencedmap/map.go b/sequencedmap/map.go index 9dbf5c44..efd279f9 100644 --- a/sequencedmap/map.go +++ b/sequencedmap/map.go @@ -787,27 +787,15 @@ func decodeYAMLNode[T any](node *yaml.Node, target *T) error { } func encodeYAMLNode(val any, node *yaml.Node) error { - if val == nil { - node.Kind = yaml.ScalarNode - node.Tag = "!!null" - node.Value = "null" + // Match the yaml encoder: nil values and typed-nil pointers encode as null + // before any Marshaler is consulted. + if isNilValue(val) { + setNullNode(node) return nil } if m, ok := val.(interface{ MarshalYAML() (interface{}, error) }); ok { - res, err := m.MarshalYAML() - if err != nil { - return err - } - if legacyNode, ok := res.(*gopkgyaml.Node); ok { - *node = *((*yaml.Node)(unsafe.Pointer(legacyNode))) //nolint:gosec // zero-copy conversion between identical Node memory layouts - return nil - } - if legacyNode, ok := res.(gopkgyaml.Node); ok { - *node = *((*yaml.Node)(unsafe.Pointer(&legacyNode))) //nolint:gosec // zero-copy conversion between identical Node memory layouts - return nil - } - return node.Encode(res) + return encodeMarshalerResult(m, node) } valType := reflect.TypeOf(val) @@ -815,32 +803,58 @@ func encodeYAMLNode(val any, node *yaml.Node) error { ptrVal := reflect.New(valType) ptrVal.Elem().Set(reflect.ValueOf(val)) if m, ok := ptrVal.Interface().(interface{ MarshalYAML() (interface{}, error) }); ok { - res, err := m.MarshalYAML() - if err != nil { - return err - } - if legacyNode, ok := res.(*gopkgyaml.Node); ok { - *node = *((*yaml.Node)(unsafe.Pointer(legacyNode))) //nolint:gosec // zero-copy conversion between identical Node memory layouts - return nil - } - if legacyNode, ok := res.(gopkgyaml.Node); ok { - *node = *((*yaml.Node)(unsafe.Pointer(&legacyNode))) //nolint:gosec // zero-copy conversion between identical Node memory layouts - return nil - } - return node.Encode(res) + return encodeMarshalerResult(m, node) } } - if legacyNode, ok := val.(*gopkgyaml.Node); ok { - *node = *((*yaml.Node)(unsafe.Pointer(legacyNode))) //nolint:gosec // zero-copy conversion between identical Node memory layouts + if copyLegacyNode(val, node) { return nil } - if legacyNode, ok := val.(gopkgyaml.Node); ok { - *node = *((*yaml.Node)(unsafe.Pointer(&legacyNode))) //nolint:gosec // zero-copy conversion between identical Node memory layouts + + return node.Encode(val) +} + +func encodeMarshalerResult(m interface{ MarshalYAML() (interface{}, error) }, node *yaml.Node) error { + res, err := m.MarshalYAML() + if err != nil { + return err + } + if isNilValue(res) { + setNullNode(node) + return nil + } + if copyLegacyNode(res, node) { return nil } + return node.Encode(res) +} - return node.Encode(val) +// copyLegacyNode copies a non-nil legacy gopkg.in/yaml.v3 node into node and reports whether val was one. +func copyLegacyNode(val any, node *yaml.Node) bool { + switch legacyNode := val.(type) { + case *gopkgyaml.Node: + *node = *((*yaml.Node)(unsafe.Pointer(legacyNode))) //nolint:gosec // zero-copy conversion between identical Node memory layouts + return true + case gopkgyaml.Node: + *node = *((*yaml.Node)(unsafe.Pointer(&legacyNode))) //nolint:gosec // zero-copy conversion between identical Node memory layouts + return true + default: + return false + } +} + +func isNilValue(val any) bool { + if val == nil { + return true + } + rv := reflect.ValueOf(val) + return rv.Kind() == reflect.Pointer && rv.IsNil() +} + +func setNullNode(node *yaml.Node) { + node.Kind = yaml.ScalarNode + node.Tag = "!!null" + node.Value = "null" } // LegacyYAMLAdapter wraps a Map to implement the Unmarshaler and Marshaler interfaces diff --git a/sequencedmap/yaml_migration_test.go b/sequencedmap/yaml_migration_test.go index 746bfdda..0d6fbbf2 100644 --- a/sequencedmap/yaml_migration_test.go +++ b/sequencedmap/yaml_migration_test.go @@ -124,6 +124,35 @@ second: beta assert.Equal(t, "first: custom:alpha\nsecond: custom:beta\n", string(marshaled)) } +func TestSequencedMap_NilLegacyNodeValueMarshalsNull_Success(t *testing.T) { + t.Parallel() + + m := sequencedmap.New( + sequencedmap.NewElem[string, *legacyyaml.Node]("empty", nil), + sequencedmap.NewElem("set", &legacyyaml.Node{Kind: legacyyaml.ScalarNode, Value: "value"}), + ) + + marshaled, err := goyaml.Marshal(m) + require.NoError(t, err, "marshal should not panic on typed-nil legacy nodes") + assert.Equal(t, "empty: null\nset: value\n", string(marshaled), "typed-nil legacy node should encode as null") +} + +type nilLegacyNodeMarshaler struct{} + +func (nilLegacyNodeMarshaler) MarshalYAML() (interface{}, error) { + return (*legacyyaml.Node)(nil), nil +} + +func TestSequencedMap_MarshalerReturningNilLegacyNode_Success(t *testing.T) { + t.Parallel() + + m := sequencedmap.New(sequencedmap.NewElem("key", nilLegacyNodeMarshaler{})) + + marshaled, err := goyaml.Marshal(m) + require.NoError(t, err, "marshal should not panic when a marshaler returns a nil legacy node") + assert.Equal(t, "key: null\n", string(marshaled), "nil legacy node result should encode as null") +} + func TestSequencedMap_LegacyPointerValueUnmarshalerWithAdapter(t *testing.T) { t.Parallel() From d4071aaeea8c81400ae535588b9fd6b441cdd037 Mon Sep 17 00:00:00 2001 From: Tristan Cartledge Date: Fri, 16 Oct 2026 09:54:38 +1000 Subject: [PATCH 06/14] chore: point customrules at yaml migration root module pseudo-version --- openapi/linter/customrules/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openapi/linter/customrules/go.mod b/openapi/linter/customrules/go.mod index 5e7d1cd2..10daf064 100644 --- a/openapi/linter/customrules/go.mod +++ b/openapi/linter/customrules/go.mod @@ -8,7 +8,7 @@ require ( github.com/dop251/goja v0.0.0-20260106131823-651366fbe6e3 github.com/evanw/esbuild v0.28.2 github.com/go-sourcemap/sourcemap v2.1.4+incompatible - github.com/speakeasy-api/openapi v1.25.6-0.20261015113746-577889a836ef + github.com/speakeasy-api/openapi v1.25.7-0.20261015232146-90410c909f57 github.com/stretchr/testify v1.12.1 go.yaml.in/yaml/v3 v3.0.5 ) From abb9980345749719cd2559c67380341f74073f59 Mon Sep 17 00:00:00 2001 From: Tristan Cartledge Date: Fri, 16 Oct 2026 09:55:33 +1000 Subject: [PATCH 07/14] chore: point cmd/openapi at yaml migration pseudo-versions --- cmd/openapi/go.mod | 4 ++-- cmd/openapi/go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/openapi/go.mod b/cmd/openapi/go.mod index 21cb9e04..c3d0957c 100644 --- a/cmd/openapi/go.mod +++ b/cmd/openapi/go.mod @@ -6,8 +6,8 @@ require ( charm.land/bubbles/v2 v2.2.1 charm.land/bubbletea/v2 v2.1.0 charm.land/lipgloss/v2 v2.0.6 - github.com/speakeasy-api/openapi v1.25.6-0.20261014041923-1f876e09ff4f - github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261014041923-1f876e09ff4f + github.com/speakeasy-api/openapi v1.25.7-0.20261015235438-d4071aaeea8c + github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261015235438-d4071aaeea8c github.com/spf13/cobra v1.10.2 github.com/stretchr/testify v1.12.1 go.yaml.in/yaml/v3 v3.0.5 diff --git a/cmd/openapi/go.sum b/cmd/openapi/go.sum index 2bb4177b..bf53389b 100644 --- a/cmd/openapi/go.sum +++ b/cmd/openapi/go.sum @@ -81,10 +81,10 @@ github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/speakeasy-api/jsonpath v0.6.3 h1:c+QPwzAOdrWvzycuc9HFsIZcxKIaWcNpC+xhOW9rJxU= github.com/speakeasy-api/jsonpath v0.6.3/go.mod h1:2cXloNuQ+RSXi5HTRaeBh7JEmjRXTiaKpFTdZiL7URI= -github.com/speakeasy-api/openapi v1.25.6-0.20261015113746-577889a836ef h1:cMa3ZXymDiZh86HUAUiP3K2q0NQZ0kR1D6uxOgmGOxY= -github.com/speakeasy-api/openapi v1.25.6-0.20261015113746-577889a836ef/go.mod h1:d/ByHr1U7TzL4A/5+jlmsIzJBHos7uBnQ/gOTBPIHe8= -github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261015113746-577889a836ef h1:w1oKZTylY8VHjBBW7XJEEnVXzTt6TVZUUH2mGe2cf6w= -github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261015113746-577889a836ef/go.mod h1:XPaL7dPtwolz7eTCDU9GJzUloxpnN9wVdgD0kKvwuho= +github.com/speakeasy-api/openapi v1.25.7-0.20261015235438-d4071aaeea8c h1:Yau+Wz2ozxt0GwqxNoCUHeJFx4kBLjcIL/Vm4blY1eI= +github.com/speakeasy-api/openapi v1.25.7-0.20261015235438-d4071aaeea8c/go.mod h1:Cs8RBu1k366uWsQV12FkC9t+kwIvljLg7uqAxWoYQa0= +github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261015235438-d4071aaeea8c h1:US9yxNCoGW8B9KdWqVpXaIBsWbRLUp2nilz3TIl+y94= +github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261015235438-d4071aaeea8c/go.mod h1:/4DC9LHwOTinFl/jYZi3XlWLDefDC+ILM2ncjSVedTM= github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY= From 80abc8c2e0769f802bb79c1a2746a8b0ec8e0498 Mon Sep 17 00:00:00 2001 From: Tristan Cartledge Date: Fri, 16 Oct 2026 09:55:45 +1000 Subject: [PATCH 08/14] chore: tidy converter tests module --- openapi/linter/converter/tests/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openapi/linter/converter/tests/go.mod b/openapi/linter/converter/tests/go.mod index 6060c732..eeec52b1 100644 --- a/openapi/linter/converter/tests/go.mod +++ b/openapi/linter/converter/tests/go.mod @@ -8,7 +8,7 @@ replace ( ) require ( - github.com/speakeasy-api/openapi v1.25.6-0.20261015113746-577889a836ef + github.com/speakeasy-api/openapi v1.25.7-0.20261015232146-90410c909f57 github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261015113746-577889a836ef github.com/stretchr/testify v1.12.1 ) From f0b9f7b1815a764d6ef8d52539df0b92cb0a9374 Mon Sep 17 00:00:00 2001 From: Tristan Cartledge Date: Fri, 16 Oct 2026 10:25:23 +1000 Subject: [PATCH 09/14] refactor: drop gopkg.in/yaml.v3 bridge code now jsonpath and yamlpath use go.yaml.in/yaml/v3 --- go.mod | 11 +- go.sum | 71 +++-------- hashing/hashing.go | 6 - hashing/yaml_migration_test.go | 41 ------ jsonpointer/jsonpointer.go | 48 ------- jsonpointer/legacy_yaml_test.go | 45 ------- linter/fix/engine.go | 12 -- linter/fix/legacy_fix_test.go | 51 -------- marshaller/coremodel_jsonpath_test.go | 13 +- overlay/apply_test.go | 6 +- overlay/jsonpath.go | 36 +----- sequencedmap/map.go | 156 +---------------------- sequencedmap/yaml_migration_test.go | 176 -------------------------- validation/fix.go | 14 +- values/value.go | 17 +-- values/value_test.go | 30 ----- 16 files changed, 39 insertions(+), 694 deletions(-) delete mode 100644 hashing/yaml_migration_test.go delete mode 100644 jsonpointer/legacy_yaml_test.go delete mode 100644 linter/fix/legacy_fix_test.go delete mode 100644 sequencedmap/yaml_migration_test.go delete mode 100644 values/value_test.go diff --git a/go.mod b/go.mod index 15268051..429ccf52 100644 --- a/go.mod +++ b/go.mod @@ -5,22 +5,17 @@ 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.6.3 + github.com/speakeasy-api/jsonpath v0.6.4-0.20261016002236-43d52ac89b20 + github.com/speakeasy-api/yaml-jsonpath v0.0.0-20261016002013-07e5f48e6d17 github.com/stretchr/testify v1.12.1 - github.com/vmware-labs/yaml-jsonpath v0.3.2 go.yaml.in/yaml/v3 v3.0.5 golang.org/x/sync v0.24.0 golang.org/x/text v0.43.0 - gopkg.in/yaml.v3 v3.0.1 ) require ( github.com/dlclark/regexp2 v1.11.4 // indirect - github.com/dprotaso/go-yit v0.0.0-20191028211022-135eb7262960 // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect + github.com/dprotaso/go-yit v0.0.0-20250804204205-7afe4252a1dd // indirect golang.org/x/net v0.56.0 // indirect golang.org/x/sys v0.47.0 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index 26b0cb3e..3949e956 100644 --- a/go.sum +++ b/go.sum @@ -1,75 +1,40 @@ github.com/blackwell-systems/gcf-go v1.8.0 h1:tyM3P1uCRo4rlbjuMlir4Rkd0oKaHaPqOarGutOAhjM= github.com/blackwell-systems/gcf-go v1.8.0/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= github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo= github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= -github.com/dprotaso/go-yit v0.0.0-20191028211022-135eb7262960 h1:aRd8M7HJVZOqn/vhOzrGcQH0lNAMkqMn+pXUYkatmcA= -github.com/dprotaso/go-yit v0.0.0-20191028211022-135eb7262960/go.mod h1:9HQzr9D/0PGwMEbC3d5AB7oi67+h4TsQqItC1GVYG58= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.2 h1:uqH7bpe+ERSiDa34FDOF7RikN6RzXgduUF8yarlZp94= -github.com/onsi/ginkgo v1.10.2/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= -github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/dprotaso/go-yit v0.0.0-20250804204205-7afe4252a1dd h1:ISvaZ+pSOTZqRrLl2YPxrjKUnljPwzMpj+moYncw9+M= +github.com/dprotaso/go-yit v0.0.0-20250804204205-7afe4252a1dd/go.mod h1:mv9X2n3TNuvUHofVvJ0rVbkd9IL7D2t9FSHClG3A0vc= +github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= +github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= +github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/gomega v1.38.0 h1:c/WX+w8SLAinvuKKQFh77WEucCnPk4j2OTUr7lt7BeY= +github.com/onsi/gomega v1.38.0/go.mod h1:OcXcwId0b9QsE7Y49u+BTrL4IdKOBOKnD6VQNTJEB6o= 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/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= -github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= -github.com/speakeasy-api/jsonpath v0.6.3 h1:c+QPwzAOdrWvzycuc9HFsIZcxKIaWcNpC+xhOW9rJxU= -github.com/speakeasy-api/jsonpath v0.6.3/go.mod h1:2cXloNuQ+RSXi5HTRaeBh7JEmjRXTiaKpFTdZiL7URI= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +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.6.4-0.20261016002236-43d52ac89b20 h1:cUUIOfmatWE/9rZugqm2ZEenBx0kzqOxbBOTZXZsfAw= +github.com/speakeasy-api/jsonpath v0.6.4-0.20261016002236-43d52ac89b20/go.mod h1:TmWEGgh4W878JDCrSv0eMult7SYW5bAOqOg8b5zaEvo= +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= github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= -github.com/vmware-labs/yaml-jsonpath v0.3.2 h1:/5QKeCBGdsInyDCyVNLbXyilb61MXGi9NP674f9Hobk= -github.com/vmware-labs/yaml-jsonpath v0.3.2/go.mod h1:U6whw1z03QyqgWdgXxvVnQ90zN1BWz5V+51Ewf8k+rQ= go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.56.0 h1:Rw8j/hFzGvJUZwNBXnAtf5sVDVt+65SK2C7IxCxZt5o= golang.org/x/net v0.56.0/go.mod h1:D3Ku6r+V6JROoZK144D2XfMHFcMq/0zSfLelVTCFKec= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc= golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20191026110619-0b21df46bc1d/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/hashing/hashing.go b/hashing/hashing.go index 269a6317..e0a26062 100644 --- a/hashing/hashing.go +++ b/hashing/hashing.go @@ -10,8 +10,6 @@ import ( "github.com/speakeasy-api/openapi/internal/interfaces" "go.yaml.in/yaml/v3" - gopkgyaml "gopkg.in/yaml.v3" - "unsafe" ) func Hash(v any) string { @@ -81,8 +79,6 @@ func toHashableString(v any) string { // Check if this is a yaml.Node if node, ok := v.(yaml.Node); ok { builder.WriteString(yamlNodeToHashableString(&node)) - } else if legacyNode, ok := v.(gopkgyaml.Node); ok { - builder.WriteString(yamlNodeToHashableString((*yaml.Node)(unsafe.Pointer(&legacyNode)))) //nolint:gosec // zero-copy conversion between identical Node memory layouts } else { builder.WriteString(structToHashableString(v)) } @@ -114,8 +110,6 @@ func toHashableString(v any) string { builder.WriteString(strconv.FormatUint(v, 10)) case *yaml.Node: builder.WriteString(yamlNodeToHashableString(v)) - case *gopkgyaml.Node: - builder.WriteString(yamlNodeToHashableString((*yaml.Node)(unsafe.Pointer(v)))) //nolint:gosec // zero-copy conversion between identical Node memory layouts default: fmt.Fprintf(&builder, "%v", v) } diff --git a/hashing/yaml_migration_test.go b/hashing/yaml_migration_test.go deleted file mode 100644 index c2a1a237..00000000 --- a/hashing/yaml_migration_test.go +++ /dev/null @@ -1,41 +0,0 @@ -package hashing_test - -import ( - "testing" - - "github.com/speakeasy-api/openapi/hashing" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - goyaml "go.yaml.in/yaml/v3" - legacyyaml "gopkg.in/yaml.v3" -) - -func TestHash_YAMLNodeParity(t *testing.T) { - t.Parallel() - - yamlData := `info: - title: Test API - version: "1.0" -paths: - /test: - get: - responses: - "200": - description: OK -` - var modernNode goyaml.Node - err := goyaml.Unmarshal([]byte(yamlData), &modernNode) - require.NoError(t, err) - - var legacyNode legacyyaml.Node - err = legacyyaml.Unmarshal([]byte(yamlData), &legacyNode) - require.NoError(t, err) - - modernHashPtr := hashing.Hash(&modernNode) - legacyHashPtr := hashing.Hash(&legacyNode) - assert.Equal(t, modernHashPtr, legacyHashPtr, "legacy and modern yaml node pointers should yield identical hash") - - modernHashVal := hashing.Hash(modernNode) - legacyHashVal := hashing.Hash(legacyNode) - assert.Equal(t, modernHashVal, legacyHashVal, "legacy and modern yaml node values should yield identical hash") -} diff --git a/jsonpointer/jsonpointer.go b/jsonpointer/jsonpointer.go index 1b4508c7..0c992d5f 100644 --- a/jsonpointer/jsonpointer.go +++ b/jsonpointer/jsonpointer.go @@ -6,12 +6,10 @@ import ( "reflect" "strconv" "strings" - "unsafe" "github.com/speakeasy-api/openapi/errors" "github.com/speakeasy-api/openapi/internal/interfaces" "go.yaml.in/yaml/v3" - gopkgyaml "gopkg.in/yaml.v3" ) const ( @@ -74,10 +72,6 @@ func (j JSONPointer) Validate() error { // WithStructTags can be used to set the type of struct tags to use when navigating structs. // If the struct implements any of the Navigable interfaces it will be used to navigate the source. func GetTarget(source any, pointer JSONPointer, opts ...option) (any, error) { - _, isLegacyPtr := source.(*gopkgyaml.Node) - _, isLegacyVal := source.(gopkgyaml.Node) - isLegacy := isLegacyPtr || isLegacyVal - o := getOptions(opts) stack, err := pointer.getNavigationStack() @@ -90,12 +84,6 @@ func GetTarget(source any, pointer JSONPointer, opts ...option) (any, error) { return nil, err } - if isLegacy { - if node, ok := target.(*yaml.Node); ok { - return (*gopkgyaml.Node)(unsafe.Pointer(node)), nil //nolint:gosec // zero-copy conversion between identical Node memory layouts - } - } - return target, nil } @@ -118,24 +106,6 @@ func getCurrentStackTarget(source any, stack []navigationPart, currentPath strin if yamlNode, ok := source.(yaml.Node); ok { return getYamlNodeTarget(&yamlNode, navigationPart{}, []navigationPart{}, currentPath, o) } - if legacyNode, ok := source.(*gopkgyaml.Node); ok { - res, st, err := getYamlNodeTarget((*yaml.Node)(unsafe.Pointer(legacyNode)), navigationPart{}, []navigationPart{}, currentPath, o) //nolint:gosec // zero-copy conversion between identical Node memory layouts - if err == nil { - if n, ok := res.(*yaml.Node); ok { - return (*gopkgyaml.Node)(unsafe.Pointer(n)), st, nil //nolint:gosec // zero-copy conversion between identical Node memory layouts - } - } - return res, st, err - } - if legacyNode, ok := source.(gopkgyaml.Node); ok { - res, st, err := getYamlNodeTarget((*yaml.Node)(unsafe.Pointer(&legacyNode)), navigationPart{}, []navigationPart{}, currentPath, o) //nolint:gosec // zero-copy conversion between identical Node memory layouts - if err == nil { - if n, ok := res.(*yaml.Node); ok { - return (*gopkgyaml.Node)(unsafe.Pointer(n)), st, nil //nolint:gosec // zero-copy conversion between identical Node memory layouts - } - } - return res, st, err - } return source, stack, nil } @@ -155,24 +125,6 @@ func getTarget(source any, currentPart navigationPart, stack []navigationPart, c if yamlNode, ok := source.(yaml.Node); ok { return getYamlNodeTarget(&yamlNode, currentPart, stack, currentPath, o) } - if legacyNode, ok := source.(*gopkgyaml.Node); ok { - res, st, err := getYamlNodeTarget((*yaml.Node)(unsafe.Pointer(legacyNode)), currentPart, stack, currentPath, o) //nolint:gosec // zero-copy conversion between identical Node memory layouts - if err == nil { - if n, ok := res.(*yaml.Node); ok { - return (*gopkgyaml.Node)(unsafe.Pointer(n)), st, nil //nolint:gosec // zero-copy conversion between identical Node memory layouts - } - } - return res, st, err - } - if legacyNode, ok := source.(gopkgyaml.Node); ok { - res, st, err := getYamlNodeTarget((*yaml.Node)(unsafe.Pointer(&legacyNode)), currentPart, stack, currentPath, o) //nolint:gosec // zero-copy conversion between identical Node memory layouts - if err == nil { - if n, ok := res.(*yaml.Node); ok { - return (*gopkgyaml.Node)(unsafe.Pointer(n)), st, nil //nolint:gosec // zero-copy conversion between identical Node memory layouts - } - } - return res, st, err - } sourceType := reflect.TypeOf(source) if sourceType == nil { diff --git a/jsonpointer/legacy_yaml_test.go b/jsonpointer/legacy_yaml_test.go deleted file mode 100644 index 5111aa5b..00000000 --- a/jsonpointer/legacy_yaml_test.go +++ /dev/null @@ -1,45 +0,0 @@ -package jsonpointer_test - -import ( - "testing" - - "github.com/speakeasy-api/openapi/jsonpointer" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - legacyyaml "gopkg.in/yaml.v3" -) - -func TestGetTarget_LegacyYAMLNode(t *testing.T) { - t.Parallel() - - yamlData := `info: - title: Test API - version: 1.0.0 -paths: - /users: - get: - summary: Get users -` - var root legacyyaml.Node - err := legacyyaml.Unmarshal([]byte(yamlData), &root) - require.NoError(t, err) - - ptr := jsonpointer.JSONPointer("/info/title") - target, err := jsonpointer.GetTarget(&root, ptr) - require.NoError(t, err) - require.NotNil(t, target) - targetNode, ok := target.(*legacyyaml.Node) - require.True(t, ok, "expected *legacyyaml.Node from pointer input, got %T", target) - assert.Equal(t, legacyyaml.ScalarNode, targetNode.Kind) - assert.Equal(t, "Test API", targetNode.Value) - - // Also test value struct version - target2, err := jsonpointer.GetTarget(root, ptr) - require.NoError(t, err) - require.NotNil(t, target2) - targetNode2, ok := target2.(*legacyyaml.Node) - require.True(t, ok, "expected *legacyyaml.Node from value input, got %T", target2) - assert.Equal(t, legacyyaml.ScalarNode, targetNode2.Kind) - assert.Equal(t, "Test API", targetNode2.Value) - assert.Equal(t, target, target2) -} diff --git a/linter/fix/engine.go b/linter/fix/engine.go index 35b486e2..e4610430 100644 --- a/linter/fix/engine.go +++ b/linter/fix/engine.go @@ -8,8 +8,6 @@ import ( "github.com/speakeasy-api/openapi/openapi" "github.com/speakeasy-api/openapi/validation" "go.yaml.in/yaml/v3" - gopkgyaml "gopkg.in/yaml.v3" - "unsafe" ) // Mode controls how fixes are applied. @@ -252,13 +250,6 @@ func (e *Engine) ProcessErrors(ctx context.Context, doc *openapi.OpenAPI, errs [ } else { applyErr = fix.Apply(doc) } - } else if legacyFix, ok := fix.(validation.LegacyNodeFix); ok { - rootNode := doc.GetRootNode() - if rootNode != nil { - applyErr = legacyFix.ApplyNode((*gopkgyaml.Node)(unsafe.Pointer(rootNode))) //nolint:gosec // zero-copy conversion between identical Node memory layouts - } else { - applyErr = fix.Apply(doc) - } } else { applyErr = fix.Apply(doc) } @@ -295,8 +286,5 @@ func ApplyNodeFix(fix validation.Fix, doc *openapi.OpenAPI, rootNode *yaml.Node) if nodeFix, ok := fix.(validation.NodeFix); ok && rootNode != nil { return nodeFix.ApplyNode(rootNode) } - if legacyFix, ok := fix.(validation.LegacyNodeFix); ok && rootNode != nil { - return legacyFix.ApplyNode((*gopkgyaml.Node)(unsafe.Pointer(rootNode))) //nolint:gosec // zero-copy conversion between identical Node memory layouts - } return fix.Apply(doc) } diff --git a/linter/fix/legacy_fix_test.go b/linter/fix/legacy_fix_test.go deleted file mode 100644 index 9db9198f..00000000 --- a/linter/fix/legacy_fix_test.go +++ /dev/null @@ -1,51 +0,0 @@ -package fix_test - -import ( - "testing" - - "github.com/speakeasy-api/openapi/linter/fix" - "github.com/speakeasy-api/openapi/openapi" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - "go.yaml.in/yaml/v3" - legacyyaml "gopkg.in/yaml.v3" -) - -type mockLegacyNodeFix struct { - mockFix - legacyNodeApplied bool - receivedKind legacyyaml.Kind - receivedContent []string -} - -func (f *mockLegacyNodeFix) ApplyNode(rootNode *legacyyaml.Node) error { - f.legacyNodeApplied = true - if rootNode != nil { - f.receivedKind = rootNode.Kind - for _, child := range rootNode.Content { - f.receivedContent = append(f.receivedContent, child.Value) - } - } - return nil -} - -func TestApplyNodeFix_WithLegacyNodeFix(t *testing.T) { - t.Parallel() - - f := &mockLegacyNodeFix{mockFix: mockFix{description: "legacy node fix"}} - rootNode := &yaml.Node{ - Kind: yaml.MappingNode, - Content: []*yaml.Node{ - {Kind: yaml.ScalarNode, Value: "title"}, - {Kind: yaml.ScalarNode, Value: "Test API"}, - }, - } - doc := &openapi.OpenAPI{} - - err := fix.ApplyNodeFix(f, doc, rootNode) - require.NoError(t, err, "ApplyNodeFix should not fail") - assert.True(t, f.legacyNodeApplied, "Legacy ApplyNode should be called") - assert.Equal(t, legacyyaml.MappingNode, f.receivedKind) - assert.Equal(t, []string{"title", "Test API"}, f.receivedContent) - assert.False(t, f.applied, "Apply should not be called") -} diff --git a/marshaller/coremodel_jsonpath_test.go b/marshaller/coremodel_jsonpath_test.go index 77728aa1..1296468a 100644 --- a/marshaller/coremodel_jsonpath_test.go +++ b/marshaller/coremodel_jsonpath_test.go @@ -8,8 +8,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.yaml.in/yaml/v3" - legacyYaml "gopkg.in/yaml.v3" - "unsafe" ) func TestCoreModel_GetJSONPath_Success(t *testing.T) { @@ -180,13 +178,12 @@ func findNodeByJSONPath(t *testing.T, rootNode *yaml.Node, jsonPath string) *yam require.NoError(t, err, "JSONPath should be valid: %s", jsonPath) // Query the YAML node directly - legacyRoot := (*legacyYaml.Node)(unsafe.Pointer(rootNode)) - result := path.Query(legacyRoot) + result := path.Query(rootNode) require.NotEmpty(t, result, "JSONPath query should return results: %s", jsonPath) // The result should be a slice of *yaml.Node, so return the first one if len(result) > 0 { - return (*yaml.Node)(unsafe.Pointer(result[0])) + return result[0] } return nil } @@ -199,8 +196,7 @@ func verifyJSONPathWorks(t *testing.T, rootNode *yaml.Node, jsonPath string, exp path, err := jsonpath.NewPath(jsonPath) require.NoError(t, err, "generated JSONPath should be valid: %s", jsonPath) - legacyRoot := (*legacyYaml.Node)(unsafe.Pointer(rootNode)) - result := path.Query(legacyRoot) + result := path.Query(rootNode) require.NotEmpty(t, result, "JSONPath query should return results: %s", jsonPath) // Special case for root node: the query might return the document node @@ -214,9 +210,8 @@ func verifyJSONPathWorks(t *testing.T, rootNode *yaml.Node, jsonPath string, exp // Verify the result contains our expected node // The result is a slice of nodes, so we check if our target node is in there found := false - legacyExpected := (*legacyYaml.Node)(unsafe.Pointer(expectedNode)) for _, node := range result { - if node == legacyExpected { + if node == expectedNode { found = true break } diff --git a/overlay/apply_test.go b/overlay/apply_test.go index c9b00211..532c1946 100644 --- a/overlay/apply_test.go +++ b/overlay/apply_test.go @@ -12,8 +12,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.yaml.in/yaml/v3" - legacyYaml "gopkg.in/yaml.v3" - "unsafe" ) // NodeMatchesFile is a test that marshals the YAML file from the given node, @@ -913,7 +911,7 @@ func TestApplyToOld(t *testing.T) { path, err := jsonpath.NewPath(`$.paths["/anything/selectGlobalServer"]`) require.NoError(t, err) - result := path.Query((*legacyYaml.Node)(unsafe.Pointer(nodeOld))) + result := path.Query(nodeOld) require.NoError(t, err) require.Empty(t, result) o.JSONPathVersion = "rfc9535" @@ -927,7 +925,7 @@ func TestApplyToOld(t *testing.T) { o.Actions[0].Target = "$.paths[?(@[\"x-my-ignore\"])]" // @ should always refer to the child node in RFC 9535.. _, err = o.ApplyToStrict(nodeNew) require.NoError(t, err) - result = path.Query((*legacyYaml.Node)(unsafe.Pointer(nodeNew))) + result = path.Query(nodeNew) require.NoError(t, err) require.Empty(t, result) } diff --git a/overlay/jsonpath.go b/overlay/jsonpath.go index a6df9a96..06761141 100644 --- a/overlay/jsonpath.go +++ b/overlay/jsonpath.go @@ -2,14 +2,12 @@ package overlay import ( "fmt" - "unsafe" "github.com/speakeasy-api/jsonpath/pkg/jsonpath" "github.com/speakeasy-api/jsonpath/pkg/jsonpath/config" "github.com/speakeasy-api/openapi/internal/version" - "github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath" + "github.com/speakeasy-api/yaml-jsonpath/pkg/yamlpath" "go.yaml.in/yaml/v3" - legacyYaml "gopkg.in/yaml.v3" ) // Queryable is an interface for querying YAML nodes using JSONPath expressions. @@ -17,27 +15,6 @@ type Queryable interface { Query(root *yaml.Node) []*yaml.Node } -// Compile-time layout-compatibility guard verifying that go.yaml.in/yaml/v3.Node -// and gopkg.in/yaml.v3.Node have identical memory footprints. -const _ = unsafe.Sizeof(yaml.Node{}) == unsafe.Sizeof(legacyYaml.Node{}) - -type rfcJSONPathQueryable struct { - path *jsonpath.JSONPath -} - -func (r rfcJSONPathQueryable) Query(root *yaml.Node) []*yaml.Node { - if r.path == nil { - return []*yaml.Node{} - } - legacyRoot := (*legacyYaml.Node)(unsafe.Pointer(root)) //nolint:gosec // zero-copy conversion between identical Node memory layouts - legacyResults := r.path.Query(legacyRoot) - results := make([]*yaml.Node, len(legacyResults)) - for i, n := range legacyResults { - results[i] = (*yaml.Node)(unsafe.Pointer(n)) //nolint:gosec // zero-copy conversion between identical Node memory layouts - } - return results -} - type yamlPathQueryable struct { path *yamlpath.Path } @@ -46,14 +23,9 @@ func (y yamlPathQueryable) Query(root *yaml.Node) []*yaml.Node { if y.path == nil { return []*yaml.Node{} } - legacyRoot := (*legacyYaml.Node)(unsafe.Pointer(root)) //nolint:gosec // zero-copy conversion between identical Node memory layouts // errors aren't actually possible from yamlpath. - legacyResults, _ := y.path.Find(legacyRoot) - results := make([]*yaml.Node, len(legacyResults)) - for i, n := range legacyResults { - results[i] = (*yaml.Node)(unsafe.Pointer(n)) //nolint:gosec // zero-copy conversion between identical Node memory layouts - } - return results + result, _ := y.path.Find(root) + return result } // NewPath creates a new JSONPath queryable from the given target expression. @@ -63,7 +35,7 @@ func (y yamlPathQueryable) Query(root *yaml.Node) []*yaml.Node { func (o *Overlay) NewPath(target string, warnings *[]string) (Queryable, error) { rfcJSONPath, rfcJSONPathErr := jsonpath.NewPath(target, config.WithPropertyNameExtension()) if o.UsesRFC9535() { - return rfcJSONPathQueryable{path: rfcJSONPath}, rfcJSONPathErr + return rfcJSONPath, rfcJSONPathErr } // For version < 1.1.0 without explicit rfc9535, warn about future incompatibility diff --git a/sequencedmap/map.go b/sequencedmap/map.go index efd279f9..e62639c6 100644 --- a/sequencedmap/map.go +++ b/sequencedmap/map.go @@ -11,13 +11,11 @@ import ( "reflect" "slices" "strings" - "unsafe" "github.com/speakeasy-api/openapi/internal/interfaces" "github.com/speakeasy-api/openapi/internal/utils" "github.com/speakeasy-api/openapi/yml" "go.yaml.in/yaml/v3" - gopkgyaml "gopkg.in/yaml.v3" ) // OrderType represents the different ways to order iteration through the map @@ -686,11 +684,8 @@ func (m *Map[K, V]) MarshalJSON() ([]byte, error) { return buf.Bytes(), nil } -// UnmarshalYAML implements the go.yaml.in/yaml/v3.Unmarshaler interface for the Map type. +// UnmarshalYAML implements the yaml.Unmarshaler interface for the Map type. // It unmarshals YAML data into the sequenced map, preserving the order of keys. -// -// Callers decoding with the legacy gopkg.in/yaml.v3 package can wrap the map with -// AsLegacyYAML() to preserve order-preserving decoding during migration. func (m *Map[K, V]) UnmarshalYAML(value *yaml.Node) error { if value.Kind != yaml.MappingNode { return fmt.Errorf("cannot unmarshal %s into sequencedmap.Map", value.ShortTag()) @@ -712,13 +707,13 @@ func (m *Map[K, V]) UnmarshalYAML(value *yaml.Node) error { // Unmarshal the key var key K - if err := decodeYAMLNode(keyNode, &key); err != nil { + if err := keyNode.Decode(&key); err != nil { return fmt.Errorf("failed to decode key: %w", err) } // Unmarshal the value var val V - if err := decodeYAMLNode(valueNode, &val); err != nil { + if err := valueNode.Decode(&val); err != nil { return fmt.Errorf("failed to decode value for key %v: %w", key, err) } @@ -734,11 +729,8 @@ func (m *Map[K, V]) UnmarshalYAML(value *yaml.Node) error { return nil } -// MarshalYAML implements the go.yaml.in/yaml/v3.Marshaler interface for the Map type. +// MarshalYAML implements the yaml.Marshaler interface for the Map type. // It marshals the sequenced map to YAML, preserving the order of keys. -// -// Callers encoding with the legacy gopkg.in/yaml.v3 package can wrap the map with -// AsLegacyYAML() to emit valid mapping nodes during migration. func (m *Map[K, V]) MarshalYAML() (interface{}, error) { if m == nil { return nil, nil @@ -747,11 +739,11 @@ func (m *Map[K, V]) MarshalYAML() (interface{}, error) { content := make([]*yaml.Node, 0, len(m.l)*2) for _, element := range m.l { var keyNode yaml.Node - if err := encodeYAMLNode(element.Key, &keyNode); err != nil { + if err := keyNode.Encode(element.Key); err != nil { return nil, err } var valueNode yaml.Node - if err := encodeYAMLNode(element.Value, &valueNode); err != nil { + if err := valueNode.Encode(element.Value); err != nil { return nil, err } content = append(content, &keyNode, &valueNode) @@ -760,142 +752,6 @@ func (m *Map[K, V]) MarshalYAML() (interface{}, error) { return yml.CreateMapNode(context.Background(), content), nil } -func decodeYAMLNode[T any](node *yaml.Node, target *T) error { - if u, ok := any(target).(interface{ UnmarshalYAML(*gopkgyaml.Node) error }); ok { - return u.UnmarshalYAML((*gopkgyaml.Node)(unsafe.Pointer(node))) //nolint:gosec // zero-copy conversion between identical Node memory layouts - } - - targetVal := reflect.ValueOf(target).Elem() - if targetVal.Kind() == reflect.Pointer && targetVal.IsNil() { - elemType := targetVal.Type().Elem() - newVal := reflect.New(elemType) - if u, ok := newVal.Interface().(interface{ UnmarshalYAML(*gopkgyaml.Node) error }); ok { - err := u.UnmarshalYAML((*gopkgyaml.Node)(unsafe.Pointer(node))) //nolint:gosec // zero-copy conversion between identical Node memory layouts - if err != nil { - return err - } - targetVal.Set(newVal) - return nil - } - } else if targetVal.Kind() == reflect.Pointer && !targetVal.IsNil() { - if u, ok := targetVal.Interface().(interface{ UnmarshalYAML(*gopkgyaml.Node) error }); ok { - return u.UnmarshalYAML((*gopkgyaml.Node)(unsafe.Pointer(node))) //nolint:gosec // zero-copy conversion between identical Node memory layouts - } - } - - return node.Decode(target) -} - -func encodeYAMLNode(val any, node *yaml.Node) error { - // Match the yaml encoder: nil values and typed-nil pointers encode as null - // before any Marshaler is consulted. - if isNilValue(val) { - setNullNode(node) - return nil - } - - if m, ok := val.(interface{ MarshalYAML() (interface{}, error) }); ok { - return encodeMarshalerResult(m, node) - } - - valType := reflect.TypeOf(val) - if valType.Kind() != reflect.Pointer { - ptrVal := reflect.New(valType) - ptrVal.Elem().Set(reflect.ValueOf(val)) - if m, ok := ptrVal.Interface().(interface{ MarshalYAML() (interface{}, error) }); ok { - return encodeMarshalerResult(m, node) - } - } - - if copyLegacyNode(val, node) { - return nil - } - - return node.Encode(val) -} - -func encodeMarshalerResult(m interface{ MarshalYAML() (interface{}, error) }, node *yaml.Node) error { - res, err := m.MarshalYAML() - if err != nil { - return err - } - if isNilValue(res) { - setNullNode(node) - return nil - } - if copyLegacyNode(res, node) { - return nil - } - return node.Encode(res) -} - -// copyLegacyNode copies a non-nil legacy gopkg.in/yaml.v3 node into node and reports whether val was one. -func copyLegacyNode(val any, node *yaml.Node) bool { - switch legacyNode := val.(type) { - case *gopkgyaml.Node: - *node = *((*yaml.Node)(unsafe.Pointer(legacyNode))) //nolint:gosec // zero-copy conversion between identical Node memory layouts - return true - case gopkgyaml.Node: - *node = *((*yaml.Node)(unsafe.Pointer(&legacyNode))) //nolint:gosec // zero-copy conversion between identical Node memory layouts - return true - default: - return false - } -} - -func isNilValue(val any) bool { - if val == nil { - return true - } - rv := reflect.ValueOf(val) - return rv.Kind() == reflect.Pointer && rv.IsNil() -} - -func setNullNode(node *yaml.Node) { - node.Kind = yaml.ScalarNode - node.Tag = "!!null" - node.Value = "null" -} - -// LegacyYAMLAdapter wraps a Map to implement the Unmarshaler and Marshaler interfaces -// for the legacy gopkg.in/yaml.v3 package during ecosystem migration. -type LegacyYAMLAdapter[K comparable, V any] struct { - Map *Map[K, V] -} - -// AsLegacyYAML returns an adapter that implements gopkg.in/yaml.v3's Marshaler and Unmarshaler. -func (m *Map[K, V]) AsLegacyYAML() *LegacyYAMLAdapter[K, V] { - return &LegacyYAMLAdapter[K, V]{Map: m} -} - -// NewLegacyYAMLAdapter creates a new legacy YAML adapter for the given map. -func NewLegacyYAMLAdapter[K comparable, V any](m *Map[K, V]) *LegacyYAMLAdapter[K, V] { - return &LegacyYAMLAdapter[K, V]{Map: m} -} - -// UnmarshalYAML implements gopkg.in/yaml.v3.Unmarshaler by delegating to Map.UnmarshalYAML. -func (a *LegacyYAMLAdapter[K, V]) UnmarshalYAML(value *gopkgyaml.Node) error { - if a == nil || a.Map == nil { - return errors.New("cannot unmarshal into nil Map") - } - return a.Map.UnmarshalYAML((*yaml.Node)(unsafe.Pointer(value))) //nolint:gosec // zero-copy conversion between identical Node memory layouts -} - -// MarshalYAML implements gopkg.in/yaml.v3.Marshaler by delegating to Map.MarshalYAML and returning *gopkg.in/yaml.v3.Node. -func (a *LegacyYAMLAdapter[K, V]) MarshalYAML() (interface{}, error) { - if a == nil || a.Map == nil { - return nil, nil - } - res, err := a.Map.MarshalYAML() - if err != nil { - return nil, err - } - if node, ok := res.(*yaml.Node); ok { - return (*gopkgyaml.Node)(unsafe.Pointer(node)), nil //nolint:gosec // zero-copy conversion between identical Node memory layouts - } - return res, nil -} - // compareKeys provides a generic comparison function for keys func compareKeys[K any](a, b K) int { return strings.Compare(utils.AnyToString(a), utils.AnyToString(b)) diff --git a/sequencedmap/yaml_migration_test.go b/sequencedmap/yaml_migration_test.go deleted file mode 100644 index 0d6fbbf2..00000000 --- a/sequencedmap/yaml_migration_test.go +++ /dev/null @@ -1,176 +0,0 @@ -package sequencedmap_test - -import ( - "testing" - - "github.com/speakeasy-api/openapi/sequencedmap" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - goyaml "go.yaml.in/yaml/v3" - legacyyaml "gopkg.in/yaml.v3" -) - -func TestSequencedMap_NativeYAMLv3RoundTrip(t *testing.T) { - t.Parallel() - - yamlData := `first: 1 -second: 2 -third: 3 -` - var m sequencedmap.Map[string, int] - err := goyaml.Unmarshal([]byte(yamlData), &m) - require.NoError(t, err) - - assert.Equal(t, 3, m.Len()) - keys := make([]string, 0, m.Len()) - for k := range m.All() { - keys = append(keys, k) - } - assert.Equal(t, []string{"first", "second", "third"}, keys) - - marshaled, err := goyaml.Marshal(&m) - require.NoError(t, err) - assert.Equal(t, yamlData, string(marshaled)) -} - -func TestSequencedMap_LegacyYAMLAdapterRoundTrip(t *testing.T) { - t.Parallel() - - yamlData := `first: 1 -second: 2 -third: 3 -` - var m sequencedmap.Map[string, int] - adapter := m.AsLegacyYAML() - - err := legacyyaml.Unmarshal([]byte(yamlData), adapter) - require.NoError(t, err) - - assert.Equal(t, 3, m.Len()) - keys := make([]string, 0, m.Len()) - for k := range m.All() { - keys = append(keys, k) - } - assert.Equal(t, []string{"first", "second", "third"}, keys) - - marshaled, err := legacyyaml.Marshal(adapter) - require.NoError(t, err) - assert.Equal(t, yamlData, string(marshaled)) -} - -func TestSequencedMap_LegacyDirectBehaviorDocumented(t *testing.T) { - t.Parallel() - - yamlData := `first: 1 -second: 2 -` - // Direct unmarshal with legacy yaml does not invoke go.yaml.in/yaml/v3 UnmarshalYAML - var directMap sequencedmap.Map[string, int] - err := legacyyaml.Unmarshal([]byte(yamlData), &directMap) - require.NoError(t, err) - assert.Equal(t, 0, directMap.Len(), "unmarshaling without adapter leaves map empty under legacy yaml") - - // Wrapping with AsLegacyYAML restores order-preserving decoding - var adaptedMap sequencedmap.Map[string, int] - err = legacyyaml.Unmarshal([]byte(yamlData), adaptedMap.AsLegacyYAML()) - require.NoError(t, err) - assert.Equal(t, 2, adaptedMap.Len()) - v, ok := adaptedMap.Get("first") - assert.True(t, ok) - assert.Equal(t, 1, v) -} - -type legacyCustomValue struct { - customField string - receivedKind legacyyaml.Kind -} - -func (v *legacyCustomValue) UnmarshalYAML(value *legacyyaml.Node) error { - v.receivedKind = value.Kind - v.customField = "custom:" + value.Value - return nil -} - -func (v legacyCustomValue) MarshalYAML() (interface{}, error) { - return &legacyyaml.Node{ - Kind: legacyyaml.ScalarNode, - Value: v.customField, - }, nil -} - -func TestSequencedMap_LegacyValueUnmarshaler(t *testing.T) { - t.Parallel() - - yamlData := `first: alpha -second: beta -` - var m sequencedmap.Map[string, legacyCustomValue] - err := goyaml.Unmarshal([]byte(yamlData), &m) - require.NoError(t, err) - assert.Equal(t, 2, m.Len()) - - v1, ok := m.Get("first") - require.True(t, ok) - assert.Equal(t, "custom:alpha", v1.customField) - assert.Equal(t, legacyyaml.ScalarNode, v1.receivedKind) - - v2, ok := m.Get("second") - require.True(t, ok) - assert.Equal(t, "custom:beta", v2.customField) - assert.Equal(t, legacyyaml.ScalarNode, v2.receivedKind) - - marshaled, err := goyaml.Marshal(&m) - require.NoError(t, err) - assert.Equal(t, "first: custom:alpha\nsecond: custom:beta\n", string(marshaled)) -} - -func TestSequencedMap_NilLegacyNodeValueMarshalsNull_Success(t *testing.T) { - t.Parallel() - - m := sequencedmap.New( - sequencedmap.NewElem[string, *legacyyaml.Node]("empty", nil), - sequencedmap.NewElem("set", &legacyyaml.Node{Kind: legacyyaml.ScalarNode, Value: "value"}), - ) - - marshaled, err := goyaml.Marshal(m) - require.NoError(t, err, "marshal should not panic on typed-nil legacy nodes") - assert.Equal(t, "empty: null\nset: value\n", string(marshaled), "typed-nil legacy node should encode as null") -} - -type nilLegacyNodeMarshaler struct{} - -func (nilLegacyNodeMarshaler) MarshalYAML() (interface{}, error) { - return (*legacyyaml.Node)(nil), nil -} - -func TestSequencedMap_MarshalerReturningNilLegacyNode_Success(t *testing.T) { - t.Parallel() - - m := sequencedmap.New(sequencedmap.NewElem("key", nilLegacyNodeMarshaler{})) - - marshaled, err := goyaml.Marshal(m) - require.NoError(t, err, "marshal should not panic when a marshaler returns a nil legacy node") - assert.Equal(t, "key: null\n", string(marshaled), "nil legacy node result should encode as null") -} - -func TestSequencedMap_LegacyPointerValueUnmarshalerWithAdapter(t *testing.T) { - t.Parallel() - - yamlData := `first: alpha -second: beta -` - var m sequencedmap.Map[string, *legacyCustomValue] - err := legacyyaml.Unmarshal([]byte(yamlData), m.AsLegacyYAML()) - require.NoError(t, err) - assert.Equal(t, 2, m.Len()) - - v1, ok := m.Get("first") - require.True(t, ok) - require.NotNil(t, v1) - assert.Equal(t, "custom:alpha", v1.customField) - assert.Equal(t, legacyyaml.ScalarNode, v1.receivedKind) - - marshaled, err := legacyyaml.Marshal(m.AsLegacyYAML()) - require.NoError(t, err) - assert.Equal(t, "first: custom:alpha\nsecond: custom:beta\n", string(marshaled)) -} diff --git a/validation/fix.go b/validation/fix.go index 21ddd3ca..bd272af8 100644 --- a/validation/fix.go +++ b/validation/fix.go @@ -1,9 +1,6 @@ package validation -import ( - "go.yaml.in/yaml/v3" - gopkgyaml "gopkg.in/yaml.v3" -) +import "go.yaml.in/yaml/v3" // PromptType describes what kind of user input a fix needs. type PromptType int @@ -78,12 +75,3 @@ type NodeFix interface { // rootNode is the document root node. ApplyNode(rootNode *yaml.Node) error } - -// LegacyNodeFix is an optional interface for fixes that implement ApplyNode -// with *gopkg.in/yaml.v3.Node. The fix engine adapts these fixes during migration. -type LegacyNodeFix interface { - Fix - - // ApplyNode applies the fix directly to the legacy YAML node tree. - ApplyNode(rootNode *gopkgyaml.Node) error -} diff --git a/values/value.go b/values/value.go index 5e0fc5b4..4beb8c4b 100644 --- a/values/value.go +++ b/values/value.go @@ -1,21 +1,6 @@ package values -import ( - "unsafe" - - "go.yaml.in/yaml/v3" - gopkgyaml "gopkg.in/yaml.v3" -) +import "go.yaml.in/yaml/v3" // Value represents a raw value in an OpenAPI or Arazzo document. type Value = *yaml.Node - -// FromLegacyNode converts a legacy gopkg.in/yaml.v3.Node pointer to a values.Value. -func FromLegacyNode(n *gopkgyaml.Node) Value { - return (*yaml.Node)(unsafe.Pointer(n)) //nolint:gosec // zero-copy conversion between identical Node memory layouts -} - -// ToLegacyNode converts a values.Value to a legacy gopkg.in/yaml.v3.Node pointer. -func ToLegacyNode(v Value) *gopkgyaml.Node { - return (*gopkgyaml.Node)(unsafe.Pointer(v)) //nolint:gosec // zero-copy conversion between identical Node memory layouts -} diff --git a/values/value_test.go b/values/value_test.go deleted file mode 100644 index 5549b0c9..00000000 --- a/values/value_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package values_test - -import ( - "testing" - - "github.com/speakeasy-api/openapi/values" - "github.com/stretchr/testify/assert" - goyaml "go.yaml.in/yaml/v3" - legacyyaml "gopkg.in/yaml.v3" -) - -func TestValues_LegacyConversion(t *testing.T) { - t.Parallel() - - legacyNode := &legacyyaml.Node{ - Kind: legacyyaml.ScalarNode, - Value: "test-value", - Tag: "!!str", - } - - val := values.FromLegacyNode(legacyNode) - assert.NotNil(t, val) - assert.Equal(t, "test-value", val.Value) - assert.Equal(t, goyaml.ScalarNode, val.Kind) - - convertedBack := values.ToLegacyNode(val) - assert.NotNil(t, convertedBack) - assert.Equal(t, "test-value", convertedBack.Value) - assert.Equal(t, legacyyaml.ScalarNode, convertedBack.Kind) -} From 32acaee535058743b074e6c940594749c2f513e1 Mon Sep 17 00:00:00 2001 From: Tristan Cartledge Date: Fri, 16 Oct 2026 10:25:55 +1000 Subject: [PATCH 10/14] chore: point customrules at migrated root module pseudo-version --- openapi/linter/customrules/go.mod | 4 +--- openapi/linter/customrules/go.sum | 16 ++-------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/openapi/linter/customrules/go.mod b/openapi/linter/customrules/go.mod index 10daf064..ec457eed 100644 --- a/openapi/linter/customrules/go.mod +++ b/openapi/linter/customrules/go.mod @@ -8,7 +8,7 @@ require ( github.com/dop251/goja v0.0.0-20260106131823-651366fbe6e3 github.com/evanw/esbuild v0.28.2 github.com/go-sourcemap/sourcemap v2.1.4+incompatible - github.com/speakeasy-api/openapi v1.25.7-0.20261015232146-90410c909f57 + github.com/speakeasy-api/openapi v1.25.7-0.20261016002523-f0b9f7b1815a github.com/stretchr/testify v1.12.1 go.yaml.in/yaml/v3 v3.0.5 ) @@ -16,10 +16,8 @@ require ( require ( github.com/dlclark/regexp2 v1.11.4 // indirect github.com/google/pprof v0.0.0-20230207041349-798e818bf904 // indirect - github.com/kr/text v0.2.0 // indirect github.com/santhosh-tekuri/jsonschema/v6 v6.0.3 // indirect golang.org/x/sync v0.24.0 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/text v0.43.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/openapi/linter/customrules/go.sum b/openapi/linter/customrules/go.sum index bfedae29..cf9f6ede 100644 --- a/openapi/linter/customrules/go.sum +++ b/openapi/linter/customrules/go.sum @@ -1,6 +1,5 @@ github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo= github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dop251/goja v0.0.0-20260106131823-651366fbe6e3 h1:bVp3yUzvSAJzu9GqID+Z96P+eu5TKnIMJSV4QaZMauM= @@ -11,16 +10,10 @@ github.com/go-sourcemap/sourcemap v2.1.4+incompatible h1:a+iTbH5auLKxaNwQFg0B+TC github.com/go-sourcemap/sourcemap v2.1.4+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/google/pprof v0.0.0-20230207041349-798e818bf904 h1:4/hN5RUoecvl+RmJRE2YxKWtnnQls6rQjjW5oV7qg2U= github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8qtYCYyzA+8c/9qtqgA3qsXGYqCPKARAFg= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= 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.6.3 h1:c+QPwzAOdrWvzycuc9HFsIZcxKIaWcNpC+xhOW9rJxU= -github.com/speakeasy-api/jsonpath v0.6.3/go.mod h1:2cXloNuQ+RSXi5HTRaeBh7JEmjRXTiaKpFTdZiL7URI= +github.com/speakeasy-api/jsonpath v0.6.4-0.20261016002236-43d52ac89b20 h1:cUUIOfmatWE/9rZugqm2ZEenBx0kzqOxbBOTZXZsfAw= +github.com/speakeasy-api/jsonpath v0.6.4-0.20261016002236-43d52ac89b20/go.mod h1:TmWEGgh4W878JDCrSv0eMult7SYW5bAOqOg8b5zaEvo= 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.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= @@ -32,10 +25,5 @@ golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc= golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From 683982d5baafc74f650e8594e18031ef070b533d Mon Sep 17 00:00:00 2001 From: Tristan Cartledge Date: Fri, 16 Oct 2026 10:26:57 +1000 Subject: [PATCH 11/14] chore: point cmd/openapi and test modules at migrated pseudo-versions --- cmd/openapi/go.mod | 11 ++-- cmd/openapi/go.sum | 72 ++++++++------------------- jsonschema/oas3/tests/go.mod | 1 - jsonschema/oas3/tests/go.sum | 15 +----- openapi/linter/converter/tests/go.mod | 3 +- openapi/linter/converter/tests/go.sum | 15 +----- 6 files changed, 32 insertions(+), 85 deletions(-) diff --git a/cmd/openapi/go.mod b/cmd/openapi/go.mod index c3d0957c..126e6441 100644 --- a/cmd/openapi/go.mod +++ b/cmd/openapi/go.mod @@ -6,8 +6,8 @@ require ( charm.land/bubbles/v2 v2.2.1 charm.land/bubbletea/v2 v2.1.0 charm.land/lipgloss/v2 v2.0.6 - github.com/speakeasy-api/openapi v1.25.7-0.20261015235438-d4071aaeea8c - github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261015235438-d4071aaeea8c + github.com/speakeasy-api/openapi v1.25.7-0.20261016002555-32acaee53505 + github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261016002555-32acaee53505 github.com/spf13/cobra v1.10.2 github.com/stretchr/testify v1.12.1 go.yaml.in/yaml/v3 v3.0.5 @@ -26,7 +26,7 @@ require ( github.com/clipperhouse/uax29/v2 v2.7.0 // indirect github.com/dlclark/regexp2 v1.11.4 // indirect github.com/dop251/goja v0.0.0-20260106131823-651366fbe6e3 // indirect - github.com/dprotaso/go-yit v0.0.0-20191028211022-135eb7262960 // indirect + github.com/dprotaso/go-yit v0.0.0-20250804204205-7afe4252a1dd // indirect github.com/evanw/esbuild v0.28.2 // indirect github.com/go-sourcemap/sourcemap v2.1.4+incompatible // indirect github.com/google/pprof v0.0.0-20230207041349-798e818bf904 // indirect @@ -36,12 +36,11 @@ 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.6.3 // indirect + github.com/speakeasy-api/jsonpath v0.6.4-0.20261016002236-43d52ac89b20 // indirect + github.com/speakeasy-api/yaml-jsonpath v0.0.0-20261016002013-07e5f48e6d17 // indirect github.com/spf13/pflag v1.0.9 // indirect - github.com/vmware-labs/yaml-jsonpath v0.3.2 // indirect github.com/xo/terminfo v1.0.0 // indirect golang.org/x/sync v0.24.0 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/text v0.43.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/cmd/openapi/go.sum b/cmd/openapi/go.sum index bf53389b..9b801938 100644 --- a/cmd/openapi/go.sum +++ b/cmd/openapi/go.sum @@ -31,71 +31,57 @@ github.com/clipperhouse/displaywidth v0.11.0/go.mod h1:bkrFNkf81G8HyVqmKGxsPufD3 github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk= github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= -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= github.com/dlclark/regexp2 v1.11.4 h1:rPYF9/LECdNymJufQKmri9gV604RvvABwgOA8un7yAo= github.com/dlclark/regexp2 v1.11.4/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dop251/goja v0.0.0-20260106131823-651366fbe6e3 h1:bVp3yUzvSAJzu9GqID+Z96P+eu5TKnIMJSV4QaZMauM= github.com/dop251/goja v0.0.0-20260106131823-651366fbe6e3/go.mod h1:MxLav0peU43GgvwVgNbLAj1s/bSGboKkhuULvq/7hx4= -github.com/dprotaso/go-yit v0.0.0-20191028211022-135eb7262960 h1:aRd8M7HJVZOqn/vhOzrGcQH0lNAMkqMn+pXUYkatmcA= -github.com/dprotaso/go-yit v0.0.0-20191028211022-135eb7262960/go.mod h1:9HQzr9D/0PGwMEbC3d5AB7oi67+h4TsQqItC1GVYG58= +github.com/dprotaso/go-yit v0.0.0-20250804204205-7afe4252a1dd h1:ISvaZ+pSOTZqRrLl2YPxrjKUnljPwzMpj+moYncw9+M= +github.com/dprotaso/go-yit v0.0.0-20250804204205-7afe4252a1dd/go.mod h1:mv9X2n3TNuvUHofVvJ0rVbkd9IL7D2t9FSHClG3A0vc= github.com/evanw/esbuild v0.28.2 h1:A2uETn4jrQTcXaT/shwTDTYBxDjl7fV7nXmUrJxfA2w= github.com/evanw/esbuild v0.28.2/go.mod h1:D2vIQZqV/vIf/VRHtViaUtViZmG7o+kKmlBfVQuRi48= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= +github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= github.com/go-sourcemap/sourcemap v2.1.4+incompatible h1:a+iTbH5auLKxaNwQFg0B+TCYl6lbukKPc7b5x0n1s6Q= github.com/go-sourcemap/sourcemap v2.1.4+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/pprof v0.0.0-20230207041349-798e818bf904 h1:4/hN5RUoecvl+RmJRE2YxKWtnnQls6rQjjW5oV7qg2U= github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8qtYCYyzA+8c/9qtqgA3qsXGYqCPKARAFg= -github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lucasb-eyer/go-colorful v1.4.1 h1:1EO+WB73+EH8EVbzlrG3KLAfEypQWVHIBqlTf+2hNss= github.com/lucasb-eyer/go-colorful v1.4.1/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/mattn/go-runewidth v0.0.30 h1:+KUuiDA4fF0R1p5FeueHefjDm+GIM+kWfFnDjybOPgk= github.com/mattn/go-runewidth v0.0.30/go.mod h1:3qAiGCV4Koz/yuveO58qUefmUTRm8r0IGEXZ9jeHp/8= github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.2 h1:uqH7bpe+ERSiDa34FDOF7RikN6RzXgduUF8yarlZp94= -github.com/onsi/ginkgo v1.10.2/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= -github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= +github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/gomega v1.38.0 h1:c/WX+w8SLAinvuKKQFh77WEucCnPk4j2OTUr7lt7BeY= +github.com/onsi/gomega v1.38.0/go.mod h1:OcXcwId0b9QsE7Y49u+BTrL4IdKOBOKnD6VQNTJEB6o= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 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/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= -github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= -github.com/speakeasy-api/jsonpath v0.6.3 h1:c+QPwzAOdrWvzycuc9HFsIZcxKIaWcNpC+xhOW9rJxU= -github.com/speakeasy-api/jsonpath v0.6.3/go.mod h1:2cXloNuQ+RSXi5HTRaeBh7JEmjRXTiaKpFTdZiL7URI= -github.com/speakeasy-api/openapi v1.25.7-0.20261015235438-d4071aaeea8c h1:Yau+Wz2ozxt0GwqxNoCUHeJFx4kBLjcIL/Vm4blY1eI= -github.com/speakeasy-api/openapi v1.25.7-0.20261015235438-d4071aaeea8c/go.mod h1:Cs8RBu1k366uWsQV12FkC9t+kwIvljLg7uqAxWoYQa0= -github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261015235438-d4071aaeea8c h1:US9yxNCoGW8B9KdWqVpXaIBsWbRLUp2nilz3TIl+y94= -github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261015235438-d4071aaeea8c/go.mod h1:/4DC9LHwOTinFl/jYZi3XlWLDefDC+ILM2ncjSVedTM= +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.6.4-0.20261016002236-43d52ac89b20 h1:cUUIOfmatWE/9rZugqm2ZEenBx0kzqOxbBOTZXZsfAw= +github.com/speakeasy-api/jsonpath v0.6.4-0.20261016002236-43d52ac89b20/go.mod h1:TmWEGgh4W878JDCrSv0eMult7SYW5bAOqOg8b5zaEvo= +github.com/speakeasy-api/openapi v1.25.7-0.20261016002555-32acaee53505 h1:QPk3rJGOOwednMTBUMNRBEs5Xusa5gxePB0RFd1VDXw= +github.com/speakeasy-api/openapi v1.25.7-0.20261016002555-32acaee53505/go.mod h1:SV2Y2bAMXZQxxHBUyAXVAlDStrwmhGno7dHNJsmEJ5Q= +github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261016002555-32acaee53505 h1:tjIa/wloSLl0veQ27rdEoDPkJzQe1HnJR8iOWb9i0mo= +github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261016002555-32acaee53505/go.mod h1:XnSOGtPTFxkK7TgpwE8/SPh9zw3301FdKVHrf8bZDhU= +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/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY= github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= -github.com/vmware-labs/yaml-jsonpath v0.3.2 h1:/5QKeCBGdsInyDCyVNLbXyilb61MXGi9NP674f9Hobk= -github.com/vmware-labs/yaml-jsonpath v0.3.2/go.mod h1:U6whw1z03QyqgWdgXxvVnQ90zN1BWz5V+51Ewf8k+rQ= github.com/xo/terminfo v1.0.0 h1:2ZpYzqWzyyytjk3TP6aJVDhkMAkc99/1xKQdA3TDTBY= github.com/xo/terminfo v1.0.0/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= @@ -103,33 +89,19 @@ go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.56.0 h1:Rw8j/hFzGvJUZwNBXnAtf5sVDVt+65SK2C7IxCxZt5o= golang.org/x/net v0.56.0/go.mod h1:D3Ku6r+V6JROoZK144D2XfMHFcMq/0zSfLelVTCFKec= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc= golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20191026110619-0b21df46bc1d/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/jsonschema/oas3/tests/go.mod b/jsonschema/oas3/tests/go.mod index 3a515138..bf7719d1 100644 --- a/jsonschema/oas3/tests/go.mod +++ b/jsonschema/oas3/tests/go.mod @@ -59,7 +59,6 @@ require ( golang.org/x/sync v0.24.0 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/text v0.43.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) replace github.com/speakeasy-api/openapi => ../../../ diff --git a/jsonschema/oas3/tests/go.sum b/jsonschema/oas3/tests/go.sum index 84ee5ff9..76b2e9c0 100644 --- a/jsonschema/oas3/tests/go.sum +++ b/jsonschema/oas3/tests/go.sum @@ -48,10 +48,6 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/klauspost/compress v1.18.6 h1:2jupLlAwFm95+YDR+NwD2MEfFO9d4z4Prjl1XXDjuao= github.com/klauspost/compress v1.18.6/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/lufia/plan9stats v0.0.0-20260330125221-c963978e514e h1:Q6MvJtQK/iRcRtzAscm/zF23XxJlbECiGPyRicsX+Ak= github.com/lufia/plan9stats v0.0.0-20260330125221-c963978e514e/go.mod h1:autxFIvghDt3jPTLoqZ9OZ7s9qTGNAWmYCjVFWPX/zg= github.com/magiconair/properties v1.8.10 h1:s31yESBquKXCV9a/ScB3ESkOjUYYv+X0rg8SYxI99mE= @@ -80,16 +76,14 @@ github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJw github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= 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/shirou/gopsutil/v4 v4.26.6 h1:Mzr/npDtQC/xpeEuQKHZt8Zo9CmPvhTj8nkR8w5TLDs= 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.6.3 h1:c+QPwzAOdrWvzycuc9HFsIZcxKIaWcNpC+xhOW9rJxU= -github.com/speakeasy-api/jsonpath v0.6.3/go.mod h1:2cXloNuQ+RSXi5HTRaeBh7JEmjRXTiaKpFTdZiL7URI= +github.com/speakeasy-api/jsonpath v0.6.4-0.20261016002236-43d52ac89b20 h1:cUUIOfmatWE/9rZugqm2ZEenBx0kzqOxbBOTZXZsfAw= +github.com/speakeasy-api/jsonpath v0.6.4-0.20261016002236-43d52ac89b20/go.mod h1:TmWEGgh4W878JDCrSv0eMult7SYW5bAOqOg8b5zaEvo= 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= @@ -132,11 +126,6 @@ golang.org/x/term v0.45.0 h1:NwWyBmoJCbfTHpxrWoZ9C6/VxOf7ic219I8xZZFdrf0= golang.org/x/term v0.45.0/go.mod h1:9aqxs0blBcrm/n0L9QW0aRVD+ktan8ssZromtqJC43w= golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc= golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q= gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA= pgregory.net/rapid v1.2.0 h1:keKAYRcjm+e1F0oAuU5F5+YPAWcyxNNRK2wud503Gnk= diff --git a/openapi/linter/converter/tests/go.mod b/openapi/linter/converter/tests/go.mod index eeec52b1..2e38af91 100644 --- a/openapi/linter/converter/tests/go.mod +++ b/openapi/linter/converter/tests/go.mod @@ -8,7 +8,7 @@ replace ( ) require ( - github.com/speakeasy-api/openapi v1.25.7-0.20261015232146-90410c909f57 + github.com/speakeasy-api/openapi v1.25.7-0.20261016002523-f0b9f7b1815a github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261015113746-577889a836ef github.com/stretchr/testify v1.12.1 ) @@ -24,5 +24,4 @@ require ( golang.org/x/sync v0.24.0 // indirect golang.org/x/sys v0.47.0 // indirect golang.org/x/text v0.43.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/openapi/linter/converter/tests/go.sum b/openapi/linter/converter/tests/go.sum index b7325486..cf9f6ede 100644 --- a/openapi/linter/converter/tests/go.sum +++ b/openapi/linter/converter/tests/go.sum @@ -10,16 +10,10 @@ github.com/go-sourcemap/sourcemap v2.1.4+incompatible h1:a+iTbH5auLKxaNwQFg0B+TC github.com/go-sourcemap/sourcemap v2.1.4+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/google/pprof v0.0.0-20230207041349-798e818bf904 h1:4/hN5RUoecvl+RmJRE2YxKWtnnQls6rQjjW5oV7qg2U= github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8qtYCYyzA+8c/9qtqgA3qsXGYqCPKARAFg= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= -github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= 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.6.3 h1:c+QPwzAOdrWvzycuc9HFsIZcxKIaWcNpC+xhOW9rJxU= -github.com/speakeasy-api/jsonpath v0.6.3/go.mod h1:2cXloNuQ+RSXi5HTRaeBh7JEmjRXTiaKpFTdZiL7URI= +github.com/speakeasy-api/jsonpath v0.6.4-0.20261016002236-43d52ac89b20 h1:cUUIOfmatWE/9rZugqm2ZEenBx0kzqOxbBOTZXZsfAw= +github.com/speakeasy-api/jsonpath v0.6.4-0.20261016002236-43d52ac89b20/go.mod h1:TmWEGgh4W878JDCrSv0eMult7SYW5bAOqOg8b5zaEvo= 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.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= @@ -31,10 +25,5 @@ golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc= golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From daec030de9faefbd62e3a06f9a64bf2fe224f09a Mon Sep 17 00:00:00 2001 From: Tristan Cartledge Date: Fri, 16 Oct 2026 10:36:42 +1000 Subject: [PATCH 12/14] chore: bump speakeasy-api/jsonpath to v0.7.0 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 429ccf52..5b8b2273 100644 --- a/go.mod +++ b/go.mod @@ -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.6.4-0.20261016002236-43d52ac89b20 + github.com/speakeasy-api/jsonpath v0.7.0 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.5 diff --git a/go.sum b/go.sum index 3949e956..244085b4 100644 --- a/go.sum +++ b/go.sum @@ -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.6.4-0.20261016002236-43d52ac89b20 h1:cUUIOfmatWE/9rZugqm2ZEenBx0kzqOxbBOTZXZsfAw= -github.com/speakeasy-api/jsonpath v0.6.4-0.20261016002236-43d52ac89b20/go.mod h1:TmWEGgh4W878JDCrSv0eMult7SYW5bAOqOg8b5zaEvo= +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/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= From d7358484c4d592a5efd7fb125811100694e5c5da Mon Sep 17 00:00:00 2001 From: Tristan Cartledge Date: Fri, 16 Oct 2026 10:37:15 +1000 Subject: [PATCH 13/14] chore: point customrules at root module with jsonpath v0.7.0 --- openapi/linter/customrules/go.mod | 2 +- openapi/linter/customrules/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openapi/linter/customrules/go.mod b/openapi/linter/customrules/go.mod index ec457eed..97292dae 100644 --- a/openapi/linter/customrules/go.mod +++ b/openapi/linter/customrules/go.mod @@ -8,7 +8,7 @@ require ( github.com/dop251/goja v0.0.0-20260106131823-651366fbe6e3 github.com/evanw/esbuild v0.28.2 github.com/go-sourcemap/sourcemap v2.1.4+incompatible - github.com/speakeasy-api/openapi v1.25.7-0.20261016002523-f0b9f7b1815a + github.com/speakeasy-api/openapi v1.25.7-0.20261016003642-daec030de9fa github.com/stretchr/testify v1.12.1 go.yaml.in/yaml/v3 v3.0.5 ) diff --git a/openapi/linter/customrules/go.sum b/openapi/linter/customrules/go.sum index cf9f6ede..72d54d0f 100644 --- a/openapi/linter/customrules/go.sum +++ b/openapi/linter/customrules/go.sum @@ -12,8 +12,8 @@ github.com/google/pprof v0.0.0-20230207041349-798e818bf904 h1:4/hN5RUoecvl+RmJRE github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8qtYCYyzA+8c/9qtqgA3qsXGYqCPKARAFg= 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.6.4-0.20261016002236-43d52ac89b20 h1:cUUIOfmatWE/9rZugqm2ZEenBx0kzqOxbBOTZXZsfAw= -github.com/speakeasy-api/jsonpath v0.6.4-0.20261016002236-43d52ac89b20/go.mod h1:TmWEGgh4W878JDCrSv0eMult7SYW5bAOqOg8b5zaEvo= +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/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.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= From f308ebf5f5b90b2948160c8b0e4e7fe86dbe4687 Mon Sep 17 00:00:00 2001 From: Tristan Cartledge Date: Fri, 16 Oct 2026 10:38:08 +1000 Subject: [PATCH 14/14] chore: point cmd/openapi and test modules at jsonpath v0.7.0 root module --- cmd/openapi/go.mod | 6 +++--- cmd/openapi/go.sum | 12 ++++++------ jsonschema/oas3/tests/go.sum | 4 ++-- openapi/linter/converter/tests/go.mod | 2 +- openapi/linter/converter/tests/go.sum | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cmd/openapi/go.mod b/cmd/openapi/go.mod index 126e6441..998b127b 100644 --- a/cmd/openapi/go.mod +++ b/cmd/openapi/go.mod @@ -6,8 +6,8 @@ require ( charm.land/bubbles/v2 v2.2.1 charm.land/bubbletea/v2 v2.1.0 charm.land/lipgloss/v2 v2.0.6 - github.com/speakeasy-api/openapi v1.25.7-0.20261016002555-32acaee53505 - github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261016002555-32acaee53505 + github.com/speakeasy-api/openapi v1.25.7-0.20261016003715-d7358484c4d5 + github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261016003715-d7358484c4d5 github.com/spf13/cobra v1.10.2 github.com/stretchr/testify v1.12.1 go.yaml.in/yaml/v3 v3.0.5 @@ -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.6.4-0.20261016002236-43d52ac89b20 // indirect + github.com/speakeasy-api/jsonpath v0.7.0 // 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 diff --git a/cmd/openapi/go.sum b/cmd/openapi/go.sum index 9b801938..122447da 100644 --- a/cmd/openapi/go.sum +++ b/cmd/openapi/go.sum @@ -68,12 +68,12 @@ 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.6.4-0.20261016002236-43d52ac89b20 h1:cUUIOfmatWE/9rZugqm2ZEenBx0kzqOxbBOTZXZsfAw= -github.com/speakeasy-api/jsonpath v0.6.4-0.20261016002236-43d52ac89b20/go.mod h1:TmWEGgh4W878JDCrSv0eMult7SYW5bAOqOg8b5zaEvo= -github.com/speakeasy-api/openapi v1.25.7-0.20261016002555-32acaee53505 h1:QPk3rJGOOwednMTBUMNRBEs5Xusa5gxePB0RFd1VDXw= -github.com/speakeasy-api/openapi v1.25.7-0.20261016002555-32acaee53505/go.mod h1:SV2Y2bAMXZQxxHBUyAXVAlDStrwmhGno7dHNJsmEJ5Q= -github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261016002555-32acaee53505 h1:tjIa/wloSLl0veQ27rdEoDPkJzQe1HnJR8iOWb9i0mo= -github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261016002555-32acaee53505/go.mod h1:XnSOGtPTFxkK7TgpwE8/SPh9zw3301FdKVHrf8bZDhU= +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/openapi v1.25.7-0.20261016003715-d7358484c4d5 h1:r+3lr39h+ewjU1sHFbuyA+bwrzyJJPWUC6XX+QB79O0= +github.com/speakeasy-api/openapi v1.25.7-0.20261016003715-d7358484c4d5/go.mod h1:s6JWKjXFdDeZa55vHlYyXBTs/F275Yv8yr+c4C7Xj7Q= +github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261016003715-d7358484c4d5 h1:y81LUVAHCwGBu7dAEMj/mNu/EXF+zmWmVA0vGhfszVQ= +github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261016003715-d7358484c4d5/go.mod h1:TUry7iIg3QWLVsLdohKfixGec0wu45mL4syZDYOQXW8= 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/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= diff --git a/jsonschema/oas3/tests/go.sum b/jsonschema/oas3/tests/go.sum index 76b2e9c0..e3a80b81 100644 --- a/jsonschema/oas3/tests/go.sum +++ b/jsonschema/oas3/tests/go.sum @@ -82,8 +82,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.6.4-0.20261016002236-43d52ac89b20 h1:cUUIOfmatWE/9rZugqm2ZEenBx0kzqOxbBOTZXZsfAw= -github.com/speakeasy-api/jsonpath v0.6.4-0.20261016002236-43d52ac89b20/go.mod h1:TmWEGgh4W878JDCrSv0eMult7SYW5bAOqOg8b5zaEvo= +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/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= diff --git a/openapi/linter/converter/tests/go.mod b/openapi/linter/converter/tests/go.mod index 2e38af91..461de95b 100644 --- a/openapi/linter/converter/tests/go.mod +++ b/openapi/linter/converter/tests/go.mod @@ -8,7 +8,7 @@ replace ( ) require ( - github.com/speakeasy-api/openapi v1.25.7-0.20261016002523-f0b9f7b1815a + github.com/speakeasy-api/openapi v1.25.7-0.20261016003642-daec030de9fa github.com/speakeasy-api/openapi/openapi/linter/customrules v0.0.0-20261015113746-577889a836ef github.com/stretchr/testify v1.12.1 ) diff --git a/openapi/linter/converter/tests/go.sum b/openapi/linter/converter/tests/go.sum index cf9f6ede..72d54d0f 100644 --- a/openapi/linter/converter/tests/go.sum +++ b/openapi/linter/converter/tests/go.sum @@ -12,8 +12,8 @@ github.com/google/pprof v0.0.0-20230207041349-798e818bf904 h1:4/hN5RUoecvl+RmJRE github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8qtYCYyzA+8c/9qtqgA3qsXGYqCPKARAFg= 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.6.4-0.20261016002236-43d52ac89b20 h1:cUUIOfmatWE/9rZugqm2ZEenBx0kzqOxbBOTZXZsfAw= -github.com/speakeasy-api/jsonpath v0.6.4-0.20261016002236-43d52ac89b20/go.mod h1:TmWEGgh4W878JDCrSv0eMult7SYW5bAOqOg8b5zaEvo= +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/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.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw=