preaction / Yancy

The Best Web Framework Deserves the Best Content Management System
http://preaction.me/yancy/
Other
54 stars 21 forks source link

Editor plugin uses deprecated api_controller config value #116

Closed mario-minati closed 4 years ago

mario-minati commented 4 years ago

In Mojolicious::Plugin::Yancy there still seems the deprecated api_controller variable in use to initialize the editor plugin:

   if ( !exists $config->{editor} || defined $config->{editor} ) {
        $app->yancy->plugin( 'Editor' => {
            (
                map { $_ => $config->{ $_ } }
                grep { defined $config->{ $_ } }
                qw( route openapi schema api_controller info host return_to ),
            ),
            %{ $config->{editor} // {} },
        } );
    }

Should that be changed to default_controller?

preaction commented 4 years ago

Yes, definitely. api_controller should still be supported until v2, but internally it should not be used. Also, it should be giving warnings (or maybe it is and I haven't noticed somehow...)

mario-minati commented 4 years ago

Ok. Currently the usage is not purely internal, it uses the config from Mojolicious::Plugin::Yancy, maybe the code should currently support both values api_controller and default_controller.

preaction commented 4 years ago

Actually I figured out why I did that: Specifying api_controller in the top level of the Yancy configuration is also discouraged: The primary editor is configured through the editor key. I'll add a comment and a deprecation message so I don't forget again :p