apple / swift-openapi-generator

Generate Swift client and server code from an OpenAPI document.
https://swiftpackageindex.com/apple/swift-openapi-generator/documentation
Apache License 2.0
1.45k stars 120 forks source link

Correctly handle path params with a hyphen in the name #602

Closed czechboy0 closed 4 months ago

czechboy0 commented 4 months ago

Motivation

Fixes #601, check out the issue for details.

Modifications

Adds hyphen to the regular expression that parses out params from the URL template.

Result

Correctly handle path params with hyphens in the name.

Test Plan

Added a unit test.

czechboy0 commented 4 months ago

Actually, not just hyphen, but a period is also commonly used in path param names. Let me add that too.

czechboy0 commented 4 months ago

@simonjbeaumont Thanks for the review. I did try to look for an authoritative source for "allowed characters in path parameter names", but couldn't find anything conclusive. So for now, this is what we support.