Git Product home page Git Product logo

swagger2puml's People

Contributors

astrodex2020 avatar manishabardiya avatar santoshm1188 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

swagger2puml's Issues

inheritance support?

Does uml gen support inheritance definition? I have got NPE when I tried to use json with inheritance definition.

INFO: Processing Model UICLParametrizationBonus
Mar 07, 2018 10:57:49 PM com.kicksolutions.swagger.plantuml.PlantUMLGenerator transformSwagger2Puml
SEVERE: null
java.lang.NullPointerException
	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:73)
	at com.kicksolutions.swagger.Swagger2PlantUML.init(Swagger2PlantUML.java:57)
	at com.kicksolutions.swagger.Swagger2PlantUML.main(Swagger2PlantUML.java:39)

Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerException
	at com.kicksolutions.swagger.plantuml.PlantUMLGenerator.transformSwagger2Puml(PlantUMLGenerator.java:53)
	at com.kicksolutions.swagger.Swagger2PlantUML.process(Swagger2PlantUML.java:73)
	at com.kicksolutions.swagger.Swagger2PlantUML.init(Swagger2PlantUML.java:57)
	at com.kicksolutions.swagger.Swagger2PlantUML.main(Swagger2PlantUML.java:39)
Caused by: java.lang.NullPointerException
	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)
	... 3 more
1 Michal-MacBook-Pro:target kolisko$ 

here is the definition file:

swagger.txt

Usage detail

Hello,

I tried using your tool, but found the documentation to be a bit unclear on how to do so. Here's what I did:

  • cloned the repo
  • did a mvn clean install

But I can't find the swagger2puml.jar that is mentioned in the docs.

What am I missing ?

Thanks a lot for your help :)

All the best;

Dockerfile

A Dockerfile would allow running the application without the need to install Java locally on e.g. a Mac computer for one diagram.

It's called OpenAPI ๐Ÿ˜…

Howdy! I found this thing Goolging and it looks awesome. I want to put it on openapi.tools but wanted to point out: the specification has not been called Swagger for a long time.

The name of the specification is OpenAPI, and tools should probably use that in their name instead of Swagger, as that's just the name of the official set of tools (Swagger Codegen, Swagger UI, Swagger Editor).

Maybe rename to openapi2puml, and make the description "Generate Class Diagrams (UML) for Given OpenAPI (f.k.a Swagger) Definition" so it still shows up on Google for both searches.

NPE when using multilevel inheritance

When processing a yaml with definitions that include multiple levels of inheritance an NPE is thrown.

Example model:
`

  GrandParentObj:
    discriminator: objType
    required:
      - objType
    properties:
      prop1:
        type: string
      objType:
        type: string

  ParentObj:
    allOf:
      - $ref: '#/definitions/GrandParentObj'
      - type: object
        properties:
          prop2:
            type: string
        
  ChildObj1:
    allOf:
      - $ref: '#/definitions/ParentObj'
      - type: object
        properties:
          prop3:
            type: string`

NPE Stacktrace:
`

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:
`

class ChildObj1 {
- prop3 :String
- prop2:String
- prop1:String
}`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.