Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0993565
feat(scopes): Allow apps to define different API scopes for different…
nickvergessen Jan 11, 2024
36ab954
feat(scopes): Allow multiple scopes
nickvergessen Jan 11, 2024
fff1bd9
fix(scopes): Only list schemas that are used in this Scope
nickvergessen Jan 11, 2024
288914d
feat(scopes): Move admin-only routes to administration scope when def…
nickvergessen Jan 11, 2024
e065a7c
feat(scopes): Handle tags defined by the scopes
nickvergessen Jan 11, 2024
481ca1c
fix(scopes): Don't break on files responses
nickvergessen Jan 11, 2024
a369adb
fix(scopes): Deduplicate logic
nickvergessen Jan 11, 2024
f6ad18f
fix(scopes): Also export schemas that are only referenced by other sc…
nickvergessen Jan 11, 2024
6ef6a4b
fix(scopes): Don't warn when we deal with binary return types
nickvergessen Jan 11, 2024
7aa0bac
fix(scopes): Correctly add schemas references by nested schemas
nickvergessen Jan 11, 2024
886b55f
fix(scopes): Don't break with \stdClass returns
nickvergessen Jan 11, 2024
59826d7
fix(scopes): Handle all possible cases of other Schemas when importin…
nickvergessen Jan 11, 2024
2cf5e13
fix(scopes): Add tests for the scope and tag features
nickvergessen Jan 11, 2024
2cd80cf
fix(scopes): Fix tag variable name
nickvergessen Jan 12, 2024
f76700f
fix(scopes): Remove attribute name from parameter as it's always the …
nickvergessen Jan 12, 2024
42f15fb
fix(scopes): Panic when a controller/route is ignored but has other s…
nickvergessen Jan 12, 2024
03ccc56
fix(scopes): Better log levels for schema detection
nickvergessen Jan 12, 2024
3729e5a
fix(scopes): Reduce nesting of the scope loops
nickvergessen Jan 12, 2024
9833a75
fix(scopes): Deduplicate finding used schemas
nickvergessen Jan 12, 2024
a698329
fix(scopes): Allow scopes and tags without parameter names
nickvergessen Jan 12, 2024
2125e85
feat(scopes): Add a "full" scope when more than 1 is used
nickvergessen Jan 12, 2024
84c976b
fix(tests): Adjust some copy-paste description and add openapi-full.json
nickvergessen Jan 12, 2024
0d8fb4b
fix(scopes): Improve help when not reading schemas
nickvergessen Jan 12, 2024
5d78669
fix(tags): Panic when the tags are not an array list
nickvergessen Jan 17, 2024
4d20003
fix(scopes): Inspect all responses for schemas
nickvergessen Jan 17, 2024
ed40c15
fix(scopes): Fix counting the routes
nickvergessen Jan 17, 2024
79517db
fix(scopes): Fix empty path arrays
nickvergessen Jan 17, 2024
443740f
fix(schemas): Make sure schemas are always a dictionary
nickvergessen Jan 17, 2024
a479a34
fix(scopes): Don't generate "full" scope when there is none
nickvergessen Jan 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(tags): Panic when the tags are not an array list
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Jan 17, 2024
commit 5d78669d873abb73ce55bf01219c60dfbc822cc9
8 changes: 2 additions & 6 deletions src/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use PhpParser\Node\Arg;
use PhpParser\Node\AttributeGroup;
use PhpParser\Node\Expr\Array_;
use PhpParser\Node\Expr\ArrayItem;
use PhpParser\Node\Expr\ClassConstFetch;
use PhpParser\Node\Scalar\String_;
use PhpParser\Node\Stmt\Class_;
Expand Down Expand Up @@ -232,12 +231,11 @@ public static function getOpenAPIAttributeTagsByScope(ClassMethod|Class_|Node $n
}

if (!$arg->value instanceof Array_) {

continue;
Logger::panic($routeName, 'Can not read value of tags provided in OpenAPI attribute for route ' . $routeName);
}

foreach ($arg->value->items as $item) {
if ($item instanceof ArrayItem && $item->value instanceof String_) {
if ($item?->value instanceof String_) {
$foundTags[] = $item->value->value;
}
}
Expand All @@ -246,8 +244,6 @@ public static function getOpenAPIAttributeTagsByScope(ClassMethod|Class_|Node $n
if (!empty($foundTags)) {
$tags[$foundScopeName ?: $defaultScope] = $foundTags;
}


}
}
}
Expand Down