Skip to content

Use of @subSchema does not eagerly instantiate a ModelSchema #187

@mressler

Description

@mressler

If, in the test code on line 842 of ts.ts, we did not add an @serializable annotation, the ModelSchema for PictureTodo would not be instantiated, getOrCreateSchema called from subSchema would return ToDo instead of PictureToDo and the invariant on the very next line would trigger, resulting in an Error: "Can not apply subSchema on a schema not extending another one.".

I think the lazy evaluation is assuming there will be an @serialize annotation on an intermediate subclass (like PictureToDo) which will trigger the createModelSchema call. However, in my use case, I have an intermediate class that does not provide additional properties for serialization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions