Skip to content

How to send an Hash of properties #416

@Nerian

Description

@Nerian

Hi,

So my API expects a POST request with params in this manner:
captura de pantalla 2014-03-07 a la s 17 03 52

The problem is that it has a 'Section' field. You are not actually going to use it, but the fact that is required means that you need to pass a value. And if you do, then it breaks everything. If you edit the HTML using Chrome Inspector and remove that field, then everything works fine.

How can I remove the section field? Maybe the schema I am sending is wrong?

The schema data swagger UI is receiving was generated by grape-swagger, and is this:

{
  "apiVersion": "v2",
  "swaggerVersion": "1.2",
  "resourcePath": "",
  "apis": [
    {
      "path": "/api/v2/eclasses/{eclass_id}/roster/sections.{format}",
      "operations": [
        {
          "produces": [
            "application/json"
          ],
          "notes": "",
          "summary": "Add section to a class",
          "nickname": "POST-api--version-eclasses--eclass_id-roster-sections---format-",
          "httpMethod": "POST",
          "parameters": [
            {
              "paramType": "path",
              "name": "eclass_id",
              "description": "Eclass id",
              "type": "Integer",
              "dataType": "Integer",
              "required": true
            },
            {
              "paramType": "form",
              "name": "section",
              "description": null,
              "type": "Hash",
              "dataType": "Hash",
              "required": true
            },
            {
              "paramType": "form",
              "name": "section[name]",
              "description": null,
              "type": "String",
              "dataType": "String",
              "required": true
            }
          ]
        }
      ]
    },
  ],
  "basePath": "http://localhost:9292"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions