Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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