-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Labels
HacktoberfestIssues eligible for Hacktoberfest: https://hacktoberfest.digitalocean.com/detailsIssues eligible for Hacktoberfest: https://hacktoberfest.digitalocean.com/detailsbugSomething isn't workingSomething isn't working
Description
Just got a bug report on Slack for swagger-gradle-codegen (credits to @vanniktech). After some small investigation with @macisamuele looks like the issue is with paths that have parameters with inlined additional properties.
Here a minimal spec that is breaking the plugin:
{
"swagger": "2.0",
"info": {
"version": "1.0",
"title": ""
},
"definitions": {
"model": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"paths": {
"/works": {
"post": {
"parameters": [
{
"in": "body",
"name": "body",
"schema": {
"$ref" : "#/definitions/model"
}
}
],
"responses": {
"default": {
"description": "something"
}
}
}
},
"/broken": {
"post": {
"parameters": [
{
"in": "body",
"name": "body",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
],
"responses": {
"default": {
"description": "something"
}
}
}
}
}
}The current workaround is to replace this:
{
"in": "body",
"name": "body",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}with:
{
"in": "body",
"name": "body",
"schema": {
"$ref" : "#/definitions/model"
}
}And have the additionalProperties not defined inline.
Here the failure message:
Execution failed for task ':generateSwagger'.
> Could not process operation:
Tag: Tag {
name: default
description: null
externalDocs: null
extensions:{}}
Operation: null
Resource: post /broken
Definitions: {model=io.swagger.models.ModelImpl@a2a8ef}
Exception: null cannot be cast to non-null type io.swagger.models.ModelImpl
Metadata
Metadata
Assignees
Labels
HacktoberfestIssues eligible for Hacktoberfest: https://hacktoberfest.digitalocean.com/detailsIssues eligible for Hacktoberfest: https://hacktoberfest.digitalocean.com/detailsbugSomething isn't workingSomething isn't working