mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 11:23:58 +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());
|
codegenParameter.vendorExtensions.putAll(parameter.getExtensions());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parameter.getSchema() != null) {
|
Schema s;
|
||||||
Schema parameterSchema = ModelUtils.unaliasSchema(this.openAPI, parameter.getSchema());
|
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) {
|
if (parameterSchema == null) {
|
||||||
LOGGER.warn("warning! Schema not found for parameter \"" + parameter.getName() + "\", using String");
|
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.");
|
parameterSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to missing type definition.");
|
||||||
|
Loading…
Reference in New Issue
Block a user