Skip to content

Commit

Permalink
Merge pull request #10576 from swagger-api/issue-10516
Browse files Browse the repository at this point in the history
Issue 10516
  • Loading branch information
HugoMario committed Nov 22, 2020
2 parents bc90330 + 4b01fc2 commit b2ef5ec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation
public CodegenModel fromModel(String name, Model model, Map<String, Model> allDefinitions) {
CodegenModel codegenModel = super.fromModel(name, model, allDefinitions);

if (allDefinitions != null && codegenModel != null && codegenModel.parent != null && codegenModel.hasEnums) {
if (allDefinitions != null && codegenModel != null && codegenModel.parent != null && codegenModel.hasEnums && codegenModel.parentSchema != null) {
final Model parentModel = allDefinitions.get(codegenModel.parentSchema);
final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel, allDefinitions);
codegenModel = JavascriptClientCodegen.reconcileInlineEnums(codegenModel, parentCodegenModel);
Expand All @@ -900,6 +900,14 @@ public CodegenModel fromModel(String name, Model model, Map<String, Model> allDe
return codegenModel;
}

@Override
protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, ModelImpl swaggerModel) {
super.addAdditionPropertiesToCodeGenModel(codegenModel, swaggerModel);
if (swaggerModel.getAdditionalProperties() != null) {
codegenModel.additionalPropertiesType = getSwaggerType(swaggerModel.getAdditionalProperties());
}
}

private String sanitizePath(String p) {
//prefer replace a ', instead of a fuLL URL encode for readability
return p.replaceAll("'", "%27");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@
exports.prototype.{{name}} = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}undefined{{/defaultValue}};

{{/vars}}
{{#additionalPropertiesType}}
exports.prototype.additionalProperties = new Map();
{{/additionalPropertiesType}}

{{#useInheritance}}
{{#interfaceModels}}
// Implement {{classname}} interface:
Expand Down

0 comments on commit b2ef5ec

Please sign in to comment.