xiaodongw / swagger-finatra

Finatra Swagger Support
Apache License 2.0
46 stars 45 forks source link

Fix bodyParams provided with Arrays #32

Closed fhoering closed 7 years ago

fhoering commented 7 years ago

Before schema is empty for array bodyParams:

 "/students/bulk": {
      "post": {
        "parameters": [
          {
            "description": "the list of students",
            "in": "body",
            "name": "students",
            "required": false
          }
        ],
        "responses": {
           ..
          }
        },
        "summary": "Create a list of students",
        "tags": [
          "Student"
        ]
      }
    },

Now:

 "/students/bulk": {
      "post": {
        "parameters": [
          {
            "description": "the list of students",
            "in": "body",
            "name": "students",
            "required": false,
            "schema": {
              "items": {
                "$ref": "#/definitions/Student"
              },
              "type": "array"
            }
          }
        ],
        "responses": {
           ..
          }
        },
        "summary": "Create a list of students",
        "tags": [
          "Student"
        ]
      }
    },
fhoering commented 7 years ago

OK. Thanks. Actually I might do another pull request to also support simple types (today set first name for example is wrapped in an object). So I can also move this stuff to a helper method

fhoering commented 7 years ago

Done. Moved common code to SchemaUtil