TypedJSON icon indicating copy to clipboard operation
TypedJSON copied to clipboard

Cross reference models

Open volodyad opened this issue 8 years ago • 1 comments

Can we handle cross reference? at the moment if two class reference each other we have got the error @JsonMember: type detected for '${propertyName}' is undefined.

volodyad avatar Feb 28 '17 14:02 volodyad

Unfortunately, this is inherently a problem with how decorators are evaluated at runtime. It could be possible to defer them by passing a callback to them, but this would require either:

  1. significant additions of code to the serialization/deserialization process to check if the involved objects are ready, and wait if not (requiring an async API of TypedJSON)
  2. not calling TypedJSON functions (parse, stringify) until the decorators have been applied, which would require some kind of detection mechanism to work reliably

Nevertheless, I'll have a look at this once the new TypedJSON is out. It might be included through an experimental API.

JohnWeisz avatar Mar 07 '17 14:03 JohnWeisz