1+ /*
2+ * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * https://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
117package org .openapitools .codegen .languages ;
218
319import org .openapitools .codegen .*;
1228
1329import java .io .File ;
1430import java .util .*;
31+
1532import io .swagger .v3 .oas .models .media .Schema ;
1633import io .swagger .v3 .oas .models .media .ArraySchema ;
1734import io .swagger .v3 .oas .models .parameters .Parameter ;
1835import io .swagger .v3 .oas .models .Operation ;
1936import io .swagger .v3 .oas .models .servers .Server ;
2037
2138import org .apache .commons .lang3 .StringUtils ;
39+
2240import static org .openapitools .codegen .utils .StringUtils .camelize ;
2341
2442import org .openapitools .codegen .utils .CamelizeOption ;
@@ -50,42 +68,42 @@ public AbstractJuliaCodegen() {
5068 super ();
5169
5270 modifyFeatureSet (features -> features
53- .includeDocumentationFeatures (DocumentationFeature .Readme )
54- .includeSchemaSupportFeatures (
55- SchemaSupportFeature .Union , SchemaSupportFeature .allOf ,
56- SchemaSupportFeature .anyOf , SchemaSupportFeature .oneOf
57- )
58- .excludeWireFormatFeatures (
59- WireFormatFeature .XML
60- )
61- .excludeSecurityFeatures (
62- SecurityFeature .OAuth2_Implicit , SecurityFeature .OAuth2_Password ,
63- SecurityFeature .OAuth2_ClientCredentials , SecurityFeature .OAuth2_AuthorizationCode
64- )
65- .excludeParameterFeatures (
66- ParameterFeature .Cookie
67- )
68- .excludeGlobalFeatures (
69- GlobalFeature .Callbacks , GlobalFeature .Examples ,
70- GlobalFeature .Produces , GlobalFeature .Consumes
71- )
72- .includeClientModificationFeatures (
73- ClientModificationFeature .BasePath , ClientModificationFeature .UserAgent
74- )
71+ .includeDocumentationFeatures (DocumentationFeature .Readme )
72+ .includeSchemaSupportFeatures (
73+ SchemaSupportFeature .Union , SchemaSupportFeature .allOf ,
74+ SchemaSupportFeature .anyOf , SchemaSupportFeature .oneOf
75+ )
76+ .excludeWireFormatFeatures (
77+ WireFormatFeature .XML
78+ )
79+ .excludeSecurityFeatures (
80+ SecurityFeature .OAuth2_Implicit , SecurityFeature .OAuth2_Password ,
81+ SecurityFeature .OAuth2_ClientCredentials , SecurityFeature .OAuth2_AuthorizationCode
82+ )
83+ .excludeParameterFeatures (
84+ ParameterFeature .Cookie
85+ )
86+ .excludeGlobalFeatures (
87+ GlobalFeature .Callbacks , GlobalFeature .Examples ,
88+ GlobalFeature .Produces , GlobalFeature .Consumes
89+ )
90+ .includeClientModificationFeatures (
91+ ClientModificationFeature .BasePath , ClientModificationFeature .UserAgent
92+ )
7593 );
7694
77- reservedWords = new HashSet <String > (
78- Arrays .asList (
79- "if" , "else" , "elseif" , "while" , "for" , "begin" , "end" , "quote" ,
80- "try" , "catch" , "return" , "local" , "function" , "macro" , "ccall" , "finally" , "break" , "continue" ,
81- "global" , "module" , "using" , "import" , "export" , "const" , "let" , "do" , "baremodule" ,
82- "Type" , "Enum" , "Any" , "DataType" , "Base"
83- )
95+ reservedWords = new HashSet <String >(
96+ Arrays .asList (
97+ "if" , "else" , "elseif" , "while" , "for" , "begin" , "end" , "quote" ,
98+ "try" , "catch" , "return" , "local" , "function" , "macro" , "ccall" , "finally" , "break" , "continue" ,
99+ "global" , "module" , "using" , "import" , "export" , "const" , "let" , "do" , "baremodule" ,
100+ "Type" , "Enum" , "Any" , "DataType" , "Base"
101+ )
84102 );
85103
86104 // Language Specific Primitives. These types will not trigger imports by the client generator
87105 languageSpecificPrimitives = new HashSet <String >(
88- Arrays .asList ("Integer" , "Int128" , "Int64" , "Int32" , "Int16" , "Int8" , "UInt128" , "UInt64" , "UInt32" , "UInt16" , "UInt8" , "Float64" , "Float32" , "Float16" , "Char" , "Vector" , "Dict" , "Vector{UInt8}" , "Bool" , "String" , "Date" , "DateTime" , "ZonedDateTime" , "Nothing" , "Any" )
106+ Arrays .asList ("Integer" , "Int128" , "Int64" , "Int32" , "Int16" , "Int8" , "UInt128" , "UInt64" , "UInt32" , "UInt16" , "UInt8" , "Float64" , "Float32" , "Float16" , "Char" , "Vector" , "Dict" , "Vector{UInt8}" , "Bool" , "String" , "Date" , "DateTime" , "ZonedDateTime" , "Nothing" , "Any" )
89107 );
90108
91109 typeMapping .clear ();
@@ -141,7 +159,7 @@ protected static String dropDots(String str) {
141159 /**
142160 * Escapes a reserved word as defined in the `reservedWords` array. Handle escaping
143161 * those terms here. This logic is only called if a variable matches the reseved words
144- *
162+ *
145163 * @return the escaped term
146164 */
147165 @ Override
@@ -331,7 +349,7 @@ public String getSchemaType(Schema schema) {
331349
332350 if (typeMapping .containsKey (openAPIType )) {
333351 type = typeMapping .get (openAPIType );
334- if (languageSpecificPrimitives .contains (type )) {
352+ if (languageSpecificPrimitives .contains (type )) {
335353 return type ;
336354 }
337355 } else {
@@ -343,6 +361,7 @@ public String getSchemaType(Schema schema) {
343361
344362 /**
345363 * Return the default value of the property
364+ *
346365 * @param schema OpenAPI property object
347366 * @return string presentation of the default value of the property
348367 */
@@ -381,7 +400,8 @@ public String escapeUnsafeCharacters(String input) {
381400 }
382401
383402 /**
384- * Escape single and/or double quote to avoid code injection
403+ * Escape single and/or double quote to avoid code injection
404+ *
385405 * @param input String to be cleaned up
386406 * @return string with quotation mark removed or escaped
387407 */
@@ -425,7 +445,7 @@ public CodegenParameter fromParameter(Parameter param, Set<String> imports) {
425445 * @param schema OAS property schema
426446 * @param required true if the property is required in the next higher object schema, false otherwise
427447 * @return Codegen Property object
428- */
448+ */
429449 @ Override
430450 public CodegenProperty fromProperty (String name , Schema schema , boolean required ) {
431451 CodegenProperty property = super .fromProperty (name , schema , required );
@@ -464,7 +484,7 @@ private void changeParamNames(List<CodegenParameter> paramsList, HashSet<String>
464484 }
465485 }
466486 }
467-
487+
468488 /**
469489 * Convert OAS Operation object to Codegen Operation object
470490 *
0 commit comments