File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
modules/openapi-generator/src/main/java/org/openapitools/codegen/languages Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 2020import com .google .common .base .Strings ;
2121import io .swagger .v3 .oas .models .media .ArraySchema ;
2222import io .swagger .v3 .oas .models .media .Schema ;
23+ import io .swagger .v3 .oas .models .media .StringSchema ;
2324import org .openapitools .codegen .*;
2425import org .openapitools .codegen .utils .ModelUtils ;
2526import org .openapitools .codegen .utils .StringUtils ;
@@ -310,9 +311,17 @@ public String getTypeDeclaration(Schema p) {
310311 if (ModelUtils .isArraySchema (p )) {
311312 ArraySchema ap = (ArraySchema ) p ;
312313 Schema inner = ap .getItems ();
314+ if (inner == null ) {
315+ LOGGER .warn (ap .getName () + "(array property) does not have a proper inner type defined.Default to string" );
316+ inner = new StringSchema ().description ("TODO default missing array inner type to string" );
317+ }
313318 return "Vec<" + getTypeDeclaration (inner ) + ">" ;
314319 } else if (ModelUtils .isMapSchema (p )) {
315320 Schema inner = ModelUtils .getAdditionalProperties (p );
321+ if (inner == null ) {
322+ LOGGER .warn (p .getName () + "(map property) does not have a proper inner type defined. Default to string" );
323+ inner = new StringSchema ().description ("TODO default missing map inner type to string" );
324+ }
316325 return "::std::collections::HashMap<String, " + getTypeDeclaration (inner ) + ">" ;
317326 }
318327
You can’t perform that action at this time.
0 commit comments