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

OpenAPI: Swagger 2.0 basePath linting rule fails when value contains 's' #3565

Closed
CalemRoelofsSB opened this issue Dec 20, 2023 · 1 comment
Assignees
Labels
ApiDOM bug Something isn't working OpenApi 2.0

Comments

@CalemRoelofsSB
Copy link
Contributor

Q&A (please complete the following information)

  • OS: MacOS Ventura 13.6.3
  • Browser: Firefox
  • Version: 121.0
  • Method of installation: found while using https://editor-next.swagger.io/
  • ApiDOM version: 0.85.0
  • Swagger/OpenAPI version: Swagger 2.0

Describe the bug you're encountering

The Swagger 2.0 linting rule for validating that the basePath is correctly formatted (https://github.com/swagger-api/apidom/edit/main/packages/apidom-ls/src/config/openapi/swagger/lint/base-path--pattern.ts) fails erroneously whenever there is a basePath with the character s in it.

To reproduce...

Steps to reproduce the behavior:

  1. Load up any Swagger 2.0 definition in https://editor-next.swagger.io/
  2. Add basePath: /s123 or basePath: /123s or basePath: /hello/worlds or any string starting with / and containing the character s

Expected behavior

No validation error is displayed

Screenshots

image
image
image

Additional context or thoughts

This appears to be caused by the regex used for this rule found here

@CalemRoelofsSB CalemRoelofsSB added bug Something isn't working ApiDOM OpenApi 2.0 labels Dec 20, 2023
@CalemRoelofsSB CalemRoelofsSB changed the title OpenAPI: Swagger 2.0 basePath linting rule fails when value starts or ends with 's' OpenAPI: Swagger 2.0 basePath linting rule fails when value contains 's' Dec 20, 2023
CalemRoelofsSB added a commit that referenced this issue Dec 20, 2023
Refs #3565 

This PR fixes the regex in the `OPENAPI2_SWAGGER_FIELD_BASE_PATH_PATTERN` linting rule so that it matches on whitespace characters instead of the letter 's'
@char0n
Copy link
Member

char0n commented Jan 3, 2024

Addressed in #3566

@char0n char0n closed this as completed Jan 3, 2024
@char0n char0n self-assigned this Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ApiDOM bug Something isn't working OpenApi 2.0
Projects
None yet
Development

No branches or pull requests

2 participants