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

In swagger ui arrays only let you add 1 at a time vs older text area #776

Open
KellyWebServices opened this issue Jul 18, 2022 · 0 comments

Comments

@KellyWebServices
Copy link

Issue

I'm upgrading from hapi ~13 to 22. Also hapi-swagger from 6.1 to 14.5.5. In the past for routes that had query fields that were an array of strings I would test in the swagger UI were it had an html text area box to input an array in text form, ( [ 'blah', 'yeah' ] ). Now we just have a button to "Add string item". When trying to put many items in, this isn't a very pleasant experience. Is there an option or something to use to get a text area back for array fields for mass input instead of 1 button adding? I was trying to comb the documentation but couldn't find what I was looking for. Thanks!

In the below example, the first 3 query fields show as just text input boxes like normal, but the 4 lists have the "Add string item" button to get 1 text input at a time.

Environment

npx envinfo --npmPackages '*hapi*' --binaries

(paste the output of the command here)
Binaries:
Node: 14.19.3 - ~/.nvm/versions/node/v14.19.3/bin/node
npm: 6.14.17 - ~/.nvm/versions/node/v14.19.3/bin/npm
npmPackages:
hapi-fake-reply: ^0.1.1 => 0.1.4
hapi-swagger: ^14.5.5 => 14.5.5

Steps to Reproduce

(describe your issue here, include example route or joi schemas)

Example:
server.route({
    method: 'GET',
    path: `/${root}`,
    config: {
      tags: ['api'],
      handler: controller.routeToConversion,
      description: 'Calling conversions',
      validate: {
        failAction,
        query: {
          method: Joi.string().required(),
          startDate: Joi.string().optional(),
          endDate: Joi.string().optional(),          
          aList: Joi.array().items(Joi.string()).max(100).optional(),
          bList: Joi.array().items(Joi.string()).max(100).optional(),
          cList: Joi.array().items(Joi.string()).max(100).optional(),
          dList: Joi.array().items(Joi.string()).max(100).optional()
        }
      },
      auth: {
        scope: 'conversions'
      }
    }
  })

Expected Behavior

(write what you thought would happen)
Text area to input an array

Actual Behavior

Button to add 1 element at a time

(write what happened)

Reproducible Demo

n/a

(Paste the link to an example project and exact instructions to reproduce the issue)

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

1 participant