Add the operation path to the generated operation ID (#946)
This commit is contained in:
parent
1594634cb7
commit
b249ed1c52
|
@ -7,7 +7,7 @@ paths:
|
|||
get:
|
||||
tags:
|
||||
- Products
|
||||
operationId: 6a7963b92da560b8d7f16b0fdba847ef
|
||||
operationId: 664dbedf1321cf9bebfe80ce09f95b6a
|
||||
parameters:
|
||||
-
|
||||
name: id
|
||||
|
|
|
@ -7,7 +7,7 @@ paths:
|
|||
get:
|
||||
tags:
|
||||
- Products
|
||||
operationId: ecd4da135afcd55d0c1308b260c38060
|
||||
operationId: 133f11c148f628647767a323bf78c68d
|
||||
responses:
|
||||
default:
|
||||
description: 'successful operation'
|
||||
|
@ -18,7 +18,7 @@ paths:
|
|||
patch:
|
||||
tags:
|
||||
- Products
|
||||
operationId: ccfcd39d70ad7d7f367a54908d3a0db6
|
||||
operationId: 7f26f01759fb7245bf4f7138a3717e0f
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/product_in_body'
|
||||
responses:
|
||||
|
@ -35,7 +35,7 @@ paths:
|
|||
post:
|
||||
tags:
|
||||
- Products
|
||||
operationId: ce046e4e523b43847bf9a5066145bda0
|
||||
operationId: 779b6345f19f6b865527e6bd67819d2d
|
||||
parameters:
|
||||
-
|
||||
$ref: '#/components/requestBodies/product_in_body'
|
||||
|
|
|
@ -7,7 +7,7 @@ paths:
|
|||
delete:
|
||||
tags:
|
||||
- Entities
|
||||
operationId: e87b6b3d88068b6863f408c0ce77528f
|
||||
operationId: 372df3207489872fd3c775f623f8340f
|
||||
parameters:
|
||||
-
|
||||
name: id
|
||||
|
@ -23,7 +23,7 @@ paths:
|
|||
get:
|
||||
tags:
|
||||
- Products
|
||||
operationId: d3096ee893a30bd6cd88099036a5cb3f
|
||||
operationId: 569395beea865794cbde04d55c0ba4a2
|
||||
parameters:
|
||||
-
|
||||
name: product_id
|
||||
|
|
|
@ -58,7 +58,7 @@ class OperationId
|
|||
} else {
|
||||
$operationId = $context->method;
|
||||
}
|
||||
$operationId = strtoupper($operation->method).'::'.$operationId;
|
||||
$operationId = strtoupper($operation->method).'::'.$operation->path.'::'.$operationId;
|
||||
$operation->operationId = $this->hash ? md5($operationId) : $operationId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,14 +29,14 @@ class OperationIdTest extends OpenApiTestCase
|
|||
|
||||
$this->assertSame('entity/{id}', $operations[0]->path);
|
||||
$this->assertInstanceOf(Get::class, $operations[0]);
|
||||
$this->assertSame('GET::OpenApi\Tests\Fixtures\Processors\EntityControllerClass::getEntry', $operations[0]->operationId);
|
||||
$this->assertSame('GET::entity/{id}::OpenApi\Tests\Fixtures\Processors\EntityControllerClass::getEntry', $operations[0]->operationId);
|
||||
|
||||
$this->assertSame('entity/{id}', $operations[1]->path);
|
||||
$this->assertInstanceOf(Post::class, $operations[1]);
|
||||
$this->assertSame('POST::OpenApi\Tests\Fixtures\Processors\EntityControllerInterface::updateEntity', $operations[1]->operationId);
|
||||
$this->assertSame('POST::entity/{id}::OpenApi\Tests\Fixtures\Processors\EntityControllerInterface::updateEntity', $operations[1]->operationId);
|
||||
|
||||
$this->assertSame('entities/{id}', $operations[2]->path);
|
||||
$this->assertInstanceOf(Delete::class, $operations[2]);
|
||||
$this->assertSame('DELETE::OpenApi\Tests\Fixtures\Processors\EntityControllerTrait::deleteEntity', $operations[2]->operationId);
|
||||
$this->assertSame('DELETE::entities/{id}::OpenApi\Tests\Fixtures\Processors\EntityControllerTrait::deleteEntity', $operations[2]->operationId);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue