@@ -51,8 +51,6 @@ public class OCamlClientCodegen extends DefaultCodegen implements CodegenConfig
5151
5252 static final String X_MODEL_MODULE = "x-model-module" ;
5353
54- public static final String CO_HTTP = "cohttp" ;
55-
5654 @ Setter protected String packageName = "openapi" ;
5755 @ Setter protected String packageVersion = "1.0.0" ;
5856 protected String apiDocPath = "docs/" ;
@@ -188,15 +186,6 @@ public OCamlClientCodegen() {
188186 typeMapping .put ("set" , "`Set" );
189187 typeMapping .put ("password" , "string" );
190188 typeMapping .put ("DateTime" , "string" );
191-
192- // supportedLibraries.put(CO_HTTP, "HTTP client: CoHttp.");
193- //
194- // CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use.");
195- // libraryOption.setEnum(supportedLibraries);
196- // // set hyper as the default
197- // libraryOption.setDefault(CO_HTTP);
198- // cliOptions.add(libraryOption);
199- // setLibrary(CO_HTTP);
200189 }
201190
202191 @ Override
@@ -210,7 +199,7 @@ public Map<String, ModelsMap> postProcessAllModels(Map<String, ModelsMap> supero
210199 CodegenModel cm = mo .getModel ();
211200
212201 // for enum model
213- if (Boolean . TRUE . equals ( cm .isEnum ) && cm .allowableValues != null ) {
202+ if (cm .isEnum && cm .allowableValues != null ) {
214203 toRemove .add (modelEntry .getKey ());
215204 } else {
216205 enrichPropertiesWithEnumDefaultValues (cm .getAllVars ());
@@ -244,8 +233,7 @@ private void enrichPropertiesWithEnumDefaultValues(List<CodegenProperty> propert
244233 @ Override
245234 protected void updateDataTypeWithEnumForMap (CodegenProperty property ) {
246235 CodegenProperty baseItem = property .items ;
247- while (baseItem != null && (Boolean .TRUE .equals (baseItem .isMap )
248- || Boolean .TRUE .equals (baseItem .isArray ))) {
236+ while (baseItem != null && (baseItem .isMap || baseItem .isArray )) {
249237 baseItem = baseItem .items ;
250238 }
251239
@@ -262,8 +250,7 @@ protected void updateDataTypeWithEnumForMap(CodegenProperty property) {
262250 @ Override
263251 protected void updateDataTypeWithEnumForArray (CodegenProperty property ) {
264252 CodegenProperty baseItem = property .items ;
265- while (baseItem != null && (Boolean .TRUE .equals (baseItem .isMap )
266- || Boolean .TRUE .equals (baseItem .isArray ))) {
253+ while (baseItem != null && (baseItem .isMap || baseItem .isArray )) {
267254 baseItem = baseItem .items ;
268255 }
269256 if (baseItem != null ) {
@@ -314,19 +301,17 @@ private void collectEnumSchemas(String parentName, Map<String, Schema> schemas)
314301
315302 collectEnumSchemas (parentName , sName , schema );
316303
304+ String pName = parentName != null ? parentName + "_" + sName : sName ;
317305 if (schema .getProperties () != null ) {
318- String pName = parentName != null ? parentName + "_" + sName : sName ;
319306 collectEnumSchemas (pName , schema .getProperties ());
320307 }
321308
322309 if (schema .getAdditionalProperties () != null && schema .getAdditionalProperties () instanceof Schema ) {
323- String pName = parentName != null ? parentName + "_" + sName : sName ;
324310 collectEnumSchemas (pName , (Schema ) schema .getAdditionalProperties ());
325311 }
326312
327313 if (ModelUtils .isArraySchema (schema )) {
328314 if (ModelUtils .getSchemaItems (schema ) != null ) {
329- String pName = parentName != null ? parentName + "_" + sName : sName ;
330315 collectEnumSchemas (pName , ModelUtils .getSchemaItems (schema ));
331316 }
332317 }
@@ -679,7 +664,7 @@ private List<Map<String, Object>> buildEnumValues(String valueString) {
679664 public String toEnumValueName (String name ) {
680665 if (reservedWords .contains (name )) {
681666 return escapeReservedWord (name );
682- } else if ((( CharSequence ) name ) .chars ().anyMatch (character -> specialCharReplacements .keySet (). contains (String .valueOf ((char ) character )))) {
667+ } else if (name .chars ().anyMatch (character -> specialCharReplacements .containsKey (String .valueOf ((char ) character )))) {
683668 return escape (name , specialCharReplacements , Collections .singletonList ("_" ), null );
684669 } else {
685670 return name ;
@@ -725,8 +710,6 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<Mo
725710 List <CodegenOperation > operations = objectMap .getOperation ();
726711
727712 for (CodegenOperation operation : operations ) {
728- // http method verb conversion, depending on client library (e.g. Hyper: PUT => Put, Reqwest: PUT => put)
729- //if (CO_HTTP.equals(getLibrary())) {
730713 for (CodegenParameter param : operation .bodyParams ) {
731714 if (param .isModel && param .dataType .endsWith (".t" )) {
732715 param .vendorExtensions .put (X_MODEL_MODULE , param .dataType .substring (0 , param .dataType .lastIndexOf ('.' )));
0 commit comments