Skip to content

Commit

Permalink
Merge pull request #107 from DoclerLabs/fix-operation-id-with-dashes
Browse files Browse the repository at this point in the history
fix operation id with dashes
  • Loading branch information
vsouz4 authored Feb 10, 2024
2 parents c526246 + 2481608 commit ee0b3f1
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [10.6.1] - 2024.02.10
### Fixed
- operationId containing dashes is converted to camel case

## [10.6.0] - 2024.01.10
### Added
- Api key authentication strategy added
Expand Down
2 changes: 2 additions & 0 deletions src/Input/Factory/OperationFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public function create(
$operationId
);
trigger_error($warningMessage, E_USER_WARNING);
} elseif (str_contains($operationId, '-')) {
$operationId = CaseCaster::toCamel($operationId);
}

$parameters = array_merge($commonParameters, $operation->parameters ?? []);
Expand Down
9 changes: 8 additions & 1 deletion test/suite/functional/Generator/Client/petstore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ servers:
paths:
/pets:
get:
operationId: findPets
operationId: find-pets
parameters:
- name: tags
in: query
Expand Down Expand Up @@ -110,6 +110,13 @@ paths:
schema:
type: integer
format: int64
- name: food_id
in: path
description: ID of food to delete
required: true
schema:
type: integer
format: int64
responses:
'204':
description: pet food deleted
Expand Down
21 changes: 21 additions & 0 deletions test/suite/functional/Input/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,27 @@ public function validSpecificationProvider(): array
],
],
],
'operationId with dashes is supported' => [
[
'openapi' => '3.0.0',
'info' => [
'title' => 'Sample API',
'version' => '1.0.0',
],
'paths' => [
'/users' => [
'get' => [
'operationId' => 'get-users',
'responses' => [
'200' => [
'description' => 'OK',
],
],
],
],
],
],
],
];
}

Expand Down

0 comments on commit ee0b3f1

Please sign in to comment.