Fix recursive polymorphism definition resolution#22
Conversation
b782eb9 to
28f9f34
Compare
28f9f34 to
d428561
Compare
d428561 to
3622b14
Compare
5d3d655 to
3622b14
Compare
zrrobbins
left a comment
There was a problem hiding this comment.
Your changes make sense to me, although have you confirmed this works as expected for your use case. I.e. locally installing the updated library and running whatever project is dependent on it?
On that note as well, I'll tag the API Tooling Team here (@elangan @CyanCode) as that was what I originally imported/tweaked this library's use cases for. They may want to test the updated library themselves to ensure Swagger generation still performs as expected.
I have! I've been using the resulting branch build |
This should fix two issues:
getDefinitionNamebut did not consider that classes sharing a simple name can have suffixes in their long and short ref names, the resolution could lead to issues where a definition for a class in one package was being overridden by a definition for a class sharing the same simple name in another package.definitionsNode.set(ref, w.nodeInProgress)instead ofdefinitionsNode.set(shortRef, w.nodeInProgress)for in progress nodes, which would lead to duplicate definitions in the final schema (one with the long ref, one with the short ref). This call also appears to be redundant, since if a definition is in progress, it should always be added to the definitions set, even across runs, but it was left in place, but with a check to alwaysReturnDefinitions, in case I missed something.Context:
772dc8b
https://hubspot.slack.com/archives/C08ADS1C887/p1740094210967859
https://hubspot.slack.com/archives/C5QNWTWFJ/p1740139578561809