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.

OAS 3.0 | Swagger-UI | Required input parameters not getting validated

See original GitHub issue

I downloaded the Swagger-UI 3.X code from https://github.com/swagger-api/swagger-ui as of 10/11/2017.

Q A
Bug or feature request? Bug
Which Swagger/OpenAPI version? Open Api 3.0
Which Swagger-UI version? swagger-ui, 3.x
How did you install Swagger-UI? Dowloaded zip, extracted the /dist folder and added my yaml file to it.
Which browser & version? Chrome Version 61.0.3163.91
Which operating system? macOS Sierrra

Demonstration API definition

openapi: "3.0.0"

info:
  version: 1.0.0
  title: Example API
  description: A sample API using OpenApi 3.0
  contact:
    name: ABC
    email: test@test.com

servers:
  - url: http://localhost:8080
    description: Local instance of API

paths:
  /examples/{id}:
    get:
      tags: [examples]
      description: Test path
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      - name: test
        in: query
        description: test query
        required: false
        schema:
          type: string
          example: test
      responses:
        '200':
          description: test response
          content:
            application/json:
              schema:
                type: string
                example: success

Extracted the dist folder from swagger-UI and added the followingswaggerEx.yaml file to it:

In the index.html folder I made the following change:

  // Build a system
  const ui = SwaggerUIBundle({
    url: "swaggerEx.yaml",
    dom_id: '#swagger-ui',
    deepLinking: true,
    presets: [
      SwaggerUIBundle.presets.apis,
      SwaggerUIStandalonePreset
    ],
    plugins: [
      SwaggerUIBundle.plugins.DownloadUrl
    ],
    layout: "StandaloneLayout"
  })

Expected Behavior

As in swagger 2.0, I expected that the required parameters would be validated such as:

screen shot 2017-10-11 at 10 11 34 am

Current Behavior

With the new UI I see that the required parameter validation does not occur and the call keeps loading but never gets executed. Here is a screen shot with that behavior: screen shot 2017-10-11 at 10 14 15 am

Context

We are trying to document our API using Swagger. Right now the documentation part works but if we want to provide user with the ability to try out the API we cannot do that because of this issue.

Thank you.

Issue Analytics

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

github_iconTop GitHub Comments

6reactions
nirmalgoswamicommented, Mar 7, 2020

Same issue in openapi 3.0

0reactions
karvapallocommented, Oct 15, 2020

Still seeing this issue using OpenAPI 3.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Describing Parameters - Swagger
Query parameters can be primitive values, arrays and objects. OpenAPI 3.0 provides several ways to serialize objects and arrays in the query string....
Read more >
Parameter(required = false) not working in swagger open api v3
my problem is with annotation @Parameter that belongs to io.swagger.v3.oas.annotations.Parameter. by default should be required = false, but as ...
Read more >
Using OpenAPI and Swagger UI - Quarkus
An OpenAPI document that conforms to the OpenAPI Specification is itself a valid JSON object, that can be represented in yaml or json...
Read more >
Fix Swagger Validator errors in Power Platform connectors
Body or form data parameters are not supported in a fetch operation. Operations using the “GET” HTTP method can't have a body or...
Read more >
What's New in SwaggerHub - SmartBear Support
oas =3.0.0 query parameter - this is no longer needed. The oas parameter has been removed. Updated Swagger UI to 3.38.
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