davidmoten / openapi-to-plantuml Goto Github PK
View Code? Open in Web Editor NEWConverts OpenAPI 3.0 definitions to Plant UML text for visualisation of your API.
License: Apache License 2.0
Converts OpenAPI 3.0 definitions to Plant UML text for visualisation of your API.
License: Apache License 2.0
Hi @davidmoten
I tried to build uml for 5gc openapis. I built openapi-to-plantuml first.
Then I run inside 5gc open api folder -> https://github.com/jdegre/5GC_APIs.git. but I get below error.
Am I doing in correct way ?
5GC_APIs$ java -jar openapi-to-plantuml/target/openapi-to-plantuml-0.1.9-SNAPSHOT-jar-with-dependencies.jar TS29531_Nnssf_NSSelection.yaml PNG openapi.png11
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.lang.RuntimeException: could not find ref=./TS29571_CommonData.yaml#/components/schemas/NfInstanceId
at com.github.davidmoten.oas3.internal.Names.refToClassName(Names.java:94)
at com.github.davidmoten.oas3.internal.Common.getUmlTypeName(Common.java:285)
at com.github.davidmoten.oas3.internal.Common.getUmlTypeName(Common.java:279)
at com.github.davidmoten.oas3.internal.Common.getUmlTypeName(Common.java:302)
at com.github.davidmoten.oas3.internal.Common.getUmlTypeName(Common.java:279)
at com.github.davidmoten.oas3.internal.Common.lambda$toModelClass$1(Common.java:120)
at java.base/java.util.LinkedHashMap$LinkedEntrySet.forEach(LinkedHashMap.java:671)
at com.github.davidmoten.oas3.internal.Common.toModelClass(Common.java:81)
at com.github.davidmoten.oas3.internal.ComponentsHelper.lambda$toModel$0(ComponentsHelper.java:24)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.reduce(ReferencePipeline.java:553)
at com.github.davidmoten.oas3.internal.ComponentsHelper.toModel(ComponentsHelper.java:26)
at com.github.davidmoten.oas3.puml.Converter.openApiToPuml(Converter.java:62)
at com.github.davidmoten.oas3.puml.Converter.openApiToPuml(Converter.java:55)
at com.github.davidmoten.oas3.puml.Converter.openApiToPuml(Converter.java:41)
at com.github.davidmoten.oas3.puml.Converter.openApiToPuml(Converter.java:46)
at com.github.davidmoten.oas3.puml.ConverterMain.main(ConverterMain.java:42)
5GC_APIs$
5GC_APIs$
5GC_APIs$ ls | grep TS29571_CommonData.yaml
TS29571_CommonData.yaml
The jar with dependencies is 29 MB and most POM listed dependencies are large size too. For example guava-31.0.1-android.jar is itself close to 3 MB in size. What are the jar files that are absolutely required to embed in another application to run and generate the puml from swagger.
First, I would like to mention that this is a really nice tool, I like it so much.
Recently I have found a bug in it. Please see the details below.
I use the following command to generate the PNG:
java -jar openapi-to-plantuml-0.1.20-jar-with-dependencies.jar my-api.yaml PNG my-api.png
Unfortunately, my *.yaml is quite huge and the generated image dimension is not big enough to show the whole picture.
I uploaded the result (image) here and you can check it.
The yaml file we have is not public so I can not share it on the internet but I can send it to you in a private channel but you are not allowed to share/publish it.
Could you please fix this issue?
Thanks.
Hello,
Thank you for sharing your project.
Just a question, did you plan to support map definition (https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#model-with-mapdictionary-properties).
Again thank you.
Hello,
First, thanks for this wonderful work :)
I would like to run it on CI to allow people to make some beautiful PlantUML pictures from OpenAPI specifications, but I face the following issue :
Exception in thread "main" java.awt.AWTError: Can't connect to X11 window server using 'localhost:0.0' as the value of the DISPLAY variable.
at java.desktop/sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at java.desktop/sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:102)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:61)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at java.desktop/java.awt.GraphicsEnvironment$LocalGE.createGE(GraphicsEnvironment.java:101)
at java.desktop/java.awt.GraphicsEnvironment$LocalGE.<clinit>(GraphicsEnvironment.java:83)
at java.desktop/java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:129)
at java.desktop/java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1181)
at net.sourceforge.plantuml.FileFormat.<clinit>(FileFormat.java:126)
at com.github.davidmoten.oas3.puml.ConverterMain.main(ConverterMain.java:36)
Is there a simple way to run it without X11 installed or is it necessary to adapt the code ?
Thanks in advance
Nico
I am running into the following exception when trying to convert a JSON Swagger structure
[ERROR] java.lang.NullPointerException
java.lang.NullPointerException: null
at com.github.davidmoten.oas3.internal.PathsHelper.toModelParameter(PathsHelper.java:130) ~[openapi-to-plantuml-0.1.12-SNAPSHOT.jar:?]
at com.github.davidmoten.oas3.internal.PathsHelper.lambda$toModelParameters$4(PathsHelper.java:76) ~[openapi-to-plantuml-0.1.12-SNAPSHOT.jar:?]
at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) ~[?:1.8.0_221]
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(Unknown Source) ~[?:1.8.0_221]
at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[?:1.8.0_221]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[?:1.8.0_221]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source) ~[?:1.8.0_221]
at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[?:1.8.0_221]
at java.util.stream.ReferencePipeline.reduce(Unknown Source) ~[?:1.8.0_221]
at com.github.davidmoten.oas3.internal.PathsHelper.toModelParameters(PathsHelper.java:77) ~[openapi-to-plantuml-0.1.12-SNAPSHOT.jar:?]
at com.github.davidmoten.oas3.internal.PathsHelper.lambda$toModelPath$2(PathsHelper.java:62) ~[openapi-to-plantuml-0.1.12-SNAPSHOT.jar:?]
at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) ~[?:1.8.0_221]
at java.util.Iterator.forEachRemaining(Unknown Source) ~[?:1.8.0_221]
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source) ~[?:1.8.0_221]
at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[?:1.8.0_221]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[?:1.8.0_221]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source) ~[?:1.8.0_221]
at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[?:1.8.0_221]
at java.util.stream.ReferencePipeline.reduce(Unknown Source) ~[?:1.8.0_221]
at com.github.davidmoten.oas3.internal.PathsHelper.toModelPath(PathsHelper.java:69) ~[openapi-to-plantuml-0.1.12-SNAPSHOT.jar:?]
at com.github.davidmoten.oas3.internal.PathsHelper.lambda$paths$0(PathsHelper.java:47) ~[openapi-to-plantuml-0.1.12-SNAPSHOT.jar:?]
at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) ~[?:1.8.0_221]
at java.util.Iterator.forEachRemaining(Unknown Source) ~[?:1.8.0_221]
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source) ~[?:1.8.0_221]
at java.util.stream.AbstractPipeline.copyInto(Unknown Source) ~[?:1.8.0_221]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) ~[?:1.8.0_221]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source) ~[?:1.8.0_221]
at java.util.stream.AbstractPipeline.evaluate(Unknown Source) ~[?:1.8.0_221]
at java.util.stream.ReferencePipeline.reduce(Unknown Source) ~[?:1.8.0_221]
at com.github.davidmoten.oas3.internal.PathsHelper.paths(PathsHelper.java:49) ~[openapi-to-plantuml-0.1.12-SNAPSHOT.jar:?]
at com.github.davidmoten.oas3.internal.PathsHelper.toModel(PathsHelper.java:37) ~[openapi-to-plantuml-0.1.12-SNAPSHOT.jar:?]
at com.github.davidmoten.oas3.puml.Converter.openApiToPuml(Converter.java:65) ~[openapi-to-plantuml-0.1.12-SNAPSHOT.jar:?]
at com.github.davidmoten.oas3.puml.Converter.openApiToPuml(Converter.java:57) ~[openapi-to-plantuml-0.1.12-SNAPSHOT.jar:?]
The Swagger structure is as below.
{
"swagger" : "2.0",
"info" : {
"version" : "1.0",
"title" : "Summary about the new REST service.",
"description" : "Summary about the new REST service."
},
"host" : "localhost:8089",
"basePath" : "/",
"schemes" : [ "http" ],
"paths" : {
"/profiles" : {
"get" : {
"description" : "",
"operationId" : "get-profiles",
"consumes" : [ "application/json" ],
"produces" : [ "application/json" ],
"parameters" : [ {
"name" : "UUID",
"in" : "query",
"description" : "",
"type" : "string",
"required" : false
} ],
"responses" : {
"200" : {
"description" : "a Profile to be returned",
"schema" : {
"$ref" : "#/definitions/Profile"
}
}
}
}
}
},
"definitions" : {
"Profile" : {
"type" : "object",
"required" : [ "PROFILE_ID", "UUID", "PHOTO_FILE_TYPE", "PHOTO_UPD_DT", "PHOTO" ],
"properties" : {
"UUID" : {
"type" : "string"
},
"PROFILE_ID" : {
"type" : "string"
},
"PHOTO" : {
"type" : "string"
},
"PHOTO_FILE_TYPE" : {
"type" : "string"
},
"PHOTO_UPD_DT" : {
"type" : "string"
}
}
}
}
}
Limitations:
Only handles internal references ("#/*"), that is the yaml file should be self-contained. As of 0.1.9 external refs are displayed but not exploded. Full external reference support is being considered.
Dear creator,
I need this feature and would like to enable it.
What do you need in order to make it possible. I haven't taken the time to work into the code and create a new branch with that feature.
Are you working on it yourself?
Thank you for your great work :)
Creation of a Gradle plugin of an Gradle plugin, will enable an integration of the workflow of building the services and the documentation
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.