-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
It's rather a question than an error (maybe missing documentation?). I'm a bloody newbie on Swagger and on integrating swagger into catalyst - therefore bare with me ... ;-)
I tried to run your example within my current catalyst environment:
package MyProject::Controller::TestSwagger;
use base 'Catalyst::Controller::Swagger';
use Swagger qw(add_meta);
__PACKAGE__->config(
'default' => 'application/json',
'stash_key' => 'rest',
'map' => {
'text/html' => [ 'View', 'TT', ],
'text/xml' => 'XML::Simple',
'application/json' => 'JSON'
},
'swagger' => {
'api_version' => '0.0.1',
'info' => {
'title' => 'test project',
'description' => 'test description',
},
}
);
add_meta {
action => 'test_one',
params => [
{ name => 'start', type => 'integer' }
],
};
sub test_one_base :Chained('/') :PathPart('test_one') :CaptureArgs(2) {
my ( $self, $c ) = @_;
}
sub test_one :Chained('test_one_base') :PathPart('foo') :Args(1) :Swagger {
my ($self, $c) = @_;
$c->response->body("test_one");
}
# A swagger route can be flagged to be swagger with the :Swagger attribute
sub test_two :Local :Swagger {
my ($self, $c) = @_;
$c->response->body('test_two');
}
1;
Doing so everything starts up without errors - and additional pathspecs are provided (/testswagger/api_docs/... , /testswagger/test_two/..., /test_one/*/*/foo/*)
Opening the page http://127.0.0.1:3001/testswagger/api_docsin my browser, I get the error:
Caught exception in BDBInfo2::Controller::TestSwagger->api_docs "A base path must be supplied in the configuration at D:/Usr/programme/Strawberry/perl/site/lib/Swagger/V12.pm line 40."
Any idea what's wrong? Maybe the given example might be expanded to address this ...
Metadata
Metadata
Assignees
Labels
No labels