Skip to content

Commit

Permalink
fixed missed properties
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoMario committed Jul 28, 2021
1 parent 8799694 commit 6e12847
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1358,12 +1358,7 @@ public CodegenModel fromModel(String name, Schema schema, Map<String, Schema> al
addParentContainer(codegenModel, name, schema);
}
else if (schema instanceof MapSchema) {
codegenModel.getVendorExtensions().put(CodegenConstants.IS_MAP_CONTAINER_EXT_NAME, Boolean.TRUE);
codegenModel.getVendorExtensions().put(IS_CONTAINER_EXT_NAME, Boolean.TRUE);
addParentContainer(codegenModel, name, schema);
if (hasSchemaProperties(schema) || hasTrueAdditionalProperties(schema)) {
addAdditionPropertiesToCodeGenModel(codegenModel, schema);
}
processMapSchema(codegenModel, name, schema);

}
else if (schema instanceof ComposedSchema) {
Expand Down Expand Up @@ -1493,6 +1488,15 @@ else if (schema instanceof ComposedSchema) {
return codegenModel;
}

protected void processMapSchema(CodegenModel codegenModel, String name, Schema schema) {
codegenModel.getVendorExtensions().put(CodegenConstants.IS_MAP_CONTAINER_EXT_NAME, Boolean.TRUE);
codegenModel.getVendorExtensions().put(IS_CONTAINER_EXT_NAME, Boolean.TRUE);
addParentContainer(codegenModel, name, schema);
if (hasSchemaProperties(schema) || hasTrueAdditionalProperties(schema)) {
addAdditionPropertiesToCodeGenModel(codegenModel, schema);
}
}

/**
* Recursively look for a discriminator in the interface tree
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,40 @@

import io.swagger.codegen.v3.CliOption;
import io.swagger.codegen.v3.CodegenConstants;
import io.swagger.codegen.v3.CodegenModel;
import io.swagger.codegen.v3.CodegenOperation;
import io.swagger.codegen.v3.CodegenParameter;
import io.swagger.codegen.v3.CodegenProperty;
import io.swagger.codegen.v3.CodegenSecurity;
import io.swagger.codegen.v3.CodegenType;
import io.swagger.codegen.v3.SupportingFile;
import io.swagger.codegen.v3.generators.DefaultCodegenConfig;
import io.swagger.v3.oas.models.media.ArraySchema;
import io.swagger.v3.oas.models.media.BooleanSchema;
import io.swagger.v3.oas.models.media.DateSchema;
import io.swagger.v3.oas.models.media.DateTimeSchema;
import io.swagger.v3.oas.models.media.IntegerSchema;
import io.swagger.v3.oas.models.media.MapSchema;
import io.swagger.v3.oas.models.media.NumberSchema;
import io.swagger.v3.oas.models.media.ObjectSchema;
import io.swagger.v3.oas.models.media.Schema;
import io.swagger.v3.oas.models.media.StringSchema;
import io.swagger.v3.oas.models.security.SecurityScheme;
import io.swagger.v3.parser.util.SchemaTypeUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.HashSet;
import java.util.regex.Matcher;

import io.swagger.v3.oas.models.media.*;
import io.swagger.v3.oas.models.security.SecurityScheme;
import io.swagger.v3.parser.util.SchemaTypeUtil;
import org.apache.commons.lang3.StringUtils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static io.swagger.codegen.v3.generators.handlebars.ExtensionHelper.getBooleanValue;

public class PhpClientCodegen extends DefaultCodegenConfig {
Expand Down Expand Up @@ -444,6 +452,12 @@ public void setComposerProjectName(String composerProjectName) {
this.composerProjectName = composerProjectName;
}

@Override
protected void processMapSchema(CodegenModel codegenModel, String name, Schema schema) {
super.processMapSchema(codegenModel, name, schema);
addVars(codegenModel, schema.getProperties(), schema.getRequired());
}

@Override
public String toVarName(String name) {
// sanitize name
Expand Down

0 comments on commit 6e12847

Please sign in to comment.