Skip to content

Can't get parameter validation error list in param-body #7451

@ghost

Description

Q&A (please complete the following information)

  • OS: macOS
  • Browser: chrome
  • Version: latest
  • Method of installation: source code debug
  • Swagger-UI version: latest
  • Swagger/OpenAPI version: Swagger 2.0, OpenAPI 3.0

Content & configuration

The code to get the validation error list in src/core/components/param-body.jsx

// line 110 - 111
let parameter = specSelectors ? specSelectors.parameterWithMetaByIdentity(pathMethod, param) : param
let errors = parameter.get("errors", List())

seems can't get the error list set in the [VALIDATE_PARAMS] reducer. While I changed it to

// line 111
let errors = param.get("errors", List())

to get the error list directly from the param variable, and it worked.

I think this may be a defect and don't know why this specSelectors.parameterWithMetaByIdentity(pathMethod, param) is necessary. Please take a look.


Example Swagger/OpenAPI definition:

# your YAML here

Swagger-UI configuration options:

SwaggerUI({
  // your config options here
})
?yourQueryStringConfig

Describe the bug you're encountering

To reproduce...

Steps to reproduce the behavior:

  1. Go to 'petstore'
  2. Scroll down to 'any api with additional body parameter'
  3. Change it's json body to any invalid format
  4. Click on Execute

Expected behavior

There would be some feedback on the page

Screenshots

Additional context or thoughts

If the param-body gets the errors correctly, there would be a hint on the page indicating the param error for #6295.
And if the error messages can be displayed on the page, it would be even better.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions