0

I have marked in my yaml file paremeter:

     parameters:
     - name: someID
       in: query
       description: The some ID
       required: true
       schema:
        type: uuid

In generated java classes field is marked as required which is great, but on Swagger UI unfortunately not. It is problematic, because I would like to inform user before fail request that this file is required.

Paweł Domański
  • 534
  • 2
  • 5
  • 19
  • 1) Is this `openapi: 3.0.0` or `swagger: "2.0"`? 2) There's no `type: uuid` in OpenAPI/Swagger, did you mean `type: string` + `format: uuid`? 3) [Which version](https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/version-detection.md) of Swagger UI do you use - 2.x or 3.x? I believe both indicate required parameters by using `*`. – Helen May 08 '19 at 12:49
  • swagger: 2.0 Where to add * ? On the end of name? schema: type: string format: uuid – Paweł Domański May 08 '19 at 13:15

1 Answers1

1

In OpenAPI 2.0 (swagger: '2.0'), query parameters do not use schema and use the type keyword directly. Note that there's no type: uuid, instead you need type: string + format: uuid:

parameters:
  - name: someID
    in: query
    description: The some ID
    required: true
    type: string
    format: uuid

Swagger UI indicates required parameters by displaying a red * required note next to the parameter name:

How required parameter is indicated in Swagger UI

Helen
  • 87,344
  • 17
  • 243
  • 314