Skip to content

Commit 1b14059

Browse files
committed
utf8 in component ids
1 parent 712bdc2 commit 1b14059

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/Tqdev/PhpCrudApi/OpenApi/OpenApiStatusBuilder.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,10 @@ private function setPaths() /*: void*/
3333
foreach ($this->operations as $type => $operationPair) {
3434
foreach ($operationPair as $operation => $method) {
3535
$path = "/$type/$operation";
36-
$operationType = $operation . ucfirst($type);
3736
$this->openapi->set("paths|$path|$method|tags|0", "$type");
3837
$this->openapi->set("paths|$path|$method|operationId", "$operation" . "_" . "$type");
3938
$this->openapi->set("paths|$path|$method|description", "Request API '$operation' status");
40-
$this->openapi->set("paths|$path|$method|responses|200|\$ref", "#/components/responses/$operationType");
39+
$this->openapi->set("paths|$path|$method|responses|200|\$ref", "#/components/responses/$operation-$type");
4140

4241
}
4342
}
@@ -47,8 +46,7 @@ private function setComponentSchema() /*: void*/
4746
{
4847
foreach ($this->operations as $type => $operationPair) {
4948
foreach ($operationPair as $operation => $method) {
50-
$operationType = $operation . ucfirst($type);
51-
$prefix = "components|schemas|$operationType";
49+
$prefix = "components|schemas|$operation-$type";
5250
$this->openapi->set("$prefix|type", "object");
5351
switch ($operation) {
5452
case 'ping':
@@ -67,9 +65,8 @@ private function setComponentResponse() /*: void*/
6765
{
6866
foreach ($this->operations as $type => $operationPair) {
6967
foreach ($operationPair as $operation => $method) {
70-
$operationType = $operation . ucfirst($type);
71-
$this->openapi->set("components|responses|$operationType|description", "$operation status record");
72-
$this->openapi->set("components|responses|$operationType|content|application/json|schema|\$ref", "#/components/schemas/$operationType");
68+
$this->openapi->set("components|responses|$operation-$type|description", "$operation status record");
69+
$this->openapi->set("components|responses|$operation-$type|content|application/json|schema|\$ref", "#/components/schemas/$operation-$type");
7370
}
7471
}
7572
}

0 commit comments

Comments
 (0)