Skip to content
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

Tags created with <null> description in swagger file #51

Closed
beccon4 opened this issue Oct 17, 2018 · 0 comments
Closed

Tags created with <null> description in swagger file #51

beccon4 opened this issue Oct 17, 2018 · 0 comments

Comments

@beccon4
Copy link

beccon4 commented Oct 17, 2018

Raisin automatically creates tags for route parameters and subsequent resources. Unfortunately the swagger file comes out with an empty description - or null which causes an error in the Swagger editor:

This code:

use strict;
use warnings;
use Carp;

use HTTP::Status qw(:constants);

use Data::Dumper;
use Raisin::API;
use Types::Standard qw(HashRef Any Int Str);

plugin 'Logger', fallback => 1;
app->log(debug => 'Start');
api_format 'json';

middleware 'CrossOrigin',
    origins => q(*),
    methods => [qw/DELETE GET HEAD OPTIONS PATCH POST PUT/],
    headers => [qw/accept authorization content-type api_key_token/];
plugin 'Swagger';

swagger_setup(
    title       => 'Test Raisin Api',
    description => 'TestRaisin',
    contact     => {
        name  => 'Conrad Beckert',
        url   => 'http://beccon.de',
        email => 'info@beccon.de',
    },

    license => {
        name => 'Testmich - darf alles',
        url  => 'http://www.testmich.de',
    },
);

desc 'Users API';

resource cm => sub {
    summary 'cm sub';

    params requires('mac', type => Str);
    route_param mac => sub {
        desc 'route param desc';
        summary 'route param summary';
        resource 'foo' => sub {

            desc "foo desc";
            get sub {
                desc "foo get desc";
                my $params = shift;
                my $mac    = $params->{mac};

                res->status(HTTP_OK);
                return { hallo => $mac };
            };
            }
    };

    };

    run;

__END__

produces:

`tags:

  • name: ':mac'
    description: null
    `

Which the Swagger Editor marks as error.

@khrt khrt closed this as completed in 343a4cb Oct 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant