Closed richard-jfc closed 3 months ago
Hey @richard-jfc,
Doing the full fix you suggest is quite a bit tougher. We'd need to support reading the Typescript AST within a schema (currently the typescript AST reading is only done for methods, statics, virtuals and other surrounding items, but parsing the fields themselves will be a bit more complicated. Would be great to add this eventually but don't have the time right now.
For the time being I made the simpler fix you suggested, live in v9.3.2. Feel free to re-open this if you don't think its satisfactory, and will try to get to it when things open up
I'm seeing the error:
When trying to generate with a schema that uses a function for its ref:
It would be great if it could determine (from the typescript types) that the type should be:
MainDocument['_id'] | MainDocument | DesertDocument['id'] | DesertDocument
I guess a slightly easier fix might be to just return
mongoose.Types.ObjectId