Skip to content

Commit

Permalink
Introduce LinkResolver for link fields
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-tan committed Dec 6, 2022
1 parent 831f748 commit c8bb954
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions schema_salad/dlang_codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def prologue(self) -> None:
import salad.meta.dumper : genDumper;
import salad.meta.impl : genCtor, genIdentifier, genOpEq;
import salad.meta.parser : import_ = importFromURI;
import salad.meta.uda : documentRoot, id, idMap, link, secondaryFilesDSL, typeDSL;
import salad.meta.uda : documentRoot, id, idMap, link, LinkResolver, secondaryFilesDSL, typeDSL;
import salad.primitives : SchemaBase;
import salad.type : None, Either;
Expand Down Expand Up @@ -148,11 +148,11 @@ def parse_record_field_type(
annotations.append(f'@idMap("{subject}", "{predicate}")')
else:
annotations.append(f'@idMap("{subject}")')
if (
jsonld_pred.get("_type", "") == "@id"
and not jsonld_pred.get("identity", False)
):
annotations.append("@link")
if jsonld_pred.get("_type", "") == "@id":
if jsonld_pred.get("identity", False):
annotations.append("@link(LinkResolver.id)")
else:
annotations.append("@link()")
if annotations:
annotate_str = " ".join(annotations) + " "
else:
Expand Down

0 comments on commit c8bb954

Please sign in to comment.