mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 03:18:53 +00:00
Fix syntax error when there are no authMethods
This commit is contained in:
parent
a24fee00cb
commit
a51d71e728
@ -218,7 +218,11 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
bundle.put("models", allModels);
|
||||
bundle.put("apiFolder", config.apiPackage().replace('.', File.separatorChar));
|
||||
bundle.put("modelPackage", config.modelPackage());
|
||||
bundle.put("authMethods", config.fromSecurity(swagger.getSecurityDefinitions()));
|
||||
List<CodegenSecurity> authMethods = config.fromSecurity(swagger.getSecurityDefinitions());
|
||||
if (!authMethods.isEmpty()) {
|
||||
bundle.put("authMethods", authMethods);
|
||||
bundle.put("hasAuthMethods", true);
|
||||
}
|
||||
if (swagger.getExternalDocs() != null) {
|
||||
bundle.put("externalDocs", swagger.getExternalDocs());
|
||||
}
|
||||
|
@ -30,10 +30,12 @@ module {{moduleName}}
|
||||
self.path = path
|
||||
|
||||
attributes.each { |name, value| send "#{name}=", value }
|
||||
|
||||
{{#hasAuthMethods}}
|
||||
update_params_for_auth!
|
||||
{{/hasAuthMethods}}
|
||||
end
|
||||
|
||||
{{#hasAuthMethods}}
|
||||
# Update hearder and query params based on authentication settings.
|
||||
def update_params_for_auth!
|
||||
(@auth_names || []).each do |auth_name|
|
||||
@ -48,6 +50,7 @@ module {{moduleName}}
|
||||
end
|
||||
end
|
||||
end
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
# Get API key (with prefix if set).
|
||||
# @param [String] param_name the parameter name of API key auth
|
||||
|
@ -30,10 +30,12 @@ module Petstore
|
||||
self.path = path
|
||||
|
||||
attributes.each { |name, value| send "#{name}=", value }
|
||||
|
||||
|
||||
update_params_for_auth!
|
||||
|
||||
end
|
||||
|
||||
|
||||
# Update hearder and query params based on authentication settings.
|
||||
def update_params_for_auth!
|
||||
(@auth_names || []).each do |auth_name|
|
||||
@ -47,6 +49,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Get API key (with prefix if set).
|
||||
# @param [String] param_name the parameter name of API key auth
|
||||
|
Loading…
Reference in New Issue
Block a user