Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when building swagger file with relative $ref files #1193

Closed
jamiehannaford opened this issue Sep 4, 2015 · 7 comments
Closed

error when building swagger file with relative $ref files #1193

jamiehannaford opened this issue Sep 4, 2015 · 7 comments
Milestone

Comments

@jamiehannaford
Copy link

When I generate HTML docs from this Swagger file, I get an error. This is the command I'm using:

./run-in-docker.sh generate \
-i https://raw.githubusercontent.com/jamiehannaford/swagger-magnum/jamie/v1/swagger.json \
-o samples/html \
-l html

and this is the error I get:

Why is it not accepting $refs to internal or relative files? The example in the spec allows it.

@wing328
Copy link
Contributor

wing328 commented Sep 4, 2015

It's not supported by Swagger-Codegen at the moment: #742

@jamiehannaford
Copy link
Author

@wing328 ah okay, no worries 😄

Does swagger-ui support it? I noticed some JS errors when I tried the same thing

@wing328
Copy link
Contributor

wing328 commented Sep 4, 2015

I'm not sure. I would suggest you to ask in swagger-ui project page to get the official answer.

@ChrisTitos
Copy link

This exception is caused by something in swagger-core. A pull request has been opened, but not merged yet.

swagger-api/swagger-core#1388

@fehguy
Copy link
Contributor

fehguy commented Sep 9, 2015

@jamiehannaford Looks like you have a JSON parse error in your referenced file:

https://raw.githubusercontent.com/jamiehannaford/swagger-magnum/jamie/v1/baymodels/operations.json#

The delete 204 response has a trailing comma.

@jamiehannaford
Copy link
Author

@fehguy Good catch, thanks! When I fix that JSON line, I still get various errors. When I specify a local file:

java.io.FileNotFoundException: /Users/jamie/projects/openstack/swagger-magnum/v1/swagger.json (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:146)
at com.fasterxml.jackson.core.JsonFactory.createParser(JsonFactory.java:708)
at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:1861)
at io.swagger.parser.SwaggerCompatConverter.readResourceListing(SwaggerCompatConverter.java:147)
at io.swagger.parser.SwaggerCompatConverter.read(SwaggerCompatConverter.java:82)
at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:36)
at io.swagger.codegen.cmd.Generate.run(Generate.java:133)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
Exception in thread "main" java.lang.RuntimeException: missing swagger input or config!
at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:60)
at io.swagger.codegen.cmd.Generate.run(Generate.java:134)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)

When I specify a remote file:

reading from https://raw.githubusercontent.com/jamiehannaford/swagger-magnum/master/v1/swagger.json
java.net.UnknownHostException: raw.githubusercontent.com
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:637)
at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:160)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.protocol.https.HttpsClient.(HttpsClient.java:275)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:371)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:933)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:153)
at io.swagger.parser.util.RemoteUrl.urlToString(RemoteUrl.java:98)
at io.swagger.parser.Swagger20Parser.read(Swagger20Parser.java:27)
at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:27)
at io.swagger.codegen.cmd.Generate.run(Generate.java:133)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
raw.githubusercontent.com
reading from https://raw.githubusercontent.com/jamiehannaford/swagger-magnum/master/v1/swagger.json
java.net.UnknownHostException: raw.githubusercontent.com
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:637)
at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:160)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.protocol.https.HttpsClient.(HttpsClient.java:275)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:371)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:933)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:153)
at io.swagger.parser.util.RemoteUrl.urlToString(RemoteUrl.java:98)
at io.swagger.parser.Swagger20Parser.read(Swagger20Parser.java:27)
at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:36)
at io.swagger.codegen.cmd.Generate.run(Generate.java:133)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
raw.githubusercontent.com
java.net.UnknownHostException: raw.githubusercontent.com
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:637)
at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:160)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.protocol.https.HttpsClient.(HttpsClient.java:275)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:371)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:933)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:153)
at io.swagger.parser.util.RemoteUrl.urlToString(RemoteUrl.java:98)
at io.swagger.parser.SwaggerCompatConverter.readResourceListing(SwaggerCompatConverter.java:144)
at io.swagger.parser.SwaggerCompatConverter.read(SwaggerCompatConverter.java:82)
at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:36)
at io.swagger.codegen.cmd.Generate.run(Generate.java:133)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
java.net.UnknownHostException: raw.githubusercontent.com
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:637)
at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:160)
at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
at sun.net.www.protocol.https.HttpsClient.(HttpsClient.java:275)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:371)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:933)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:153)
at io.swagger.parser.util.RemoteUrl.urlToString(RemoteUrl.java:98)
at io.swagger.parser.SwaggerCompatConverter.readResourceListing(SwaggerCompatConverter.java:144)
at io.swagger.parser.SwaggerCompatConverter.read(SwaggerCompatConverter.java:82)
at io.swagger.parser.SwaggerParser.read(SwaggerParser.java:36)
at io.swagger.codegen.cmd.Generate.run(Generate.java:133)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)
Exception in thread "main" java.lang.RuntimeException: missing swagger input or config!
at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:60)
at io.swagger.codegen.cmd.Generate.run(Generate.java:134)
at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:35)

@fehguy
Copy link
Contributor

fehguy commented Oct 26, 2015

Hi, you must be experiencing some network issue. The UnknownHostErrors are valid, but not (I think) caused by codegen. Please reopen if you need more help.

@fehguy fehguy closed this as completed Oct 26, 2015
@fehguy fehguy modified the milestone: v2.1.4 Oct 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants