-
Notifications
You must be signed in to change notification settings - Fork 940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filtering not done as expected #1624
Labels
Comments
This might be something to be added to the new |
Merged
What can I say. |
Test.php #[\OpenApi\Attributes\OpenApi(
info: new \OpenApi\Attributes\Info(
title: 'test',
description: 'test',
version: '2.0.0'
),
)]
class Test
{
#[\OpenApi\Attributes\Get(path: '/world/', tags: ['tag world'], responses: [new \OpenApi\Attributes\Response(response: '200', description: 'success')])]
#[\OpenApi\Attributes\Get(path: '/hello/', tags: ['tag hello'], responses: [new \OpenApi\Attributes\Response(response: '200', description: 'success')])]
public function hello(): void
{
}
} testrun.php require("vendor/autoload.php");
spl_autoload_register(function ($string): void {
if ($string === 'Test') {
require __DIR__ . '/Test.php';
}
});
$openapi = (new \OpenApi\Generator())->setVersion('3.0.0')->setConfig([
'pathFilter' => [
'paths' => ['/^\/hello\//'],
],
'cleanUnusedComponents' => ['enabled' => true],
])->generate(\OpenApi\Util::finder([__DIR__ . '/Test.php']));
$json = json_decode($openapi->toJson(), true);
echo json_encode($json, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR); Output, with both tags instead of a single one {
"openapi": "3.0.0",
"info": {
"title": "test",
"description": "test",
"version": "2.0.0"
},
"paths": {
"\/hello\/": {
"get": {
"tags": [
"tag hello"
],
"operationId": "d334274659cc0b24fab8ee0a76559fdf",
"responses": {
"200": {
"description": "success"
}
}
}
}
},
"tags": [
{
"name": "tag world",
"description": "tag world"
},
{
"name": "tag hello",
"description": "tag hello"
}
]
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When all interfaces in a tag are filtered out, the tag should also be removed because it does not have any effect when displayed here.
As shown by the blue line in the figure, no api appears when I click to expand, so it should not continue to exist.
The text was updated successfully, but these errors were encountered: