diff --git a/go.mod b/go.mod index 1dcac6b522..eed32d4867 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( github.com/jarcoal/httpmock v1.4.1 github.com/mongodb-forks/digest v1.1.0 github.com/mongodb/atlas-sdk-go v1.0.1-0.20251103084024-4a19449c6541 - github.com/pb33f/libopenapi v0.27.2 + github.com/pb33f/libopenapi v0.28.1 github.com/sebdah/goldie/v2 v2.8.0 github.com/spf13/cast v1.10.0 github.com/stretchr/testify v1.11.1 diff --git a/go.sum b/go.sum index 98b183162f..de802a12e2 100644 --- a/go.sum +++ b/go.sum @@ -475,8 +475,8 @@ github.com/openlyinc/pointy v1.1.2 h1:LywVV2BWC5Sp5v7FoP4bUD+2Yn5k0VNeRbU5vq9jUM github.com/openlyinc/pointy v1.1.2/go.mod h1:w2Sytx+0FVuMKn37xpXIAyBNhFNBIJGR/v2m7ik1WtM= github.com/pb33f/jsonpath v0.1.2 h1:PlqXjEyecMqoYJupLxYeClCGWEpAFnh4pmzgspbXDPI= github.com/pb33f/jsonpath v0.1.2/go.mod h1:TtKnUnfqZm48q7a56DxB3WtL3ipkVtukMKGKxaR/uXU= -github.com/pb33f/libopenapi v0.27.2 h1:buDwqA6SKWwrG4YZwJprBV+bk8uizqLgiF4lkIV9w14= -github.com/pb33f/libopenapi v0.27.2/go.mod h1:mHMHA3ZKSZDTInNAuUtqkHlKLIjPm2HN1vgsGR57afc= +github.com/pb33f/libopenapi v0.28.1 h1:vqE1Q08F6ohABsyKcK8kX7HYkR/+sILXGwCgFzF+aOg= +github.com/pb33f/libopenapi v0.28.1/go.mod h1:mHMHA3ZKSZDTInNAuUtqkHlKLIjPm2HN1vgsGR57afc= github.com/pb33f/ordered-map/v2 v2.3.0 h1:k2OhVEQkhTCQMhAicQ3Z6iInzoZNQ7L9MVomwKBZ5WQ= github.com/pb33f/ordered-map/v2 v2.3.0/go.mod h1:oe5ue+6ZNhy7QN9cPZvPA23Hx0vMHnNVeMg4fGdCANw= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= diff --git a/tools/codegen/codespec/api_spec_test.go b/tools/codegen/codespec/api_spec_test.go index f6a0677684..6fa51f1de2 100644 --- a/tools/codegen/codespec/api_spec_test.go +++ b/tools/codegen/codespec/api_spec_test.go @@ -77,8 +77,8 @@ func TestBuildSchema(t *testing.T) { openAPIDoc := fmt.Sprintf(openAPIDocTemplate, tc.schemaDefinition) doc, err := libopenapi.NewDocument([]byte(openAPIDoc)) require.NoError(t, err) - model, errs := doc.BuildV3Model() - require.Empty(t, errs) + model, err := doc.BuildV3Model() + require.NoError(t, err) schemaProxy := model.Model.Components.Schemas.GetOrZero("TestSchema") require.NotNil(t, schemaProxy) result, err := codespec.BuildSchema(schemaProxy) diff --git a/tools/codegen/openapi/parser.go b/tools/codegen/openapi/parser.go index c6908de2d3..2546a79619 100644 --- a/tools/codegen/openapi/parser.go +++ b/tools/codegen/openapi/parser.go @@ -18,12 +18,9 @@ func ParseAtlasAdminAPI(filePath string) (*libopenapi.DocumentModel[v3.Document] if err != nil { return nil, fmt.Errorf("cannot create new document: %e", err) } - docModel, errors := document.BuildV3Model() - if len(errors) > 0 { - for i := range errors { - fmt.Printf("error: %e\n", errors[i]) - } - return nil, fmt.Errorf("cannot create v3 model from document: %d errors reported", len(errors)) + docModel, err := document.BuildV3Model() + if err != nil { + return nil, fmt.Errorf("cannot create v3 model from document: %w", err) } return docModel, nil