Open DMaro28 opened 1 week ago
I do vaguely remember fixing it so if you still have it with the full code base it would be good to have the recent repro. My guess is something to do with circular reference and the order of evaluation of those. When you have your whole code base it must change and hit a broken flow. You could try moving models around to see if that solve the issue
Describe the bug
On version 0.55.0 of the compiler, mapping is incomplete for a discriminated model if a child model is used elsewhere in the spec. Please note that in WidgetBase mapping, discriminator maps only LightWidget. If HeavyWidget is not used in SomeModel (by commenting out line 47, and uncommenting 48), both child models are mapped correctly. To be precise, HeavyWidget is defined in the spec, but not mapped in discriminator. Since we are using discriminated models for polymorphism, code generators are not outputting correctly due to missing mapping. Please confirm if this is a bug.
I've also tried the same code sample on latest 0.59.1 compiler. Mapping is emitted correctly in that case, for this simple sample. But if I try to run in on entire codebase (with packages, other discriminated models with inheritance and multiple files), issue still persists. Mapping is missing for child models that are used elsewhere in the spec. Any suggestions on root cause of the issue and solution would be very much appreciated.
Reproduction
produces:
Checklist