Class RubyClientCodegen
- java.lang.Object
-
- io.swagger.codegen.v3.generators.DefaultCodegenConfig
-
- io.swagger.codegen.v3.generators.ruby.RubyClientCodegen
-
- All Implemented Interfaces:
io.swagger.codegen.v3.CodegenConfig
public class RubyClientCodegen extends DefaultCodegenConfig
-
-
Field Summary
Fields Modifier and Type Field Description protected StringapiDocPathprotected static intemptyMethodNameCounterstatic StringGEM_AUTHORstatic StringGEM_AUTHOR_EMAILstatic StringGEM_DESCRIPTIONstatic StringGEM_HOMEPAGEstatic StringGEM_LICENSEstatic StringGEM_NAMEstatic StringGEM_REQUIRED_RUBY_VERSIONstatic StringGEM_SUMMARYstatic StringGEM_VERSIONprotected StringgemAuthorprotected StringgemAuthorEmailprotected StringgemDescriptionprotected StringgemHomepageprotected StringgemLicenseprotected StringgemNameprotected StringgemRequiredRubyVersionprotected StringgemSummaryprotected StringgemVersionprotected StringlibFolderprotected StringmodelDocPathstatic StringMODULE_NAMEprotected StringmoduleNameprotected StringspecFolder-
Fields inherited from class io.swagger.codegen.v3.generators.DefaultCodegenConfig
additionalProperties, allowUnicodeIdentifiers, apiDocTemplateFiles, apiPackage, apiTemplateFiles, apiTestTemplateFiles, cliOptions, commonTemplateDir, configFiles, customTemplateDir, DEFAULT_CONTENT_TYPE, DEFAULT_TEMPLATE_DIR, defaultIncludes, embeddedTemplateDir, ensureUniqueParams, fileSuffix, gitRepoBaseURL, gitRepoId, gitUserId, hideGenerationTimestamp, httpUserAgent, ignoreFilePathOverride, ignoreImportMapping, importMapping, inputSpec, inputURL, instantiationTypes, IS_NULLABLE_FALSE, IS_NULLABLE_TRUE, languageArguments, languageSpecificPrimitives, library, modelDocTemplateFiles, modelNamePrefix, modelNameSuffix, modelPackage, modelTemplateFiles, modelTestTemplateFiles, openAPI, outputFolder, releaseNote, removeOperationIdPrefix, REQUEST_BODY_NAME, reservedWords, reservedWordsMappings, skipOverwrite, sortParamsByRequiredFlag, specialCharReplacements, supportedLibraries, supportingFiles, supportsInheritance, supportsMixins, templateDir, templateEngine, templateVersion, testPackage, typeAliases, typeMapping, unflattenedOpenAPI, useOas2, vendorExtensions
-
-
Constructor Summary
Constructors Constructor Description RubyClientCodegen()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringapiDocFileFolder()StringapiFileFolder()StringapiTestFileFolder()StringescapeQuotationMark(String input)Escape single and/or double quote to avoid code injectionStringescapeReservedWord(String name)Return the escaped name of the reserved wordStringescapeUnsafeCharacters(String input)override with any special text escaping logic to handle unsafe characters so as to avoid code injectionio.swagger.codegen.v3.CodegenOperationfromOperation(String path, String httpMethod, io.swagger.v3.oas.models.Operation operation, Map<String,io.swagger.v3.oas.models.media.Schema> definitions, io.swagger.v3.oas.models.OpenAPI openAPI)Convert Swagger Operation object to Codegen Operation objectStringgetDefaultTemplateDir()StringgetHelp()StringgetName()StringgetSchemaType(io.swagger.v3.oas.models.media.Schema schema)returns the swagger type for the propertyio.swagger.codegen.v3.CodegenTypegetTag()StringgetTypeDeclaration(io.swagger.v3.oas.models.media.Schema schema)Output the type declaration of the propertyStringmodelDocFileFolder()StringmodelFileFolder()StringmodelTestFileFolder()Map<String,Object>postProcessModels(Map<String,Object> objs)voidprocessOpts()voidsetGemAuthor(String gemAuthor)voidsetGemAuthorEmail(String gemAuthorEmail)voidsetGemDescription(String gemDescription)voidsetGemHomepage(String gemHomepage)voidsetGemLicense(String gemLicense)voidsetGemName(String gemName)voidsetGemRequiredRubyVersion(String gemRequiredRubyVersion)voidsetGemSummary(String gemSummary)voidsetGemVersion(String gemVersion)voidsetModuleName(String moduleName)voidsetParameterExampleValue(io.swagger.codegen.v3.CodegenParameter p)Return the example value of the parameter.booleanshouldOverwrite(String filename)StringtoApiDocFilename(String name)Return the file name of the Api DocumentationStringtoApiFilename(String name)Return the file name of the Api TestStringtoApiImport(String name)Return the fully-qualified "Api" name for importStringtoApiName(String name)Output the API (class) name (capitalized) ending with "Api" Return DefaultApi if name is emptyStringtoApiTestFilename(String name)Return the file name of the Api TestStringtoDefaultValue(io.swagger.v3.oas.models.media.Schema schema)Return the default value of the propertyStringtoEnumName(io.swagger.codegen.v3.CodegenProperty property)Return the Enum name (e.g.StringtoEnumValue(String value, String datatype)Return the enum value in the language specified format e.g.StringtoEnumVarName(String name, String datatype)Return the sanitized variable name for enumStringtoModelDocFilename(String name)Return the capitalized file name of the model documentationStringtoModelFilename(String name)Return the capitalized file name of the modelStringtoModelName(String name)Output the proper model name (capitalized).StringtoModelTestFilename(String name)Return the capitalized file name of the model testStringtoOperationId(String operationId)Return the operation ID (method name)StringtoParamName(String name)Return the parameter name by removing invalid characters and proper escaping if it's a reserved word.StringtoVarName(String name)Return the variable name by removing invalid characters and proper escaping if it's a reserved word.-
Methods inherited from class io.swagger.codegen.v3.generators.DefaultCodegenConfig
addAdditionPropertiesToCodeGenModel, addCodegenContentParameters, addConsumesInfo, addHandlebarHelpers, addImport, additionalProperties, addOperationImports, addOperationToGroup, addOption, addOption, addParameters, addParentContainer, addProducesInfo, addProperties, addRegularExpressionDelimiter, addSwitch, addVars, apiDocFilename, apiDocTemplateFiles, apiFilename, apiPackage, apiTemplateFiles, apiTestFilename, apiTestTemplateFiles, buildLibraryCliOption, camelize, camelize, cliOptions, configFiles, configureDataForTestTemplate, configuresParameterForMediaType, convertPropertyToBoolean, convertPropertyToBooleanAndWriteBack, copyFirstAllOfProperties, customTemplateDir, dashize, defaultIgnoreImportMappingOption, defaultIncludes, detectParent, embeddedTemplateDir, ensureUniqueParameters, escapeText, fileSuffix, findCommonPrefixOfVars, findMethodResponse, fixUpParentAndInterfaces, fromModel, fromModel, fromOperation, fromParameter, fromProperty, fromRequestBody, fromResponse, fromSecurity, generateExamplePath, getAlias, getArgumentsLocation, getCollectionFormat, getCommonTemplateDir, getConsumesInfo, getContentType, getGitRepoBaseURL, getGitRepoId, getGitUserId, getHideGenerationTimestamp, getHttpUserAgent, getIgnoreFilePathOverride, getIgnoreImportMapping, getInnerEnumAllowableValues, getInputSpec, getInputURL, getLanguageArguments, getLibrary, getOpenAPI, getOptionValue, getOrGenerateOperationId, getOutputDir, getParameterFromRef, getParentName, getProducesInfo, getReleaseNote, getSchemaFromBody, getSchemaFromParameter, getSchemaFromResponse, getSchemaHandler, getSortParamsByRequiredFlag, getSymbolName, getTemplateDir, getTemplateEngine, getTemplateVersion, getterAndSetterCapitalize, getTypeDeclaration, hasSchemaProperties, hasTrueAdditionalProperties, importMapping, initialCaps, instantiationTypes, isDataTypeBinary, isDataTypeFile, isFileTypeSchema, isObjectSchema, isPrimivite, isPropertyInnerMostEnum, isRemoveOperationIdPrefix, isReservedWord, isSkipOverwrite, languageSpecificPrimitives, modelDocTemplateFiles, modelPackage, modelTemplateFiles, modelTestTemplateFiles, needsUnflattenedSpec, needToImport, outputFolder, postProcessAllCodegenModels, postProcessAllModels, postProcessModelProperty, postProcessModelsEnum, postProcessOperations, postProcessOperationsWithModels, postProcessParameter, postProcessSupportingFileData, preprocessOpenAPI, processCompiler, processMapSchema, processModelEnums, processOpenAPI, processPropertySchemaContainerTypes, processPropertySchemaTypes, readLanguageArguments, removeNonNameElementToCamelCase, removeNonNameElementToCamelCase, reservedWords, reservedWordsMappings, sanitizeName, sanitizeTag, setAllowUnicodeIdentifiers, setApiPackage, setCommonTemplateDir, setEnsureUniqueParams, setGitRepoBaseURL, setGitRepoId, setGitUserId, setHideGenerationTimestamp, setHttpUserAgent, setIgnoreFilePathOverride, setIgnoreImportMapping, setInputSpec, setInputURL, setLanguageArguments, setLibrary, setModelNamePrefix, setModelNameSuffix, setModelPackage, setNonArrayMapProperty, setOutputDir, setParameterBooleanFlagWithCodegenProperty, setParameterJson, setParameterNullable, setReleaseNote, setRemoveOperationIdPrefix, setReservedWords, setReservedWordsLowerCase, setSchemaProperties, setSkipOverwrite, setSortParamsByRequiredFlag, setTemplateDir, setTemplateEngine, setTemplateVersion, setUnflattenedOpenAPI, setUseOas2, snakeCase, supportedLibraries, supportingFiles, templateDir, testPackage, toApiVarName, toBooleanGetter, toDefaultValueWithParam, toEnumDefaultValue, toExamples, toExampleValue, toGetter, toInstantiationType, toModelImport, toRegularExpression, toSetter, typeMapping, underscore, updateCodegenModelEnumVars, updateCodegenPropertyEnum, updateDataTypeWithEnumForArray, updateDataTypeWithEnumForMap, updatePropertyForArray, updatePropertyForMap, vendorExtensions, writeOptional, writeOptional, writePropertyBack
-
-
-
-
Field Detail
-
GEM_NAME
public static final String GEM_NAME
- See Also:
- Constant Field Values
-
MODULE_NAME
public static final String MODULE_NAME
- See Also:
- Constant Field Values
-
GEM_VERSION
public static final String GEM_VERSION
- See Also:
- Constant Field Values
-
GEM_LICENSE
public static final String GEM_LICENSE
- See Also:
- Constant Field Values
-
GEM_REQUIRED_RUBY_VERSION
public static final String GEM_REQUIRED_RUBY_VERSION
- See Also:
- Constant Field Values
-
GEM_HOMEPAGE
public static final String GEM_HOMEPAGE
- See Also:
- Constant Field Values
-
GEM_SUMMARY
public static final String GEM_SUMMARY
- See Also:
- Constant Field Values
-
GEM_DESCRIPTION
public static final String GEM_DESCRIPTION
- See Also:
- Constant Field Values
-
GEM_AUTHOR
public static final String GEM_AUTHOR
- See Also:
- Constant Field Values
-
GEM_AUTHOR_EMAIL
public static final String GEM_AUTHOR_EMAIL
- See Also:
- Constant Field Values
-
gemName
protected String gemName
-
moduleName
protected String moduleName
-
gemVersion
protected String gemVersion
-
specFolder
protected String specFolder
-
libFolder
protected String libFolder
-
gemLicense
protected String gemLicense
-
gemRequiredRubyVersion
protected String gemRequiredRubyVersion
-
gemHomepage
protected String gemHomepage
-
gemSummary
protected String gemSummary
-
gemDescription
protected String gemDescription
-
gemAuthor
protected String gemAuthor
-
gemAuthorEmail
protected String gemAuthorEmail
-
apiDocPath
protected String apiDocPath
-
modelDocPath
protected String modelDocPath
-
emptyMethodNameCounter
protected static int emptyMethodNameCounter
-
-
Method Detail
-
processOpts
public void processOpts()
- Specified by:
processOptsin interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
processOptsin classDefaultCodegenConfig
-
fromOperation
public io.swagger.codegen.v3.CodegenOperation fromOperation(String path, String httpMethod, io.swagger.v3.oas.models.Operation operation, Map<String,io.swagger.v3.oas.models.media.Schema> definitions, io.swagger.v3.oas.models.OpenAPI openAPI)
Description copied from class:DefaultCodegenConfigConvert Swagger Operation object to Codegen Operation object- Specified by:
fromOperationin interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
fromOperationin classDefaultCodegenConfig- Parameters:
path- the path of the operationhttpMethod- HTTP methodoperation- Swagger operation objectdefinitions- a map of schemasopenAPI- a OpenAPI object representing the spec- Returns:
- Codegen Operation object
-
getTag
public io.swagger.codegen.v3.CodegenType getTag()
-
getName
public String getName()
-
getHelp
public String getHelp()
-
escapeReservedWord
public String escapeReservedWord(String name)
Description copied from class:DefaultCodegenConfigReturn the escaped name of the reserved word- Specified by:
escapeReservedWordin interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
escapeReservedWordin classDefaultCodegenConfig- Parameters:
name- the name to be escaped- Returns:
- the escaped reserved word throws Runtime exception as reserved word is not allowed (default behavior)
-
apiFileFolder
public String apiFileFolder()
- Specified by:
apiFileFolderin interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
apiFileFolderin classDefaultCodegenConfig
-
modelFileFolder
public String modelFileFolder()
- Specified by:
modelFileFolderin interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
modelFileFolderin classDefaultCodegenConfig
-
apiTestFileFolder
public String apiTestFileFolder()
- Specified by:
apiTestFileFolderin interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
apiTestFileFolderin classDefaultCodegenConfig
-
modelTestFileFolder
public String modelTestFileFolder()
- Specified by:
modelTestFileFolderin interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
modelTestFileFolderin classDefaultCodegenConfig
-
apiDocFileFolder
public String apiDocFileFolder()
- Specified by:
apiDocFileFolderin interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
apiDocFileFolderin classDefaultCodegenConfig
-
modelDocFileFolder
public String modelDocFileFolder()
- Specified by:
modelDocFileFolderin interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
modelDocFileFolderin classDefaultCodegenConfig
-
getTypeDeclaration
public String getTypeDeclaration(io.swagger.v3.oas.models.media.Schema schema)
Description copied from class:DefaultCodegenConfigOutput the type declaration of the property- Specified by:
getTypeDeclarationin interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
getTypeDeclarationin classDefaultCodegenConfig- Parameters:
schema- Schema Property object- Returns:
- a string presentation of the property type
-
toDefaultValue
public String toDefaultValue(io.swagger.v3.oas.models.media.Schema schema)
Description copied from class:DefaultCodegenConfigReturn the default value of the property- Overrides:
toDefaultValuein classDefaultCodegenConfig- Parameters:
schema- Schema property object- Returns:
- string presentation of the default value of the property
-
getSchemaType
public String getSchemaType(io.swagger.v3.oas.models.media.Schema schema)
Description copied from class:DefaultCodegenConfigreturns the swagger type for the property- Overrides:
getSchemaTypein classDefaultCodegenConfig- Parameters:
schema- Schema property object- Returns:
- string presentation of the type
-
toVarName
public String toVarName(String name)
Description copied from class:DefaultCodegenConfigReturn the variable name by removing invalid characters and proper escaping if it's a reserved word.- Overrides:
toVarNamein classDefaultCodegenConfig- Parameters:
name- the variable name- Returns:
- the sanitized variable name
-
toParamName
public String toParamName(String name)
Description copied from class:DefaultCodegenConfigReturn the parameter name by removing invalid characters and proper escaping if it's a reserved word.- Specified by:
toParamNamein interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
toParamNamein classDefaultCodegenConfig- Parameters:
name- Codegen property object- Returns:
- the sanitized parameter name
-
toModelName
public String toModelName(String name)
Description copied from class:DefaultCodegenConfigOutput the proper model name (capitalized). In case the name belongs to the TypeSystem it won't be renamed.- Specified by:
toModelNamein interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
toModelNamein classDefaultCodegenConfig- Parameters:
name- the name of the model- Returns:
- capitalized model name
-
toModelFilename
public String toModelFilename(String name)
Description copied from class:DefaultCodegenConfigReturn the capitalized file name of the model- Specified by:
toModelFilenamein interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
toModelFilenamein classDefaultCodegenConfig- Parameters:
name- the model name- Returns:
- the file name of the model
-
toModelDocFilename
public String toModelDocFilename(String name)
Description copied from class:DefaultCodegenConfigReturn the capitalized file name of the model documentation- Specified by:
toModelDocFilenamein interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
toModelDocFilenamein classDefaultCodegenConfig- Parameters:
name- the model name- Returns:
- the file name of the model
-
toApiFilename
public String toApiFilename(String name)
Description copied from class:DefaultCodegenConfigReturn the file name of the Api Test- Specified by:
toApiFilenamein interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
toApiFilenamein classDefaultCodegenConfig- Parameters:
name- the file name of the Api- Returns:
- the file name of the Api
-
toApiDocFilename
public String toApiDocFilename(String name)
Description copied from class:DefaultCodegenConfigReturn the file name of the Api Documentation- Specified by:
toApiDocFilenamein interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
toApiDocFilenamein classDefaultCodegenConfig- Parameters:
name- the file name of the Api- Returns:
- the file name of the Api
-
toApiTestFilename
public String toApiTestFilename(String name)
Description copied from class:DefaultCodegenConfigReturn the file name of the Api Test- Specified by:
toApiTestFilenamein interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
toApiTestFilenamein classDefaultCodegenConfig- Parameters:
name- the file name of the Api- Returns:
- the file name of the Api
-
toModelTestFilename
public String toModelTestFilename(String name)
Description copied from class:DefaultCodegenConfigReturn the capitalized file name of the model test- Specified by:
toModelTestFilenamein interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
toModelTestFilenamein classDefaultCodegenConfig- Parameters:
name- the model name- Returns:
- the file name of the model
-
toApiName
public String toApiName(String name)
Description copied from class:DefaultCodegenConfigOutput the API (class) name (capitalized) ending with "Api" Return DefaultApi if name is empty- Specified by:
toApiNamein interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
toApiNamein classDefaultCodegenConfig- Parameters:
name- the name of the Api- Returns:
- capitalized Api name ending with "Api"
-
toEnumValue
public String toEnumValue(String value, String datatype)
Description copied from class:DefaultCodegenConfigReturn the enum value in the language specified format e.g. status becomes "status"- Overrides:
toEnumValuein classDefaultCodegenConfig- Parameters:
value- enum variable namedatatype- data type- Returns:
- the sanitized value for enum
-
toEnumVarName
public String toEnumVarName(String name, String datatype)
Description copied from class:DefaultCodegenConfigReturn the sanitized variable name for enum- Overrides:
toEnumVarNamein classDefaultCodegenConfig- Parameters:
name- enum variable namedatatype- data type- Returns:
- the sanitized variable name for enum
-
toEnumName
public String toEnumName(io.swagger.codegen.v3.CodegenProperty property)
Description copied from class:DefaultCodegenConfigReturn the Enum name (e.g. StatusEnum given 'status')- Overrides:
toEnumNamein classDefaultCodegenConfig- Parameters:
property- Codegen property- Returns:
- the Enum name
-
postProcessModels
public Map<String,Object> postProcessModels(Map<String,Object> objs)
- Specified by:
postProcessModelsin interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
postProcessModelsin classDefaultCodegenConfig
-
toOperationId
public String toOperationId(String operationId)
Description copied from class:DefaultCodegenConfigReturn the operation ID (method name)- Overrides:
toOperationIdin classDefaultCodegenConfig- Parameters:
operationId- operation ID- Returns:
- the sanitized method name
-
toApiImport
public String toApiImport(String name)
Description copied from class:DefaultCodegenConfigReturn the fully-qualified "Api" name for import- Specified by:
toApiImportin interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
toApiImportin classDefaultCodegenConfig- Parameters:
name- the name of the "Api"- Returns:
- the fully-qualified "Api" name for import
-
setParameterExampleValue
public void setParameterExampleValue(io.swagger.codegen.v3.CodegenParameter p)
Description copied from class:DefaultCodegenConfigReturn the example value of the parameter.- Overrides:
setParameterExampleValuein classDefaultCodegenConfig- Parameters:
p- Swagger property object
-
setGemName
public void setGemName(String gemName)
-
setModuleName
public void setModuleName(String moduleName)
-
setGemVersion
public void setGemVersion(String gemVersion)
-
setGemDescription
public void setGemDescription(String gemDescription)
-
setGemSummary
public void setGemSummary(String gemSummary)
-
setGemLicense
public void setGemLicense(String gemLicense)
-
setGemRequiredRubyVersion
public void setGemRequiredRubyVersion(String gemRequiredRubyVersion)
-
setGemHomepage
public void setGemHomepage(String gemHomepage)
-
setGemAuthor
public void setGemAuthor(String gemAuthor)
-
setGemAuthorEmail
public void setGemAuthorEmail(String gemAuthorEmail)
-
shouldOverwrite
public boolean shouldOverwrite(String filename)
- Specified by:
shouldOverwritein interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
shouldOverwritein classDefaultCodegenConfig
-
getDefaultTemplateDir
public String getDefaultTemplateDir()
- Specified by:
getDefaultTemplateDirin classDefaultCodegenConfig
-
escapeQuotationMark
public String escapeQuotationMark(String input)
Description copied from class:DefaultCodegenConfigEscape single and/or double quote to avoid code injection- Specified by:
escapeQuotationMarkin interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
escapeQuotationMarkin classDefaultCodegenConfig- Parameters:
input- String to be cleaned up- Returns:
- string with quotation mark removed or escaped
-
escapeUnsafeCharacters
public String escapeUnsafeCharacters(String input)
Description copied from class:DefaultCodegenConfigoverride with any special text escaping logic to handle unsafe characters so as to avoid code injection- Specified by:
escapeUnsafeCharactersin interfaceio.swagger.codegen.v3.CodegenConfig- Overrides:
escapeUnsafeCharactersin classDefaultCodegenConfig- Parameters:
input- String to be cleaned up- Returns:
- string with unsafe characters removed or escaped
-
-