Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array length validation issue #8208

Open
AmishFaldu opened this issue Sep 29, 2022 · 4 comments
Open

Array length validation issue #8208

AmishFaldu opened this issue Sep 29, 2022 · 4 comments

Comments

@AmishFaldu
Copy link

Q&A (please complete the following information)

  • OS: macOS
  • Browser: chrome
  • Version: 106.0.5249.61
  • Method of installation: npm
  • Swagger-UI version: 4.14.0
  • Swagger/OpenAPI version: OpenAPI 3.0

Content & configuration

Example Swagger/OpenAPI definition:

openapi: 3.0.0
info:
  title: Hello world swagger
  version: 1.0.0
  description: Hello world swagger description
paths:
  /:
    post:
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/String'
      parameters: []
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file2:
                  type: array
                  items:
                    type: string
                    format: binary
                  maxItems: 2
        required: true
components:
  schemas:
    Object:
      type: object
      example: {}
    Boolean:
      type: boolean
      example: true
    Number:
      type: number
      example: 1
    String:
      type: string
      example: string
    Function:
      type: string
      example: Function
    Undefined:
      type: string
      example: undefined
security: []
tags: []

Swagger-UI configuration options:

SwaggerUIBundle({
        spec: {"openapi":"3.0.0","info":{"title":"Hello world swagger","version":"1.0.0","description":"Hello world swagger description"},"paths":{"/":{"post":{"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/String"}}}}},"parameters":[],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file2":{"type":"array","items":{"type":"string","format":"binary"},"maxItems":2}}}}},"required":true}}}},"components":{"schemas":{"Object":{"type":"object","example":{}},"Boolean":{"type":"boolean","example":true},"Number":{"type":"number","example":1},"String":{"type":"string","example":"string"},"Function":{"type":"string","example":"Function"},"Undefined":{"type":"string","example":"undefined"}}},"security":[],"tags":[]},
        dom_id: '#swagger-ui',
        deepLinking: true,
        presets: [
            SwaggerUIBundle.presets.apis,
            SwaggerUIStandalonePreset
        ],
        plugins: [
            SwaggerUIBundle.plugins.DownloadUrl
        ],
        layout: "StandaloneLayout",
        displayRequestDuration: false,
        filter: false,
        tryItOutEnabled: false,      
    });
?yourQueryStringConfig - ??

Describe the bug you're encountering

To reproduce...

Steps to reproduce the behavior:

  1. Go to https://editor.swagger.io/
  2. Paste YML open api defination
  3. Click on the POST API and then click on "Try it out"
  4. Now try adding multiple files, you can actually add more than 2 files.

Expected behavior

The swagger UI should not allow adding more than 2 files with this YML specification

Screenshots

Screenshot 2022-09-29 at 10 59 03 AM

Additional context or thoughts

I have found this issue #6327 and it is closed when this PR was merged - #6878. But this doesn't seem to work, don't know why?

@AmishFaldu
Copy link
Author

Anyone can please look into this issue? This was opened 5 days ago

@twjasa
Copy link
Contributor

twjasa commented Oct 6, 2022

Hello y'all,

I will look into it

@retry19
Copy link

retry19 commented Oct 22, 2022

hello @twjasa , do you still working on this? if not I want to try work on this

@twjasa
Copy link
Contributor

twjasa commented Oct 22, 2022

hello @twjasa , do you still working on this? if not I want to try work on this

Hey @retry19 go ahead. I dont have too much time in my hands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants