question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Post with String in body is failing string validation

See original GitHub issue

This is my first app using open-api. Love it where numbers are concerned, but string validation on this path are failing. Unsure if bug, or me being dumb.

Environment

  • express-openapi - 3.6.0
  • node - 10.15.0

Api Call (from chrome Network panel)

Url: http://localhost:3000/app/121/toggle_setting Body: {"settingName":"isLocked","val":false}

Api Definition

[
"/app/{id}/toggle_setting": {
      "post": {
        "description": "Toggles a single setting for one app. Returns app full state",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "number"
            }
          },
          {
            "in": "body",
            "name": "settingName",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "body",
            "name": "val",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A app's configuration.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/appFull"
                }
              }
            }
          }
        }
      }
    }
]

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
relativityboycommented, Jan 18, 2019

Thanks guys, really appreciate the followup. Wish I’d more time to do the same since opening. Will do in the coming weeks and re-open (with better details) if I find something amiss.

1reaction
jsdevelcommented, Dec 31, 2018

@relativityboy please submit a PR

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTP Post with request body failed when using Regex to ...
HTTP Post with request body failed when using Regex to validate body parameter ... I'm testing an Express API using the post method....
Read more >
Validate Request Body in RESTful Web Service
In this tutorial, you will learn how to validate the request body of an HTTP Post request sent to a RESTful Web Service...
Read more >
Help need with validating response that it is a string and ...
I have a response for a PUT request as below which is an array and can have 2 elements in the array. Response....
Read more >
How to validate Json Post Request body aginest a schema ...
TIA , I'm receiving fallowing sample data to my AZURE APIM Api as a request body. I want to validate Json body againest...
Read more >
Resolve template validation or template format errors in ... - AWS
In the following example JSON and YAML templates, the condition in the resource EC2RouteA is specified as a list of strings instead of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found