mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 03:18:53 +00:00
[core] add support for model as query params (#2489)
* add support for model as query params * add logging incase of multiple schemas are present
This commit is contained in:
parent
70108b753e
commit
8e91b8c62a
@ -2931,8 +2931,22 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
codegenParameter.vendorExtensions.putAll(parameter.getExtensions());
|
||||
}
|
||||
|
||||
if (parameter.getSchema() != null) {
|
||||
Schema parameterSchema = ModelUtils.unaliasSchema(this.openAPI, parameter.getSchema());
|
||||
Schema s;
|
||||
if(parameter.getSchema() != null) {
|
||||
s = parameter.getSchema();
|
||||
} else if (parameter.getContent() != null) {
|
||||
Content content = parameter.getContent();
|
||||
if (content.size() > 1) {
|
||||
LOGGER.warn("Multiple schemas found in content, returning only the first one");
|
||||
}
|
||||
MediaType mediaType = content.values().iterator().next();
|
||||
s = mediaType.getSchema();
|
||||
} else {
|
||||
s = null;
|
||||
}
|
||||
|
||||
if (s != null) {
|
||||
Schema parameterSchema = ModelUtils.unaliasSchema(this.openAPI, s);
|
||||
if (parameterSchema == null) {
|
||||
LOGGER.warn("warning! Schema not found for parameter \"" + parameter.getName() + "\", using String");
|
||||
parameterSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to missing type definition.");
|
||||
|
Loading…
Reference in New Issue
Block a user