node-red / node-red-node-swagger

A set of tools for generating Swagger api documentation based on the HTTP nodes deployed in a flow
Apache License 2.0
62 stars 47 forks source link

Inline schema for parameters missing type property #8

Closed skhwang closed 9 years ago

skhwang commented 9 years ago

Swagger UI from Swagger.io recently added the support for the inline schema.

Here is the issue: https://github.com/swagger-api/swagger-ui/issues/1133

and here is the commit that fixed it: https://github.com/swagger-api/swagger-js/commit/91eff39298dc81c9a53074822bec4f8b86f6a519

I have noticed that the inline schema swagger node generates is missing type property for schema object.

The following inline schema displays "undefined" under Data Type column of Swagger UI's parameter view.

"parameters": [
{
  "name": "body",
  "in": "body",
  "required": false,
  "schema": {
    "properties": {
      "message": {
        "type": "string"
      }
    }
  }
}
]

does not work

The following inline schema displays the model correctly under Data Type column.

"parameters": [
{
  "name": "body",
  "in": "body",
  "required": false,
  "schema": {
    "type": "object",
    "properties": {
      "message": {
        "type": "string"
      }
    }
  }
}
]

works

Based on the fact that the first example works fine in Swagger Editor (http://editor.swagger.io/) but not in Swagger UI, I am a little puzzled whether this type property should be there by the spec though.