Skip to content

Commit 3079e7d

Browse files
authored
Merge pull request #508 from swagger-api/codegen-issue-9480
copy properties from parent for python generator
2 parents e4012f2 + 9def06a commit 3079e7d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ public abstract class DefaultCodegenConfig implements CodegenConfig {
169169

170170
protected String ignoreFilePathOverride;
171171
protected boolean useOas2 = false;
172+
protected boolean copyFistAllOfProperties = false;
172173

173174
public List<CliOption> cliOptions() {
174175
return cliOptions;
@@ -1353,7 +1354,10 @@ else if (schema instanceof ComposedSchema) {
13531354
if (codegenModel.interfaces == null) {
13541355
codegenModel.interfaces = new ArrayList<String>();
13551356
}
1356-
for (int i = 1; i < allOf.size(); i++) {
1357+
for (int i = 0; i < allOf.size(); i++) {
1358+
if (i == 0 && !copyFistAllOfProperties) {
1359+
continue;
1360+
}
13571361
Schema interfaceSchema = allOf.get(i);
13581362
if (StringUtils.isBlank(interfaceSchema.get$ref())) {
13591363
continue;

src/main/java/io/swagger/codegen/v3/generators/python/PythonClientCodegen.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ public void processOpts() {
236236
modelPackage = packageName + "." + modelPackage;
237237
apiPackage = packageName + "." + apiPackage;
238238

239+
copyFistAllOfProperties = true;
240+
239241
}
240242

241243
private static String dropDots(String str) {

0 commit comments

Comments
 (0)