Seeking Guidance on Attaching Metadata to Foreign Key in Frontend Code Generation

Hi guys, I have a question I'm not sure how to ask. I am trying to model entities from our DB in our frontend (via code generation). For example, an entity called BankAccount can have an organisation property that for now is modeled as a S.String which is the foreign key in the DB. However, I would like to attach a sort of metadata, which will be a reference to the Organisation schema, such that I can actually determine on a type level (and validating level) when the organisation field is populated and sent back not as a
string
but as an Organisation. I assume I'll have to adapt a String schema to have this, like, metadata, but the docs are a bit too terse for me to know how to do approach this. Does this seem like a familiar problem with an actual solution?
Was this page helpful?