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

Created on 11 Oct 2017  路  10Comments  路  Source: swagger-api/swagger-ui

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: [email protected]

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.

P2 bug 3.x

Most helpful comment

Same issue in openapi 3.0

All 10 comments

@owenconti can you take a look?

It'd be great to have this fixed before Friday's release.

Looking into it now.

Thank you for the fix!

Hi, @owenconti , @webron , @shockey !
Topic starter's example still not working on https://editor.swagger.io. After _Try it out -> Execute_ Id path parameter is not highlighted in red. This is normal?

@bronekrab, the issue is a little different: the required warning isn't showing, but the execute state isn't running away either.

that being said, i see it too - i'll reopen this.

This will be fixed (again) in tomorrow night's release.

Thanks for the heads up on the regression, @bronekrab!

Hi!! They have a solution? I 'am having the same problem

Same issue in openapi 3.0

Still seeing this issue using OpenAPI 3.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

songtianyi picture songtianyi  路  3Comments

nulltoken picture nulltoken  路  3Comments

shockey picture shockey  路  3Comments

liuya05 picture liuya05  路  3Comments

MartinMuzatko picture MartinMuzatko  路  4Comments