Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ protected Pair<CodeBlock, String> getSelectCodeAndFieldSource(GenerationField fi
? generateCorrelatedSubquery(field, context.nextContext(field))
: generateSelectRow(context.nextContext(field));
} else if (field.isExternalField()) {
JOOQMapping table = processedSchema.getObject(field.getContainerTypeName()).getTable();
JOOQMapping table = context.getTargetTable();

if (table == null) {
throw new IllegalArgumentException("No table found for field " + field.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ void externalField() {
);
}

@Test
@DisplayName("External field in wrapper type without table should find previous target table")
void externalFieldWrappedType() {
assertGeneratedContentContains("externalFieldWrappedType",
"DSL.row(no.sikt.graphitron.codereferences.extensionmethods.ClassWithExtensionMethod.name(_a_customer))"
);
}

@Test
@DisplayName("Field annotated with @externalField should map types correctly even when over 22 fields")
void externalFieldOver22() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
type Query {
query: Customer
}

type Customer @table {
something: Something
}

type Something {
name: String @externalField
}