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
|
||||
|
@ -32,8 +32,10 @@ module Petstore
|
||||
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|
|
||||
@ -48,6 +50,7 @@ module Petstore
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Get API key (with prefix if set).
|
||||
# @param [String] param_name the parameter name of API key auth
|
||||
def get_api_key_with_prefix(param_name)
|
||||
|
Loading…
Reference in New Issue
Block a user