From c76a3bb013c67e694474eb1e4c6fb3074cd9a365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CCoreFloDev=E2=80=9D?= <“CoreFloDev@users.noreply.github.com”> Date: Thu, 25 Aug 2022 15:03:23 +0200 Subject: [PATCH 1/3] update yaml to v3 --- codegen/config/config.go | 8 ++++++-- go.mod | 2 +- go.sum | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/codegen/config/config.go b/codegen/config/config.go index 2b45c3c2516..9deba8b106e 100644 --- a/codegen/config/config.go +++ b/codegen/config/config.go @@ -1,6 +1,7 @@ package config import ( + "bytes" "fmt" "os" "path/filepath" @@ -11,7 +12,7 @@ import ( "github.com/99designs/gqlgen/internal/code" "github.com/vektah/gqlparser/v2" "github.com/vektah/gqlparser/v2/ast" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" ) type Config struct { @@ -102,7 +103,10 @@ func LoadConfig(filename string) (*Config, error) { return nil, fmt.Errorf("unable to read config: %w", err) } - if err := yaml.UnmarshalStrict(b, config); err != nil { + dec := yaml.NewDecoder(bytes.NewReader(b)) + dec.KnownFields(true) + + if err := dec.Decode(config); err != nil { return nil, fmt.Errorf("unable to parse config: %w", err) } diff --git a/go.mod b/go.mod index f683e5339dd..1c39a296d35 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( golang.org/x/text v0.3.7 golang.org/x/tools v0.1.10 google.golang.org/protobuf v1.28.0 - gopkg.in/yaml.v2 v2.4.0 + gopkg.in/yaml.v3 v3.0.1 ) require github.com/agnivade/levenshtein v1.1.1 // indirect diff --git a/go.sum b/go.sum index 0711f71cf28..a0add0cdb39 100644 --- a/go.sum +++ b/go.sum @@ -102,5 +102,6 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/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-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= 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= From fd07ece5b0104125c993882a31545c3936336dbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CCoreFloDev=E2=80=9D?= <“CoreFloDev@users.noreply.github.com”> Date: Thu, 25 Aug 2022 18:18:54 +0200 Subject: [PATCH 2/3] add missing go entry for yaml on _example --- _examples/go.sum | 2 ++ 1 file changed, 2 insertions(+) diff --git a/_examples/go.sum b/_examples/go.sum index d2349a6abd1..404e96edf3c 100644 --- a/_examples/go.sum +++ b/_examples/go.sum @@ -159,6 +159,8 @@ 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-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= 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= sourcegraph.com/sourcegraph/appdash v0.0.0-20210831040556-ec77a7fbcadc h1:nJW47Hpj4Gr/742Zg4BWuWGuEtZ5d7CpPkMDA9o/CHo= sourcegraph.com/sourcegraph/appdash v0.0.0-20210831040556-ec77a7fbcadc/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67 h1:e1sMhtVq9AfcEy8AXNb8eSg6gbzfdpYhoNqnPJa+GzI= From c00ea6d545da16f18558a34bafc54789f42d9989 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CCoreFloDev=E2=80=9D?= <“CoreFloDev@users.noreply.github.com”> Date: Thu, 25 Aug 2022 18:34:54 +0200 Subject: [PATCH 3/3] add missing sum file --- _examples/go.sum | 1 - 1 file changed, 1 deletion(-) diff --git a/_examples/go.sum b/_examples/go.sum index 404e96edf3c..464128159cb 100644 --- a/_examples/go.sum +++ b/_examples/go.sum @@ -157,7 +157,6 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/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-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= 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=