From 4076574f52c819a6e5f87ea6ef697a49af902c61 Mon Sep 17 00:00:00 2001 From: Ola Okelola <10857143+lolopinto@users.noreply.github.com> Date: Sun, 17 Nov 2024 18:49:49 -0800 Subject: [PATCH] Update error (#1857) --- docker_CHANGELOG.md | 4 ++++ internal/schema/schema.go | 2 +- internal/schema/schema_input_test.go | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docker_CHANGELOG.md b/docker_CHANGELOG.md index 980d57f36..a1a11e5cd 100644 --- a/docker_CHANGELOG.md +++ b/docker_CHANGELOG.md @@ -9,6 +9,10 @@ Changelog for the npm version are [here](/CHANGELOG.md). ## [Unreleased] +### Added + +- Updated error when there's duplicate names in generated GraphQL Schema (#1857) + ## [0.2.0-alpha.9] - 2024-11-11 ### Fixed diff --git a/internal/schema/schema.go b/internal/schema/schema.go index b27ba9dd2..9552ae0d2 100644 --- a/internal/schema/schema.go +++ b/internal/schema/schema.go @@ -1084,7 +1084,7 @@ func (s *Schema) loadExistingEdges() (*assocEdgeData, error) { // ExposeToGraphQL() bool func (s *Schema) addGQLType(name string) error { if s.gqlTypeMap[name] { - return fmt.Errorf("there's already an entity with GraphQL name %s", name) + return fmt.Errorf("there's already an entity with GraphQL name %s. Maybe Node and Pattern with the same name?", name) } s.gqlTypeMap[name] = true return nil diff --git a/internal/schema/schema_input_test.go b/internal/schema/schema_input_test.go index ed34b3a9f..dac291e2b 100644 --- a/internal/schema/schema_input_test.go +++ b/internal/schema/schema_input_test.go @@ -2112,7 +2112,7 @@ func TestDuplicateNames(t *testing.T) { schema, err := schema.ParseFromInputSchema(&codegenapi.DummyConfig{}, inputSchema, base.GoLang) require.Nil(t, schema) - require.Equal(t, err.Error(), "there's already an entity with GraphQL name ProfileType") + require.Equal(t, err.Error(), "there's already an entity with GraphQL name ProfileType. Maybe Node and Pattern with the same name?") } func TestMultipleActionsHiddenFromGraphQL(t *testing.T) {