Skip to content

Commit 941f9bc

Browse files
authored
dlang: fix mis-annotated link annotation (#632)
* dlang: fix mis-annotated link annotation * Introduce LinkResolver for link fields
1 parent 7bc0d8e commit 941f9bc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

schema_salad/dlang_codegen.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def prologue(self) -> None:
5151
import salad.meta.dumper : genDumper;
5252
import salad.meta.impl : genCtor, genIdentifier, genOpEq;
5353
import salad.meta.parser : import_ = importFromURI;
54-
import salad.meta.uda : documentRoot, id, idMap, link, secondaryFilesDSL, typeDSL;
54+
import salad.meta.uda : documentRoot, id, idMap, link, LinkResolver, secondaryFilesDSL, typeDSL;
5555
import salad.primitives : SchemaBase;
5656
import salad.type : None, Either;
5757
@@ -149,7 +149,10 @@ def parse_record_field_type(
149149
else:
150150
annotations.append(f'@idMap("{subject}")')
151151
if jsonld_pred.get("_type", "") == "@id":
152-
annotations.append("@link")
152+
if jsonld_pred.get("identity", False):
153+
annotations.append("@link(LinkResolver.id)")
154+
else:
155+
annotations.append("@link()")
153156
if annotations:
154157
annotate_str = " ".join(annotations) + " "
155158
else:

0 commit comments

Comments
 (0)