[AVRO] Fix the package handling for the avro generator (#3987) (#4078)

* [AVRO] Fix the package handling for the avro generator (#3987)

Also fix an issue with the outputFolder that wasn't overridable through opts

* Update sample files through avro-petstore.sh

There's an issue with inlined object but it's already present with the previous commit

* Revert the fix on outputFolder (not a bug)
This commit is contained in:
Perennes 2019-10-09 09:46:29 +02:00 committed by William Cheng
parent 4e47426224
commit 87c77076ef
3 changed files with 8 additions and 6 deletions

View File

@ -43,8 +43,8 @@ public class AvroSchemaCodegen extends DefaultCodegen implements CodegenConfig {
outputFolder = "generated-code/avro-schema";
modelTemplateFiles.put("model.mustache", ".avsc");
apiPackage = "api";
modelPackage = "model";
// Force the model package to the package name so import can be fully qualified
modelPackage = packageName;
importMapping.clear();
embeddedTemplateDir = templateDir = AVRO;
@ -81,10 +81,12 @@ public class AvroSchemaCodegen extends DefaultCodegen implements CodegenConfig {
super.processOpts();
if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) {
packageName = (String) additionalProperties.get(CodegenConstants.PACKAGE_NAME);
// Force the model package to the package name so import can be fully qualified
modelPackage = packageName;
}
additionalProperties.put("packageName", packageName);
}
@Override
@ -132,4 +134,4 @@ public class AvroSchemaCodegen extends DefaultCodegen implements CodegenConfig {
return input;
}
}
}

View File

@ -1 +1 @@
4.1.1-SNAPSHOT
4.2.0-SNAPSHOT

View File

@ -11,7 +11,7 @@
},
{
"name": "file",
"type": ["null", "model.File"],
"type": ["null", ],
"doc": "file to upload"
}
]