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.

Required body parameters are not marked as such

See original GitHub issue

Swagger UI 2.2.8

It looks like Swagger UI 2.2.8 doesn’t mark body parameters as required, though Swagger Editor does. Apologies if it’s been logged, I can’t seem to fund much on it.

Roger

screen shot 2017-07-03 at 12 21 57 pm

screen shot 2017-07-03 at 12 21 40 pm

screen shot 2017-07-03 at 2 14 49 pm

  '/items/{idItem}':
    post:
      summary: Insert an item
      parameters:
        - $ref: '#/parameters/IdItemInPath'
        - in: body
          name: body
          description: Post item payload
          required: true
          schema:
            $ref: "#/definitions/ItemPost"
definitions:
  ItemPost:
    required:
      - idShot
      - styleGroupNumber
      - colorCode
    properties:
      idShot:
        type: integer
        format: int32
      brand:
        type: string
        description: length limited to 255 chars
      color:
        type: string
        description: length limited to 255 chars
      colorCode:
        type: string
        description: length limited to 255 chars
      departmentNumber:
        type: string
        description: length limited to 255 chars
      description:
        type: string
        description: text column, allows for 21,844 chars
      liveDate:
        type: string
        format: date
        description: YYYY-DD-MM
      price:
        type: number
        format: float
      styleGroupNumber:
        type: string
      vpn:
        type: string
        description: vendor product number. length limited to 255 chars

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
piotrzarzycki21commented, Sep 17, 2018

I’m having the same problem in version 3.19.0. I have following request body

 "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                    "$ref": "./schemas/body/myFile.json#/someFile"
                }
              }
            }
},

and someFile is:

{
  "someFile": {
    "type": "object",
    "properties": {
      "name": {
        "type": "string",
        "required": "true"
      }
    }
  }
}

swagger_ui

In the UI I don’t see any red asterix etc. Should I raise another issue for that ?

0reactions
brianpilaticommented, May 16, 2019

Any updates on this issue. How has this gone unnoticed for so long?

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Body parameter required with swagger 4.0 Asp.net core 2.2
How to mark a property as required in Swagger, without ASP. ... The parameter is required, and a JSON object will not tell...
Read more >
Swagger PUT/POST body value issue
It looks like [ApiMember(ParameterType = "body")] is incorrectly retaining the name of the property its decorating, and including that in the ...
Read more >
Describing Parameters - Swagger
Required and Optional Parameters. By default, Swagger treats all request parameters as optional. You can add required: true to mark a parameter as...
Read more >
Specify Parameters - SQL Server - Microsoft Learn
Variables can be user-defined or system variables such as @@spid. ... It is not necessary to provide a value for an optional parameter...
Read more >
Request and Response JSON Reference | Alexa Skills Kit
The request body contains the parameters necessary for the service to perform its ... Requests that are not customer-initiated, such as the AudioPlayer ......
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