Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

Error when api use "application/json" #5

Closed
cavoixanha opened this issue Jul 2, 2019 · 5 comments
Closed

Error when api use "application/json" #5

cavoixanha opened this issue Jul 2, 2019 · 5 comments

Comments

@cavoixanha
Copy link

Expected behavior

should add parameters correctly

Current behavior

  :/api/trash:
    post:
      tags:
      - "Create"
      summary: "FLOL New"
      consumes:
        - "application/json"
      parameters:
      - name: "Accept"
        in: "header"
        type: "string"
        description: ""
        required: true
      - name: "Referer"
        in: "header"
        type: "string"
        description: ""
        required: true
      - name: "Origin"
        in: "header"
        type: "string"
        description: ""
        required: true
      - name: "keyapi"
        in: "header"
        type: "string"
        description: ""
        required: true
      - name: "User-Agent"
        in: "header"
        type: "string"
        description: ""
        required: true
      - name: "Content-Type"
        in: "header"
        type: "string"
        description: ""
        required: true
      responses:
        200:
          description: "successful operation"

Steps to reproduce the behavior

{
            "_id": "req_da6b437b035543d78816c68d0ac9a359",
            "authentication": {},
            "body": {
                "mimeType": "application/json",
                "text": "{\"trashs\":[{\"obj_type\":\"VTODO\",\"obj_id\":\"e36eedfd-ebce-484c-ab51-b34c521e8e94\"}]}"
            },
            "created": 1560918399752,
            "description": "",
            "headers": [
                {
                    "id": "pair_9ef12f649a7c46ed82d34f7285fa24ef",
                    "name": "Accept",
                    "value": "application/json, text/plain, */*"
                },
                {
                    "id": "pair_8606f209d0fd40eab95808087cdcb17e",
                    "name": "Referer",
                    "value": "http://localhost:3003/"
                },
                {
                    "id": "pair_16984c2649d54acb9e1584d7f8f212de",
                    "name": "Origin",
                    "value": "http://localhost:3003"
                },
                {
                    "id": "pair_7a17f9c6ea284f6abcb8acec986ebc66",
                    "name": "keyapi",
                    "value": "d496129aa0e2270fea037284f3601cf8"
                },
                {
                    "id": "pair_2452da517b604e83b50abd063c1062eb",
                    "name": "User-Agent",
                    "value": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.90 Safari/537.36"
                },
                {
                    "id": "pair_7c52c30428504544a2a73836baf42b3a",
                    "name": "Content-Type",
                    "value": "application/json"
                }
            ],
            "isPrivate": false,
            "metaSortKey": -1560918399752,
            "method": "POST",
            "modified": 1560918478646,
            "name": "Old",
            "parameters": [],
            "parentId": "fld_b3e04dff86f84c179e5f7d5b4f28bd49",
            "settingDisableRenderRequestBody": false,
            "settingEncodeUrl": true,
            "settingRebuildPath": true,
            "settingSendCookies": true,
            "settingStoreCookies": true,
            "url": "http://localhost:8057/api/v1/trash",
            "_type": "request"
        }
@Fyb3roptik
Copy link
Owner

I am not understanding your issue here. It looks as if the header params are adding correctly

@cavoixanha
Copy link
Author

cavoixanha commented Jul 3, 2019

Parameters should is body json
{"trashs":[{"obj_type":"VTODO","obj_id":"e36eedfd-ebce-484c-ab51-b34c521e8e94"}]}"

@Fyb3roptik
Copy link
Owner

I am still unclear about the issue here. I see the header params came through just fine. Am I missing something?

@cavoixanha
Copy link
Author

I think should parse to properties of requestBody is correctly

post:
  tags:
    - Trash
  summary: Create Trashed
  security:
    - ApiKeyAuth: []
  operationId: createTrashed
  description: Create Trashed
  requestBody:
    content:
      application/json:
        schema:
          type: object
          required:
            - trashs
          properties:
            trashs:
              type: array
              items:
                required:
                  - obj_id
                  - obj_type
                properties:
                  obj_id:
                    $ref: './parameters/post.yaml#/obj_id'
                  obj_type:
                    $ref: './parameters/post.yaml#/obj_type'
                  sync_token:
                    $ref: './parameters/post.yaml#/sync_token'
                  status:
                    $ref: './parameters/post.yaml#/status_trash'
                  trash_time:
                    $ref: './parameters/post.yaml#/trash_time'
                  ref:
                    $ref: './parameters/post.yaml#/ref

@Fyb3roptik
Copy link
Owner

Again, no idea what the issue is here. Closing because I cannot reproduce anything on this

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

No branches or pull requests

2 participants