From 650f2a3ca7b0ee82dd26cd21f4d671e21c8957fd Mon Sep 17 00:00:00 2001 From: horbe Date: Tue, 28 Nov 2023 09:46:53 -0500 Subject: [PATCH] Update GraphQL extends directive to include class argument, include StrictDate in GraphQL SDL tests (#2480) * Update simpleTest.pure * Update simpleTest.pure * Update bindingCommon.pure * Update simpleTest.pure * Update simpleTest.pure --- .../binding/bindingCommon.pure | 4 ++-- .../binding/fromPure/sdl/tests/simpleTest.pure | 18 +++++++++++++----- .../binding/toPure/sdl/tests/simpleTest.pure | 6 +++++- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure/src/main/resources/core_external_query_graphql/binding/bindingCommon.pure b/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure/src/main/resources/core_external_query_graphql/binding/bindingCommon.pure index 7986292093f..43dc5f1a014 100644 --- a/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure/src/main/resources/core_external_query_graphql/binding/bindingCommon.pure +++ b/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure/src/main/resources/core_external_query_graphql/binding/bindingCommon.pure @@ -76,5 +76,5 @@ function meta::external::query::graphQL::binding::temporalityToDirectives(): Map function meta::external::query::graphQL::binding::hierarchyDirective(): DirectiveDefinition[1] { - ^DirectiveDefinition(name = 'extends', typeSystemLocation = [TypeSystemDirectiveLocation.OBJECT, TypeSystemDirectiveLocation.INPUT_OBJECT]); -} \ No newline at end of file + ^DirectiveDefinition(name = 'extends', argumentDefinitions = [^InputValueDefinition(name = 'class', type = ^NamedTypeReference(nullable = false, name = 'String'))], typeSystemLocation = [TypeSystemDirectiveLocation.OBJECT, TypeSystemDirectiveLocation.INPUT_OBJECT]); +} diff --git a/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure/src/main/resources/core_external_query_graphql/binding/fromPure/sdl/tests/simpleTest.pure b/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure/src/main/resources/core_external_query_graphql/binding/fromPure/sdl/tests/simpleTest.pure index 44d469792c8..d4cbbf220c9 100644 --- a/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure/src/main/resources/core_external_query_graphql/binding/fromPure/sdl/tests/simpleTest.pure +++ b/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure/src/main/resources/core_external_query_graphql/binding/fromPure/sdl/tests/simpleTest.pure @@ -47,6 +47,7 @@ Class meta::external::query::graphQL::binding::fromPure::sdl::tests::model::Clas date: Date[1]; datetime: DateTime[1]; decimal: Decimal[1]; + strictDate: StrictDate[1]; } Class <> meta::external::query::graphQL::binding::fromPure::sdl::tests::model::MutationPrimitive @@ -178,11 +179,14 @@ function <> meta::external::query::graphQL::binding::fromPure::sdl::t ' date: Date!\n' + ' datetime: DateTime!\n' + ' decimal: BigDecimal!\n' + + ' strictDate: StrictDate!\n' + '}\n' + '\n' + 'scalar Date\n' + '\n' + - 'scalar DateTime', $res); + 'scalar DateTime\n' + + '\n' + + 'scalar StrictDate', $res); } function <> meta::external::query::graphQL::binding::fromPure::sdl::tests::testNonBuiltInPrimitiveTypesAreNotDuplicated():Boolean[1] @@ -200,6 +204,7 @@ function <> meta::external::query::graphQL::binding::fromPure::sdl::t ' date: Date!\n' + ' datetime: DateTime!\n' + ' decimal: BigDecimal!\n' + + ' strictDate: StrictDate!\n' + '}\n' + '\n' + 'input ClassWithPrimitiveTypesInput {\n' + @@ -210,6 +215,7 @@ function <> meta::external::query::graphQL::binding::fromPure::sdl::t ' date: Date!\n' + ' datetime: DateTime!\n' + ' decimal: BigDecimal!\n' + + ' strictDate: StrictDate!\n' + '}\n' + '\n' + 'scalar Date\n' + @@ -220,6 +226,8 @@ function <> meta::external::query::graphQL::binding::fromPure::sdl::t ' upsertClass(class: ClassWithPrimitiveTypesInput!): ClassWithPrimitiveTypes\n' + '}\n' + '\n' + + 'scalar StrictDate\n' + + '\n' + 'schema {\n' + ' mutation : MutationPrimitive\n' + '}', $res); @@ -265,7 +273,7 @@ function <> meta::external::query::graphQL::binding::fromPure::sdl::t '\n' + 'scalar StrictDate\n' + '\n' + - 'directive @extends on OBJECT | INPUT_OBJECT', + 'directive @extends(class: String!) on OBJECT | INPUT_OBJECT', $res); } @@ -313,7 +321,7 @@ function <> meta::external::query::graphQL::binding::fromPure::sdl::t '\n' + 'scalar StrictDate\n' + '\n' + - 'directive @extends on OBJECT | INPUT_OBJECT', + 'directive @extends(class: String!) on OBJECT | INPUT_OBJECT', $res); } @@ -349,7 +357,7 @@ function <> meta::external::query::graphQL::binding::fromPure::sdl::t ' members: [Employee!]!\n' + '}\n' + '\n' + - 'directive @extends on OBJECT | INPUT_OBJECT', + 'directive @extends(class: String!) on OBJECT | INPUT_OBJECT', $res); } @@ -414,7 +422,7 @@ function <> meta::external::query::graphQL::binding::fromPure::sdl::t ' members: [EmployeeInput!]!\n' + '}\n' + '\n' + - 'directive @extends on OBJECT | INPUT_OBJECT\n' + + 'directive @extends(class: String!) on OBJECT | INPUT_OBJECT\n' + '\n' + 'schema {\n' + ' query : QueryHierarchy\n' + diff --git a/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure/src/main/resources/core_external_query_graphql/binding/toPure/sdl/tests/simpleTest.pure b/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure/src/main/resources/core_external_query_graphql/binding/toPure/sdl/tests/simpleTest.pure index 1f34e75abd9..f434f7e3a40 100644 --- a/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure/src/main/resources/core_external_query_graphql/binding/toPure/sdl/tests/simpleTest.pure +++ b/legend-engine-xts-graphQL/legend-engine-xt-graphQL-pure/src/main/resources/core_external_query_graphql/binding/toPure/sdl/tests/simpleTest.pure @@ -172,6 +172,7 @@ function <> meta::external::query::graphQL::binding::toPure::sdl::tes ' date: Date!\n' + ' datetime: DateTime!\n' + ' decimal: BigDecimal!\n' + + ' strictDate: StrictDate!\n' + '}\n' + '\n' + 'scalar Date\n' + @@ -179,6 +180,8 @@ function <> meta::external::query::graphQL::binding::toPure::sdl::tes 'scalar DateTime\n' + '\n' + 'scalar BigDecimal\n' + + '\n' + + 'scalar StrictDate\n' + '}#', 'meta::external::query::graphQL::metamodel::sql' ); @@ -193,6 +196,7 @@ function <> meta::external::query::graphQL::binding::toPure::sdl::tes ' date : Date[1];\n' + ' datetime : DateTime[1];\n' + ' decimal : Decimal[1];\n' + + ' strictDate : StrictDate[1];\n' + '}', $pureTypes); } @@ -511,4 +515,4 @@ function <> meta::external::query::graphQL::binding::toPure::sdl ->sortBy(t | $t->elementToPath()) ->map(t | $t->meta::pure::metamodel::serialization::grammar::printType()) ->joinStrings('\n\n'); -} \ No newline at end of file +}