forked from loafle/openapi-generator-original
Fix hard-coded values in Ruby client: scheme, host and base_path
This commit is contained in:
parent
444666a365
commit
7db7b146be
@ -93,12 +93,14 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
}
|
||||
|
||||
StringBuilder hostBuilder = new StringBuilder();
|
||||
String scheme;
|
||||
if (swagger.getSchemes() != null && swagger.getSchemes().size() > 0) {
|
||||
hostBuilder.append(swagger.getSchemes().get(0).toValue());
|
||||
hostBuilder.append("://");
|
||||
scheme = swagger.getSchemes().get(0).toValue();
|
||||
} else {
|
||||
hostBuilder.append("https://");
|
||||
scheme = "https";
|
||||
}
|
||||
hostBuilder.append(scheme);
|
||||
hostBuilder.append("://");
|
||||
if (swagger.getHost() != null) {
|
||||
hostBuilder.append(swagger.getHost());
|
||||
} else {
|
||||
@ -209,6 +211,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
bundle.put("host", swagger.getHost());
|
||||
}
|
||||
bundle.put("basePath", basePath);
|
||||
bundle.put("scheme", scheme);
|
||||
bundle.put("contextPath", contextPath);
|
||||
bundle.put("apiInfo", apis);
|
||||
bundle.put("models", allModels);
|
||||
|
@ -8,9 +8,9 @@ module Swagger
|
||||
# Defaults go in here..
|
||||
def initialize
|
||||
@format = 'json'
|
||||
@scheme = 'http'
|
||||
@host = 'petstore.swagger.io'
|
||||
@base_path = '/v2'
|
||||
@scheme = '{{scheme}}'
|
||||
@host = '{{host}}'
|
||||
@base_path = '{{contextPath}}'
|
||||
@user_agent = "ruby-swagger-#{Swagger::VERSION}"
|
||||
@inject_format = false
|
||||
@force_ending_format = false
|
||||
|
Loading…
x
Reference in New Issue
Block a user