Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot handle return class schema using Swagger 2.2.10 with 1.1 specs. #2599

Closed
gredondogc opened this issue Jan 5, 2017 · 3 comments
Closed

Comments

@gredondogc
Copy link

Hello

Using the following resourse file (multiple entries removed for brevity):

{
  "swaggerVersion": "1.1",
  "basePath": "http://localhost:8080/lbbi.ws45",
  "apis": [
    {
      "path": "/resource/Debug",
      "description": ""
    },
    {
      "path": "/resource/DebugWait",
      "description": "*Descricao de teste*"
    } ]
}

and

{
  "basePath": "http://localhost:8080/lbbi.ws45",
  "resourcePath": "/Debug",
  "apis": [
    {
      "path": "/Debug",
      "operations": [
        {
          "httpMethod": "POST",
          "nickname": "postDebug",
          "parameters": [
            {
              "paramType": "body",
              "allowMultiple": false,
              "required": false,
              "dataType": "DebugDTO"
            }
          ],
          "errorResponses": []
        },
        {
          "httpMethod": "PUT",
          "nickname": "putDebug",
          "parameters": [
            {
              "paramType": "body",
              "allowMultiple": false,
              "required": false,
              "dataType": "DebugDTO"
            }
          ],
          "errorResponses": []
        }
      ]
    },
    {
      "path": "/Debug/{DebugId}",
      "description": "Debug Summary",
      "operations": [
        {
          "httpMethod": "GET",
          "nickname": "getDebugDebugId",
          "summary": "Debug Summary",
          "notes": "Tests For Debuging",
          "parameters": [
            {
              "name": "DebugId",
              "description": "Description",
              "paramType": "path",
              "allowMultiple": false,
              "required": true,
              "dataType": "int"
            }
          ],
          "responseClass": "DebugDTO",
          "errorResponses": [
            {
              "code": 400,
              "reason": "If -401 -> Exception - Converted to StatusCode 400"
            },
            {
              "code": 400,
              "reason": "If -400 -> ArgumentException"
            },
            {
              "code": 403,
              "reason": "If -403 -> LbbiPermissionException"
            },
            {
              "code": 400,
              "reason": "If -501 -> Ex2Warn - Converted to StatusCode 400"
            },
            {
              "code": 400,
              "reason": "If -502 -> Ex2Error - Converted to StatusCode 400"
            },
            {
              "code": 422,
              "reason": "If -422 -> ILbbi4xxException"
            },
            {
              "code": 404,
              "reason": "If -404 -> HttpError - With Parameter 404"
            },
            {
              "code": 500,
              "reason": "If -500 -> Ex2Bug - Converted to StatusCode 500"
            }
          ]
        },
        {
          "httpMethod": "DELETE",
          "nickname": "deleteDebugDebugId",
          "summary": "Debug Summary",
          "notes": "Tests For Debuging",
          "parameters": [
            {
              "name": "DebugId",
              "description": "Description",
              "paramType": "path",
              "allowMultiple": false,
              "required": true,
              "dataType": "int"
            },
            {
              "paramType": "body",
              "allowMultiple": false,
              "required": false,
              "dataType": "DebugByIdDTO"
            }
          ],
          "responseClass": "DebugDTO",
          "errorResponses": [
            {
              "code": 400,
              "reason": "If -401 -> Exception - Converted to StatusCode 400"
            },
            {
              "code": 400,
              "reason": "If -400 -> ArgumentException"
            },
            {
              "code": 403,
              "reason": "If -403 -> LbbiPermissionException"
            },
            {
              "code": 400,
              "reason": "If -501 -> Ex2Warn - Converted to StatusCode 400"
            },
            {
              "code": 400,
              "reason": "If -502 -> Ex2Error - Converted to StatusCode 400"
            },
            {
              "code": 422,
              "reason": "If -422 -> ILbbi4xxException"
            },
            {
              "code": 404,
              "reason": "If -404 -> HttpError - With Parameter 404"
            },
            {
              "code": 500,
              "reason": "If -500 -> Ex2Bug - Converted to StatusCode 500"
            }
          ]
        }
      ]
    }
  ],
  "models": {
    "DebugByIdDTO": {
      "id": "DebugByIdDTO",
      "properties": {
        "DebugId": {
          "type": "int",
          "required": true
        }
      }
    },
    "DebugDTO": {
      "id": "DebugDTO",
      "properties": {
        "DebugId": {
          "type": "int",
          "required": true
        },
        "FieldString": {
          "type": "string",
          "required": true
        },
        "FieldDecimal": {
          "type": "double",
          "required": true
        }
      }
    }
  }
}

I get the expected with swagger 1.1.15:
swagger1 1 15

but not with 2.2.10:
swagger2 2 15

Notice the missing response class, response data type and error codes.

I've tested with several v2.x.x versions and the problem seems to apear on version v2.0.0

Thank you

@gredondogc gredondogc changed the title Cannot handle return class schema using Swagger 2.2.15 with 1.1 specs. Cannot handle return class schema using Swagger 2.2.10 with 1.1 specs. Jan 6, 2017
@webron
Copy link
Contributor

webron commented Jan 10, 2017

While we have some support for older versions of the spec, it's difficult to maintain full support for it and some errors are expected. If you want to use the latest tools to the fullest extend, you'd need to upgrade your spec version.

@webron webron closed this as completed Jan 10, 2017
@gredondogc
Copy link
Author

I understand that but is it possible to show that the support is partial on the Readme.md? I would have stopped looking for a solution a lot sooner if I knew that errors were to be expected.

Thank you

@webron
Copy link
Contributor

webron commented Jan 11, 2017

@gredondogc yes, you're right, thanks for the feedback. I'll improve the readme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants