problem with route /aroute/$var<[0-9]+> matches /aroute/123 but also /aroute/123A
Checking this it just uses te uri parameter as input for the sqlallrows
Hi, could you try to use /aroute/$var<^[0-9]+$> as route, this basically means that the start and end of the value must only contain 9-0 characters.
as soon as i set begin and and end
<^[0-9]+$> ( lots of digits )
<\A[0-9]{1,2}\z> ( 1 or 2 digits )
and try \aroute\1a \aroute\1234 ( to check the 2nd ) I get an InvalidPathException as expected
But with \aroute\1 i dont dont get the InvalidPathException. But the rest of the handling goes wrong : And get the following error:
{
"success": false,
"title": "PSX\\Http\\Exception\\InternalServerErrorException",
"message": "No specification available in D:\\Sites\\fusio\\vendor\\psx\\framework\\src\\Controller\\SchemaApiAbstract.php on line 83",
"trace": "#0 D:\\Sites\\fusio\\vendor\\psx\\framework\\src\\Controller\\ControllerAbstract.php(144): PSX\\Framework\\Controller\\SchemaApiAbstract->onLoad()
#1 D:\\Sites\\fusio\\vendor\\psx\\http\\src\\Filter\\FilterChain.php(110): PSX\\Framework\\Controller\\ControllerAbstract->handle()
#2 D:\\Sites\\fusio\\vendor\\fusio\\impl\\src\\Controller\\Filter\\Logger.php(68): PSX\\Http\\Filter\\FilterChain->handle()
#3 D:\\Sites\\fusio\\vendor\\psx\\http\\src\\Filter\\FilterChain.php(110): Fusio\\Impl\\Controller\\Filter\\Logger->handle()
#4 D:\\Sites\\fusio\\vendor\\fusio\\impl\\src\\Controller\\Filter\\RequestLimit.php(74): PSX\\Http\\Filter\\FilterChain->handle()
#5 D:\\Sites\\fusio\\vendor\\psx\\http\\src\\Filter\\FilterChain.php(110): Fusio\\Impl\\Controller\\Filter\\RequestLimit->handle()
#6 D:\\Sites\\fusio\\vendor\\fusio\\impl\\src\\Controller\\Filter\\Authentication.php(66): PSX\\Http\\Filter\\FilterChain->handle()
#7 D:\\Sites\\fusio\\vendor\\psx\\http\\src\\Filter\\FilterChain.php(110): Fusio\\Impl\\Controller\\Filter\\Authentication->handle()
#8 D:\\Sites\\fusio\\vendor\\fusio\\impl\\src\\Controller\\Filter\\AssertMethod.php(99): PSX\\Http\\Filter\\FilterChain->handle()
#9 D:\\Sites\\fusio\\vendor\\psx\\http\\src\\Filter\\FilterChain.php(110): Fusio\\Impl\\Controller\\Filter\\AssertMethod->handle()
#10 D:\\Sites\\fusio\\vendor\\psx\\http\\src\\Filter\\UserAgentEnforcer.php(43): PSX\\Http\\Filter\\FilterChain->handle()
#11 D:\\Sites\\fusio\\vendor\\psx\\http\\src\\Filter\\FilterChain.php(110): PSX\\Http\\Filter\\UserAgentEnforcer->handle()
#12 D:\\Sites\\fusio\\vendor\\psx\\http\\src\\Filter\\CORS.php(107): PSX\\Http\\Filter\\FilterChain->handle()
#13 D:\\Sites\\fusio\\vendor\\psx\\http\\src\\Filter\\FilterChain.php(110): PSX\\Http\\Filter\\CORS->handle()
#14 D:\\Sites\\fusio\\vendor\\psx\\framework\\src\\Loader\\Loader.php(123): PSX\\Http\\Filter\\FilterChain->handle()
#15 D:\\Sites\\fusio\\vendor\\psx\\framework\\src\\Loader\\Loader.php(102): PSX\\Framework\\Loader\\Loader->execute()
#16 D:\\Sites\\fusio\\vendor\\psx\\framework\\src\\Dispatch\\Dispatch.php(126): PSX\\Framework\\Loader\\Loader->load()
#17 D:\\Sites\\fusio\\vendor\\psx\\engine\\src\\WebServer\\Engine.php(58): PSX\\Framework\\Dispatch\\Dispatch->route()
#18 D:\\Sites\\fusio\\vendor\\psx\\framework\\src\\Environment\\Environment.php(70): PSX\\Engine\\WebServer\\Engine->serve()
#19 D:\\Sites\\fusio\\public\\index.php(28): PSX\\Framework\\Environment\\Environment->serve()
#20 {main}",
"context": "79
80 \/\/ get the current specification based on the context
81 $specification = $this->resourceListing->find($this->context->getPath(), $this->context->getVersion());
82 if (!$specification instanceof SpecificationInterface) {
<b>83 throw new StatusCode\\InternalServerErrorException('No specification available');
<\/b>84 }
85
86 $resource = $specification->getResourceCollection()->get($this->context->getPath());
87 if (!$resource instanceof Resource) {
"
}
@chriskapp is this not a 'bug' instead of a 'question' ?
Maybe to set the scheme for URI Paramater
Open API
parameters:
- name: id
in: path
required: true
schema:
type: integer
Hey @mmaateurol yes you are right this is indeed a bug, probably we should automatically add the ^[regex]$ around the regex, which should then solve the problem. but we need to check whats the best way to fix this. Regarding the type for the spec, currently an variable uri fragment is always a string since it is difficult to detect the correct type based on the used regex but maybe there is a solution for such a problem.