mirror of
				https://github.com/OpenAPITools/openapi-generator.git
				synced 2025-10-31 00:33:49 +00:00 
			
		
		
		
	Flash: remove (#10535)
This commit is contained in:
		
							parent
							
								
									5b1b74e48d
								
							
						
					
					
						commit
						c2186a0b0d
					
				
							
								
								
									
										6
									
								
								.github/.test/samples.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.github/.test/samples.json
									
									
									
									
										vendored
									
									
								
							| @ -217,12 +217,6 @@ | ||||
|         "Server: Scala" | ||||
|       ] | ||||
|     }, | ||||
|     { | ||||
|       "input": "flash-petstore.sh", | ||||
|       "matches": [ | ||||
|         "Client: Flash/ActionScript" | ||||
|       ] | ||||
|     }, | ||||
|     { | ||||
|       "input": "go-gin-petstore-server.sh", | ||||
|       "matches": [ | ||||
|  | ||||
							
								
								
									
										3
									
								
								.github/auto-labeler.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.github/auto-labeler.yml
									
									
									
									
										vendored
									
									
								
							| @ -62,9 +62,6 @@ labels: | ||||
|       - '\s*?-[gl] erlang(-.*)?-client\s*?' | ||||
|       - '\s*?\[erlang-proper\]\s*?' | ||||
|       - '\s*?-[gl] erlang-proper\s*?' | ||||
|     'Client: Flash/ActionScript': | ||||
|       - '\s*?\[flash\]\s*?' | ||||
|       - '\s*?-[gl] flash(?!-)\b' | ||||
|     'Client: Go': | ||||
|       - '\s*?\[go\]\s*?' | ||||
|       - '\s*?-[gl] go(?!-)\b' | ||||
|  | ||||
| @ -1,7 +0,0 @@ | ||||
| generatorName: flash | ||||
| outputDir: samples/client/petstore/flash | ||||
| inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml | ||||
| templateDir: modules/openapi-generator/src/main/resources/flash | ||||
| additionalProperties: | ||||
|   invokerPackage: org.openapitools | ||||
|   packageName: org.openapitools | ||||
| @ -29,7 +29,6 @@ The following generators are available: | ||||
| * [elm](generators/elm.md)   | ||||
| * [erlang-client](generators/erlang-client.md)   | ||||
| * [erlang-proper](generators/erlang-proper.md)   | ||||
| * [flash-deprecated (deprecated)](generators/flash-deprecated.md)   | ||||
| * [go](generators/go.md)   | ||||
| * [go-deprecated (deprecated)](generators/go-deprecated.md)   | ||||
| * [groovy](generators/groovy.md)   | ||||
|  | ||||
| @ -20,7 +20,6 @@ The following generators are available: | ||||
| * [elm](elm.md)   | ||||
| * [erlang-client](erlang-client.md)   | ||||
| * [erlang-proper](erlang-proper.md)   | ||||
| * [flash](flash.md)   | ||||
| * [go](go.md)   | ||||
| * [go-experimental (experimental)](go-experimental.md)   | ||||
| * [groovy](groovy.md)   | ||||
|  | ||||
| @ -1,182 +0,0 @@ | ||||
| --- | ||||
| title: Config Options for flash-deprecated | ||||
| sidebar_label: flash-deprecated | ||||
| --- | ||||
| 
 | ||||
| These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details. | ||||
| 
 | ||||
| | Option | Description | Values | Default | | ||||
| | ------ | ----------- | ------ | ------- | | ||||
| |invokerPackage|root package for generated code| |null| | ||||
| |packageName|flash package name (convention: package.name)| |org.openapitools| | ||||
| |packageVersion|flash package version| |1.0.0| | ||||
| |sourceFolder|source folder for generated code. e.g. flash| |null| | ||||
| 
 | ||||
| ## IMPORT MAPPING | ||||
| 
 | ||||
| | Type/Alias | Imports | | ||||
| | ---------- | ------- | | ||||
| |File|flash.filesystem.File| | ||||
| 
 | ||||
| 
 | ||||
| ## INSTANTIATION TYPES | ||||
| 
 | ||||
| | Type/Alias | Instantiated By | | ||||
| | ---------- | --------------- | | ||||
| 
 | ||||
| 
 | ||||
| ## LANGUAGE PRIMITIVES | ||||
| 
 | ||||
| <ul class="column-ul"> | ||||
| <li>Array</li> | ||||
| <li>Boolean</li> | ||||
| <li>Date</li> | ||||
| <li>Dictionary</li> | ||||
| <li>Number</li> | ||||
| <li>String</li> | ||||
| </ul> | ||||
| 
 | ||||
| ## RESERVED WORDS | ||||
| 
 | ||||
| <ul class="column-ul"> | ||||
| <li>add</li> | ||||
| <li>and</li> | ||||
| <li>break</li> | ||||
| <li>continue</li> | ||||
| <li>delete</li> | ||||
| <li>do</li> | ||||
| <li>else</li> | ||||
| <li>eq</li> | ||||
| <li>for</li> | ||||
| <li>function</li> | ||||
| <li>ge</li> | ||||
| <li>gt</li> | ||||
| <li>if</li> | ||||
| <li>ifframeloaded</li> | ||||
| <li>in</li> | ||||
| <li>le</li> | ||||
| <li>lt</li> | ||||
| <li>ne</li> | ||||
| <li>new</li> | ||||
| <li>not</li> | ||||
| <li>on</li> | ||||
| <li>onclipevent</li> | ||||
| <li>or</li> | ||||
| <li>return</li> | ||||
| <li>telltarget</li> | ||||
| <li>this</li> | ||||
| <li>typeof</li> | ||||
| <li>var</li> | ||||
| <li>void</li> | ||||
| <li>while</li> | ||||
| <li>with</li> | ||||
| </ul> | ||||
| 
 | ||||
| ## FEATURE SET | ||||
| 
 | ||||
| 
 | ||||
| ### Client Modification Feature | ||||
| | Name | Supported | Defined By | | ||||
| | ---- | --------- | ---------- | | ||||
| |BasePath|✓|ToolingExtension | ||||
| |Authorizations|✗|ToolingExtension | ||||
| |UserAgent|✗|ToolingExtension | ||||
| |MockServer|✗|ToolingExtension | ||||
| 
 | ||||
| ### Data Type Feature | ||||
| | Name | Supported | Defined By | | ||||
| | ---- | --------- | ---------- | | ||||
| |Custom|✗|OAS2,OAS3 | ||||
| |Int32|✓|OAS2,OAS3 | ||||
| |Int64|✓|OAS2,OAS3 | ||||
| |Float|✓|OAS2,OAS3 | ||||
| |Double|✓|OAS2,OAS3 | ||||
| |Decimal|✓|ToolingExtension | ||||
| |String|✓|OAS2,OAS3 | ||||
| |Byte|✓|OAS2,OAS3 | ||||
| |Binary|✓|OAS2,OAS3 | ||||
| |Boolean|✓|OAS2,OAS3 | ||||
| |Date|✓|OAS2,OAS3 | ||||
| |DateTime|✓|OAS2,OAS3 | ||||
| |Password|✓|OAS2,OAS3 | ||||
| |File|✓|OAS2 | ||||
| |Array|✓|OAS2,OAS3 | ||||
| |Maps|✓|ToolingExtension | ||||
| |CollectionFormat|✓|OAS2 | ||||
| |CollectionFormatMulti|✓|OAS2 | ||||
| |Enum|✓|OAS2,OAS3 | ||||
| |ArrayOfEnum|✓|ToolingExtension | ||||
| |ArrayOfModel|✓|ToolingExtension | ||||
| |ArrayOfCollectionOfPrimitives|✓|ToolingExtension | ||||
| |ArrayOfCollectionOfModel|✓|ToolingExtension | ||||
| |ArrayOfCollectionOfEnum|✓|ToolingExtension | ||||
| |MapOfEnum|✓|ToolingExtension | ||||
| |MapOfModel|✓|ToolingExtension | ||||
| |MapOfCollectionOfPrimitives|✓|ToolingExtension | ||||
| |MapOfCollectionOfModel|✓|ToolingExtension | ||||
| |MapOfCollectionOfEnum|✓|ToolingExtension | ||||
| 
 | ||||
| ### Documentation Feature | ||||
| | Name | Supported | Defined By | | ||||
| | ---- | --------- | ---------- | | ||||
| |Readme|✓|ToolingExtension | ||||
| |Model|✓|ToolingExtension | ||||
| |Api|✓|ToolingExtension | ||||
| 
 | ||||
| ### Global Feature | ||||
| | Name | Supported | Defined By | | ||||
| | ---- | --------- | ---------- | | ||||
| |Host|✓|OAS2,OAS3 | ||||
| |BasePath|✓|OAS2,OAS3 | ||||
| |Info|✓|OAS2,OAS3 | ||||
| |Schemes|✗|OAS2,OAS3 | ||||
| |PartialSchemes|✓|OAS2,OAS3 | ||||
| |Consumes|✓|OAS2 | ||||
| |Produces|✓|OAS2 | ||||
| |ExternalDocumentation|✓|OAS2,OAS3 | ||||
| |Examples|✓|OAS2,OAS3 | ||||
| |XMLStructureDefinitions|✗|OAS2,OAS3 | ||||
| |MultiServer|✗|OAS3 | ||||
| |ParameterizedServer|✗|OAS3 | ||||
| |ParameterStyling|✗|OAS3 | ||||
| |Callbacks|✗|OAS3 | ||||
| |LinkObjects|✗|OAS3 | ||||
| 
 | ||||
| ### Parameter Feature | ||||
| | Name | Supported | Defined By | | ||||
| | ---- | --------- | ---------- | | ||||
| |Path|✓|OAS2,OAS3 | ||||
| |Query|✓|OAS2,OAS3 | ||||
| |Header|✓|OAS2,OAS3 | ||||
| |Body|✓|OAS2 | ||||
| |FormUnencoded|✓|OAS2 | ||||
| |FormMultipart|✓|OAS2 | ||||
| |Cookie|✗|OAS3 | ||||
| 
 | ||||
| ### Schema Support Feature | ||||
| | Name | Supported | Defined By | | ||||
| | ---- | --------- | ---------- | | ||||
| |Simple|✓|OAS2,OAS3 | ||||
| |Composite|✓|OAS2,OAS3 | ||||
| |Polymorphism|✗|OAS2,OAS3 | ||||
| |Union|✗|OAS3 | ||||
| 
 | ||||
| ### Security Feature | ||||
| | Name | Supported | Defined By | | ||||
| | ---- | --------- | ---------- | | ||||
| |BasicAuth|✗|OAS2,OAS3 | ||||
| |ApiKey|✓|OAS2,OAS3 | ||||
| |OpenIDConnect|✗|OAS3 | ||||
| |BearerToken|✗|OAS3 | ||||
| |OAuth2_Implicit|✗|OAS2,OAS3 | ||||
| |OAuth2_Password|✗|OAS2,OAS3 | ||||
| |OAuth2_ClientCredentials|✗|OAS2,OAS3 | ||||
| |OAuth2_AuthorizationCode|✗|OAS2,OAS3 | ||||
| 
 | ||||
| ### Wire Format Feature | ||||
| | Name | Supported | Defined By | | ||||
| | ---- | --------- | ---------- | | ||||
| |JSON|✓|OAS2,OAS3 | ||||
| |XML|✓|OAS2,OAS3 | ||||
| |PROTOBUF|✗|ToolingExtension | ||||
| |Custom|✗|OAS2,OAS3 | ||||
| @ -1,413 +0,0 @@ | ||||
| /* | ||||
|  * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) | ||||
|  * Copyright 2018 SmartBear Software | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * | ||||
|  *     https://www.apache.org/licenses/LICENSE-2.0 | ||||
|  * | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| 
 | ||||
| package org.openapitools.codegen.languages; | ||||
| 
 | ||||
| import io.swagger.v3.oas.models.media.Schema; | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
| import org.openapitools.codegen.*; | ||||
| import org.openapitools.codegen.meta.GeneratorMetadata; | ||||
| import org.openapitools.codegen.meta.Stability; | ||||
| import org.openapitools.codegen.meta.features.*; | ||||
| import org.openapitools.codegen.utils.ModelUtils; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
| 
 | ||||
| import java.io.File; | ||||
| import java.util.Arrays; | ||||
| import java.util.EnumSet; | ||||
| import java.util.HashMap; | ||||
| import java.util.Locale; | ||||
| 
 | ||||
| import static org.openapitools.codegen.utils.StringUtils.camelize; | ||||
| import static org.openapitools.codegen.utils.StringUtils.underscore; | ||||
| 
 | ||||
| public class FlashClientCodegen extends DefaultCodegen implements CodegenConfig { | ||||
|     private final Logger LOGGER = LoggerFactory.getLogger(FlashClientCodegen.class); | ||||
| 
 | ||||
|     protected String packageName = "org.openapitools"; | ||||
|     protected String packageVersion; | ||||
| 
 | ||||
|     protected String invokerPackage = "org.openapitools"; | ||||
|     protected String sourceFolder = "flash"; | ||||
| 
 | ||||
|     public FlashClientCodegen() { | ||||
|         super(); | ||||
| 
 | ||||
|         generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata).stability(Stability.DEPRECATED).build(); | ||||
| 
 | ||||
|         modifyFeatureSet(features -> features | ||||
|                 .includeDocumentationFeatures(DocumentationFeature.Readme) | ||||
|                 .wireFormatFeatures(EnumSet.of(WireFormatFeature.JSON, WireFormatFeature.XML)) | ||||
|                 .securityFeatures(EnumSet.of( | ||||
|                         SecurityFeature.ApiKey | ||||
|                 )) | ||||
|                 .excludeGlobalFeatures( | ||||
|                         GlobalFeature.XMLStructureDefinitions, | ||||
|                         GlobalFeature.Callbacks, | ||||
|                         GlobalFeature.LinkObjects, | ||||
|                         GlobalFeature.ParameterStyling | ||||
|                 ) | ||||
|                 .excludeSchemaSupportFeatures( | ||||
|                         SchemaSupportFeature.Polymorphism | ||||
|                 ) | ||||
|                 .excludeParameterFeatures( | ||||
|                         ParameterFeature.Cookie | ||||
|                 ) | ||||
|                 .includeClientModificationFeatures( | ||||
|                         ClientModificationFeature.BasePath | ||||
|                 ) | ||||
|         ); | ||||
| 
 | ||||
|         modelPackage = "org.openapitools.client.model"; | ||||
|         apiPackage = "org.openapitools.client.api"; | ||||
|         outputFolder = "generated-code" + File.separatorChar + "flash"; | ||||
|         modelTemplateFiles.put("model.mustache", ".as"); | ||||
|         modelTemplateFiles.put("modelList.mustache", "List.as"); | ||||
|         apiTemplateFiles.put("api.mustache", ".as"); | ||||
|         embeddedTemplateDir = templateDir = "flash"; | ||||
| 
 | ||||
|         languageSpecificPrimitives.clear(); | ||||
|         languageSpecificPrimitives.add("Number"); | ||||
|         languageSpecificPrimitives.add("Boolean"); | ||||
|         languageSpecificPrimitives.add("String"); | ||||
|         languageSpecificPrimitives.add("Date"); | ||||
|         languageSpecificPrimitives.add("Array"); | ||||
|         languageSpecificPrimitives.add("Dictionary"); | ||||
| 
 | ||||
|         typeMapping.clear(); | ||||
|         typeMapping.put("integer", "Number"); | ||||
|         typeMapping.put("float", "Number"); | ||||
|         typeMapping.put("long", "Number"); | ||||
|         typeMapping.put("double", "Number"); | ||||
|         typeMapping.put("array", "Array"); | ||||
|         typeMapping.put("map", "Dictionary"); | ||||
|         typeMapping.put("boolean", "Boolean"); | ||||
|         typeMapping.put("string", "String"); | ||||
|         typeMapping.put("date", "Date"); | ||||
|         typeMapping.put("DateTime", "Date"); | ||||
|         typeMapping.put("object", "Object"); | ||||
|         typeMapping.put("file", "File"); | ||||
|         typeMapping.put("UUID", "String"); | ||||
|         typeMapping.put("URI", "String"); | ||||
|         typeMapping.put("binary", "File"); | ||||
| 
 | ||||
|         importMapping = new HashMap<String, String>(); | ||||
|         importMapping.put("File", "flash.filesystem.File"); | ||||
| 
 | ||||
|         // from | ||||
|         setReservedWordsLowerCase(Arrays.asList("add", "for", "lt", "tellTarget", "and", | ||||
|                 "function", "ne", "this", "break", "ge", "new", "typeof", "continue", "gt", "not", | ||||
|                 "var", "delete", "if", "on", "void", "do", "ifFrameLoaded", "onClipEvent", "while", | ||||
|                 "else", "in", "or", "with", "eq", "le", "return")); | ||||
| 
 | ||||
|         cliOptions.clear(); | ||||
|         cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "flash package name (convention:" + | ||||
|                 " package.name)").defaultValue("org.openapitools")); | ||||
|         cliOptions.add(new CliOption(CodegenConstants.PACKAGE_VERSION, "flash package version") | ||||
|                 .defaultValue("1.0.0")); | ||||
|         cliOptions.add(new CliOption(CodegenConstants.INVOKER_PACKAGE, CodegenConstants.INVOKER_PACKAGE_DESC)); | ||||
|         cliOptions.add(new CliOption(CodegenConstants.SOURCE_FOLDER, "source folder for generated " + | ||||
|                 "code. e.g. flash")); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void processOpts() { | ||||
|         super.processOpts(); | ||||
| 
 | ||||
|         if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) { | ||||
|             this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE)); | ||||
|         } else { | ||||
|             //not set, use default to be passed to template | ||||
|             additionalProperties.put(CodegenConstants.INVOKER_PACKAGE, invokerPackage); | ||||
|         } | ||||
| 
 | ||||
|         if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) { | ||||
|             this.setSourceFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER)); | ||||
|         } | ||||
| 
 | ||||
|         if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) { | ||||
|             setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME)); | ||||
|             apiPackage = packageName + ".client.api"; | ||||
|             modelPackage = packageName + ".client.model"; | ||||
|         } else { | ||||
|             setPackageName("org.openapitools"); | ||||
|         } | ||||
| 
 | ||||
|         if (additionalProperties.containsKey(CodegenConstants.PACKAGE_VERSION)) { | ||||
|             setPackageVersion((String) additionalProperties.get(CodegenConstants.PACKAGE_VERSION)); | ||||
|         } else { | ||||
|             setPackageVersion("1.0.0"); | ||||
|         } | ||||
| 
 | ||||
|         additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName); | ||||
|         additionalProperties.put(CodegenConstants.PACKAGE_VERSION, packageVersion); | ||||
| 
 | ||||
|         //modelPackage = invokerPackage + File.separatorChar + "client" + File.separatorChar + "model"; | ||||
|         //apiPackage = invokerPackage + File.separatorChar + "client" + File.separatorChar + "api"; | ||||
| 
 | ||||
|         final String invokerFolder = (sourceFolder + File.separator + "src" + File.separator + invokerPackage + File.separator).replace(".", File.separator).replace('.', File.separatorChar); | ||||
| 
 | ||||
|         supportingFiles.add(new SupportingFile("ApiInvoker.as", invokerFolder + "common", "ApiInvoker.as")); | ||||
|         supportingFiles.add(new SupportingFile("ApiUrlHelper.as", invokerFolder + "common", "ApiUrlHelper.as")); | ||||
|         supportingFiles.add(new SupportingFile("ApiUserCredentials.as", invokerFolder + "common", "ApiUserCredentials.as")); | ||||
|         supportingFiles.add(new SupportingFile("ListWrapper.as", invokerFolder + "common", "ListWrapper.as")); | ||||
|         supportingFiles.add(new SupportingFile("OpenApi.as", invokerFolder + "common", "OpenApi.as")); | ||||
|         supportingFiles.add(new SupportingFile("XMLWriter.as", invokerFolder + "common", "XMLWriter.as")); | ||||
|         supportingFiles.add(new SupportingFile("ApiError.as", invokerFolder + "exception", "ApiError.as")); | ||||
|         supportingFiles.add(new SupportingFile("ApiErrorCodes.as", invokerFolder + "exception", "ApiErrorCodes.as")); | ||||
|         supportingFiles.add(new SupportingFile("ApiClientEvent.as", invokerFolder + "event", "ApiClientEvent.as")); | ||||
|         supportingFiles.add(new SupportingFile("Response.as", invokerFolder + "event", "Response.as")); | ||||
|         supportingFiles.add(new SupportingFile("build.properties", sourceFolder, "build.properties")); | ||||
|         supportingFiles.add(new SupportingFile("build.xml", sourceFolder, "build.xml")); | ||||
|         supportingFiles.add(new SupportingFile("README.txt", sourceFolder, "README.txt")); | ||||
|         //supportingFiles.add(new SupportingFile("AirExecutorApp-app.xml", sourceFolder + File.separatorChar | ||||
|         //        + "bin", "AirExecutorApp-app.xml")); | ||||
|         supportingFiles.add(new SupportingFile("ASAXB-0.1.1.swc", sourceFolder + File.separatorChar | ||||
|                 + "lib", "ASAXB-0.1.1.swc")); | ||||
|         supportingFiles.add(new SupportingFile("as3corelib.swc", sourceFolder + File.separatorChar | ||||
|                 + "lib", "as3corelib.swc")); | ||||
|         supportingFiles.add(new SupportingFile("flexunit-4.1.0_RC2-28-flex_3.5.0.12683.swc", sourceFolder | ||||
|                 + File.separator + "lib" + File.separator + "ext", "flexunit-4.1.0_RC2-28-flex_3.5.0.12683.swc")); | ||||
|         supportingFiles.add(new SupportingFile("flexunit-aircilistener-4.1.0_RC2-28-3.5.0.12683.swc", sourceFolder | ||||
|                 + File.separator + "lib" + File.separator + "ext", "flexunit-aircilistener-4.1.0_RC2-28-3.5.0.12683.swc")); | ||||
|         supportingFiles.add(new SupportingFile("flexunit-cilistener-4.1.0_RC2-28-3.5.0.12683.swc", sourceFolder | ||||
|                 + File.separator + "lib" + File.separator + "ext", "flexunit-cilistener-4.1.0_RC2-28-3.5.0.12683.swc")); | ||||
|         supportingFiles.add(new SupportingFile("flexunit-core-flex-4.0.0.2-sdk3.5.0.12683.swc", sourceFolder | ||||
|                 + File.separator + "lib" + File.separator + "ext", "flexunit-core-flex-4.0.0.2-sdk3.5.0.12683.swc")); | ||||
|         supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); | ||||
|         supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); | ||||
|     } | ||||
| 
 | ||||
|     private static String dropDots(String str) { | ||||
|         return str.replaceAll("\\.", "_"); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public CodegenType getTag() { | ||||
|         return CodegenType.CLIENT; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public String getName() { | ||||
|         return "flash-deprecated"; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public String getHelp() { | ||||
|         return "Generates a Flash (ActionScript) client library (beta). IMPORTANT: this generator has been deprecated in v5.x"; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public String escapeReservedWord(String name) { | ||||
|         if (this.reservedWordsMappings().containsKey(name)) { | ||||
|             return this.reservedWordsMappings().get(name); | ||||
|         } | ||||
|         return "_" + name; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public String apiFileFolder() { | ||||
|         return outputFolder + File.separatorChar + sourceFolder + File.separatorChar + ("src/" | ||||
|                 + apiPackage().replace('.', File.separatorChar)).replace('/', File.separatorChar); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public String modelFileFolder() { | ||||
|         return outputFolder + File.separatorChar + sourceFolder + File.separatorChar + ("src/" | ||||
|                 + modelPackage().replace('.', File.separatorChar)).replace('/', File.separatorChar); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public String getTypeDeclaration(Schema p) { | ||||
|         if (ModelUtils.isArraySchema(p) || ModelUtils.isMapSchema(p)) { | ||||
|             return getSchemaType(p); | ||||
|         } | ||||
|         return super.getTypeDeclaration(p); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public String getSchemaType(Schema p) { | ||||
|         String schemaType = super.getSchemaType(p); | ||||
|         String type = null; | ||||
|         if (typeMapping.containsKey(schemaType)) { | ||||
|             type = typeMapping.get(schemaType); | ||||
|             if (languageSpecificPrimitives.contains(type)) { | ||||
|                 return type; | ||||
|             } | ||||
|         } else { | ||||
|             type = toModelName(schemaType); | ||||
|         } | ||||
|         return type; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public String toDefaultValue(Schema p) { | ||||
|         if (ModelUtils.isBooleanSchema(p)) { | ||||
|             return "false"; | ||||
|         } else if (ModelUtils.isDateSchema(p)) { | ||||
|             return "null"; | ||||
|         } else if (ModelUtils.isDateTimeSchema(p)) { | ||||
|             return "null"; | ||||
|         } else if (ModelUtils.isNumberSchema(p)) { | ||||
|             if (p.getDefault() != null) { | ||||
|                 return p.getDefault().toString(); | ||||
|             } | ||||
|             return "0.0"; | ||||
|         } else if (ModelUtils.isIntegerSchema(p)) { | ||||
|             if (p.getDefault() != null) { | ||||
|                 return p.getDefault().toString(); | ||||
|             } | ||||
|             return "0"; | ||||
|         } else if (ModelUtils.isMapSchema(p)) { | ||||
|             return "new Dictionary()"; | ||||
|         } else if (ModelUtils.isArraySchema(p)) { | ||||
|             return "new Array()"; | ||||
|         } else if (ModelUtils.isStringSchema(p)) { | ||||
|             return "null"; | ||||
|         } else { | ||||
|             return "NaN"; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public String toVarName(String name) { | ||||
|         // replace - with _ e.g. created-at => created_at | ||||
|         name = name.replaceAll("-", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. | ||||
| 
 | ||||
|         // if it's all upper case, convert to lower case | ||||
|         if (name.matches("^[A-Z_]*$")) { | ||||
|             name = name.toLowerCase(Locale.ROOT); | ||||
|         } | ||||
| 
 | ||||
|         // underscore the variable name | ||||
|         // petId => pet_id | ||||
|         name = camelize(dropDots(name), true); | ||||
| 
 | ||||
|         // for reserved word or word starting with number, append _ | ||||
|         if (isReservedWord(name) || name.matches("^\\d.*")) { | ||||
|             name = escapeReservedWord(name); | ||||
|         } | ||||
| 
 | ||||
|         return name; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public String toParamName(String name) { | ||||
|         // should be the same as variable name | ||||
|         return toVarName(name); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public String toModelName(String name) { | ||||
|         if (!StringUtils.isEmpty(modelNamePrefix)) { | ||||
|             name = modelNamePrefix + "_" + name; | ||||
|         } | ||||
| 
 | ||||
|         if (!StringUtils.isEmpty(modelNameSuffix)) { | ||||
|             name = name + "_" + modelNameSuffix; | ||||
|         } | ||||
| 
 | ||||
|         name = sanitizeName(name); | ||||
| 
 | ||||
|         // model name cannot use reserved keyword, e.g. return | ||||
|         if (isReservedWord(name)) { | ||||
|             LOGGER.warn("{} (reserved word) cannot be used as model name. Renamed to {}", name, camelize("model_" + name)); | ||||
|             name = "model_" + name; // e.g. return => ModelReturn (after camelize) | ||||
|         } | ||||
| 
 | ||||
|         // camelize the model name | ||||
|         // phone_number => PhoneNumber | ||||
|         return camelize(name); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public String toModelFilename(String name) { | ||||
|         // leverage toModelName | ||||
|         return dropDots(toModelName(name)); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public String toApiFilename(String name) { | ||||
|         // replace - with _ e.g. created-at => created_at | ||||
|         name = name.replaceAll("-", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. | ||||
| 
 | ||||
|         // e.g. PhoneNumberApi.rb => phone_number_api.rb | ||||
|         return camelize(name) + "Api"; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public String toApiName(String name) { | ||||
|         if (name.length() == 0) { | ||||
|             return "DefaultApi"; | ||||
|         } | ||||
|         // e.g. phone_number_api => PhoneNumberApi | ||||
|         return camelize(name) + "Api"; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public String toApiVarName(String name) { | ||||
|         if (name.length() == 0) { | ||||
|             return "DefaultApi"; | ||||
|         } | ||||
|         return camelize(name) + "Api"; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public String toOperationId(String operationId) { | ||||
|         // throw exception if method name is empty | ||||
|         if (StringUtils.isEmpty(operationId)) { | ||||
|             throw new RuntimeException("Empty method name (operationId) not allowed"); | ||||
|         } | ||||
| 
 | ||||
|         // method name cannot use reserved keyword, e.g. return | ||||
|         if (isReservedWord(operationId)) { | ||||
|             LOGGER.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, underscore(sanitizeName("call_" + operationId))); | ||||
|             operationId = "call_" + operationId; | ||||
|         } | ||||
| 
 | ||||
|         return underscore(operationId); | ||||
|     } | ||||
| 
 | ||||
|     public void setPackageName(String packageName) { | ||||
|         this.packageName = packageName; | ||||
|     } | ||||
| 
 | ||||
|     public void setPackageVersion(String packageVersion) { | ||||
|         this.packageVersion = packageVersion; | ||||
|     } | ||||
| 
 | ||||
|     public void setInvokerPackage(String invokerPackage) { | ||||
|         this.invokerPackage = invokerPackage; | ||||
|     } | ||||
| 
 | ||||
|     public void setSourceFolder(String sourceFolder) { | ||||
|         this.sourceFolder = sourceFolder; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public String escapeQuotationMark(String input) { | ||||
|         // remove " to avoid code injection | ||||
|         return input.replace("\"", ""); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public String escapeUnsafeCharacters(String input) { | ||||
|         return input.replace("*/", "*_/").replace("/*", "/_*"); | ||||
|     } | ||||
| } | ||||
| @ -32,7 +32,6 @@ org.openapitools.codegen.languages.ElmClientCodegen | ||||
| org.openapitools.codegen.languages.ErlangClientCodegen | ||||
| org.openapitools.codegen.languages.ErlangProperCodegen | ||||
| org.openapitools.codegen.languages.ErlangServerCodegen | ||||
| org.openapitools.codegen.languages.FlashClientCodegen | ||||
| org.openapitools.codegen.languages.FsharpFunctionsServerCodegen | ||||
| org.openapitools.codegen.languages.FsharpGiraffeServerCodegen | ||||
| org.openapitools.codegen.languages.GoClientCodegen | ||||
|  | ||||
| @ -171,10 +171,6 @@ | ||||
|         "title": "Config Options for erlang-server", | ||||
|         "sidebar_label": "erlang-server" | ||||
|       }, | ||||
|       "generators/flash": { | ||||
|         "title": "Config Options for flash", | ||||
|         "sidebar_label": "flash" | ||||
|       }, | ||||
|       "generators/fsharp-functions": { | ||||
|         "title": "Config Options for fsharp-functions", | ||||
|         "sidebar_label": "fsharp-functions" | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user