You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Caused by: java.lang.NullPointerException
at java.util.HashMap.putMapEntries (HashMap.java:501)
at java.util.HashMap.putAll (HashMap.java:785)
at com.kicksolutions.swagger.plantuml.PlantUMLCodegen.getClassMembers (PlantUMLCodegen.java:745)
at com.kicksolutions.swagger.plantuml.PlantUMLCodegen.getClassMembers (PlantUMLCodegen.java:693)
at com.kicksolutions.swagger.plantuml.PlantUMLCodegen.processSwaggerModels (PlantUMLCodegen.java:577)
at com.kicksolutions.swagger.plantuml.PlantUMLCodegen.preprocessSwagger (PlantUMLCodegen.java:120)
at com.kicksolutions.swagger.plantuml.PlantUMLCodegen.generatePuml (PlantUMLCodegen.java:83)
at com.kicksolutions.swagger.plantuml.PlantUMLGenerator.transformSwagger2Puml (PlantUMLGenerator.java:43)
at com.kicksolutions.swagger.Swagger2PlantUML.process (Swagger2PlantUML.java:71)
at com.kicksolutions.swagger.Swagger2PlantUML.init (Swagger2PlantUML.java:55)
at com.kicksolutions.swagger.Swagger2PlantUML.main (Swagger2PlantUML.java:37)`
It looks like when the getClassMembers(ComposedModel) method loops over the "AllOf" list of the target model to resolve the parent model's properties, that if the parent is itself the child of another type that it's getProperties() method returns null, causing the NPE when we try to put them into the child's Map of properties.
I'm attaching a patch with a proposed fix.
There is a secondary issue, also addressed in the patch, which is that even with the NPE fixed the code wasn't correctly resolving the full list of properties from the descendant types.
In the example above, the UML generated for "ChildObj1" looked like:
`
class ChildObj1 {
- prop3 :String
}`
With the patch applied we recurse to get properties from the descendants, and the output includes prop1 & prop2 from the parent & grandparent types:
`
Hi @stroisi,
I've made a fork of this project and renamed it OpenApi2Puml. I've added your fix to a pull request and given you a mention in there.
Thank you very much for the work and if you'd be interested in collaborating it would be great.
When processing a yaml with definitions that include multiple levels of inheritance an NPE is thrown.
Example model:
`
NPE Stacktrace:
`
It looks like when the getClassMembers(ComposedModel) method loops over the "AllOf" list of the target model to resolve the parent model's properties, that if the parent is itself the child of another type that it's getProperties() method returns null, causing the NPE when we try to put them into the child's Map of properties.
I'm attaching a patch with a proposed fix.
There is a secondary issue, also addressed in the patch, which is that even with the NPE fixed the code wasn't correctly resolving the full list of properties from the descendant types.
In the example above, the UML generated for "ChildObj1" looked like:
`
class ChildObj1 {
- prop3 :String
}`
With the patch applied we recurse to get properties from the descendants, and the output includes prop1 & prop2 from the parent & grandparent types:
`
class ChildObj1 {
- prop3 :String
- prop2:String
- prop1:String
}`
The text was updated successfully, but these errors were encountered: