Skip to content

Add support for OAS path params with dashes#2013

Merged
255kb merged 1 commit intomainfrom
feature/2012-oas-path-param
Dec 15, 2025
Merged

Add support for OAS path params with dashes#2013
255kb merged 1 commit intomainfrom
feature/2012-oas-path-param

Conversation

@255kb
Copy link
Member

@255kb 255kb commented Dec 15, 2025

Closes #2012

Technical implementation details

Checklist

  • data migration added (@mockoon/commons)
  • commons lib tests added (@mockoon/commons)
  • commons-server lib tests added (@mockoon/commons-server)
  • CLI tests added (@mockoon/cli)
  • desktop UI automated tests added (@mockoon/app)

Closes #{issue_number}

Copilot AI review requested due to automatic review settings December 15, 2025 08:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for OpenAPI Specification (OAS) path parameters that contain dashes by modifying the parameter conversion logic to strip hyphens when converting to Express route format.

Key Changes:

  • Updated regex pattern in parameter replacement to match parameters containing dashes (e.g., {param-id})
  • Modified transformation logic to remove hyphens from parameter names since Express does not support them in route parameters
  • Renamed v2ParametersReplace to routeParametersReplace to better reflect its usage across both Swagger v2 and OpenAPI v3

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/commons/src/libs/openapi-converter.ts Updated the parameter replacement method to handle dashes in OAS path parameters by expanding the regex pattern and stripping hyphens during conversion to Express format
packages/app/test/data/res/import-openapi/samples/custom-schema-v3.yaml Added a test endpoint with path parameters containing dashes (/withparams/{paramName}/{param-id})
packages/app/test/data/res/import-openapi/references/custom-schema-v3.json Added expected test output showing the converted endpoint with dashes removed (withparams/:paramName/:paramid)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@255kb 255kb merged commit e07de93 into main Dec 15, 2025
21 checks passed
@255kb 255kb deleted the feature/2012-oas-path-param branch December 15, 2025 09:09
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

Successfully merging this pull request may close these issues.

Add support for parameters with dashes when importing an OpenAPI specification

2 participants