forked from loafle/openapi-generator-original
Remove x-nullable extension support (#930)
This commit is contained in:
parent
62abd51a02
commit
f987306a15
@ -77,8 +77,8 @@ import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class DefaultCodegen implements CodegenConfig {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultCodegen.class);
|
||||
@ -1794,11 +1794,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (p.getWriteOnly() != null) {
|
||||
property.isWriteOnly = p.getWriteOnly();
|
||||
}
|
||||
|
||||
// use x-nullable
|
||||
if (p.getExtensions() != null && p.getExtensions().get("x-nullable") != null) {
|
||||
property.isNullable = Boolean.valueOf(p.getExtensions().get("x-nullable").toString());
|
||||
} else if (p.getNullable() != null) { // use nullable defined in OAS3
|
||||
if (p.getNullable() != null) {
|
||||
property.isNullable = p.getNullable();
|
||||
}
|
||||
|
||||
@ -2745,10 +2741,7 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
parameterSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to missing type definition.");
|
||||
}
|
||||
|
||||
// x-nullable extension in OAS2
|
||||
if (parameter.getExtensions() != null && parameter.getExtensions().get("x-nullable") != null) {
|
||||
codegenParameter.isNullable = Boolean.valueOf(parameter.getExtensions().get("x-nullable").toString());
|
||||
} else if (Boolean.TRUE.equals(parameterSchema.getNullable())) { // use nullable defined in the spec
|
||||
if (Boolean.TRUE.equals(parameterSchema.getNullable())) { // use nullable defined in the spec
|
||||
codegenParameter.isNullable = true;
|
||||
}
|
||||
|
||||
@ -4766,10 +4759,6 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
private void setParameterNullable(CodegenParameter parameter, CodegenProperty property) {
|
||||
if (property.getVendorExtensions() != null && property.getVendorExtensions().get("x-nullable") != null) {
|
||||
parameter.isNullable = Boolean.valueOf(property.getVendorExtensions().get("x-nullable").toString());
|
||||
} else {
|
||||
parameter.isNullable = property.isNullable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -268,8 +268,7 @@ public class RubyClientCodegenTest {
|
||||
CodegenParameter name = op.formParams.get(0);
|
||||
Assert.assertFalse(name.isNullable);
|
||||
CodegenParameter status = op.formParams.get(1);
|
||||
// TODO comment out the following as there seems to be an issue with swagger parser not brining over the
|
||||
// vendor extensions of the form parameter when creating the schema
|
||||
// TODO comment out the following until https://github.com/swagger-api/swagger-parser/issues/820 is solved
|
||||
//Assert.assertTrue(status.isNullable);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user