Skip to content

Commit 369661c

Browse files
committed
remove setting to (not) read_schema
We always need to read the schema, so now we always do.
1 parent aebd312 commit 369661c

14 files changed

Lines changed: 5 additions & 113 deletions

File tree

eg/meet-space/myapp.pl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,13 @@
6868

6969
use Yancy::Backend::Sqlite;
7070
my $backend = Yancy::Backend::Sqlite->new($db);
71-
$backend->read_schema;
72-
# XXX: Should not have to read_schema on backend
7371

7472
use Yancy::Model;
7573
my $db_model = Yancy::Model->new(
7674
backend => $backend,
7775
schema => \%model_schema,
7876
);
79-
8077
unshift @{ $db_model->namespaces }, 'MyApp';
81-
# XXX: Should not have to re-read schema after adjusting namespaces
82-
$db_model->read_schema;
8378

8479
use Yancy::Content;
8580
my $content = Yancy::Content->new(backend => $backend);

lib/Mojolicious/Plugin/Yancy.pm

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,6 @@ sub register {
184184
# That allows for easier extending/replacing of them.
185185
# Almost everything in here should be a delegated plugin...
186186

187-
# New default for read_schema is on, since it mostly should be
188-
# on. Any real-world database is going to be painstakingly tedious
189-
# to type out in JSON schema...
190-
$config->{read_schema} //= 1;
191-
192187
# Load the model
193188
# XXX: This should be Yancy::Plugin::Model
194189
$config = { %$config };
@@ -198,7 +193,6 @@ sub register {
198193
$model = $class->new(
199194
backend => $config->{backend},
200195
log => $app->log,
201-
( read_schema => $config->{read_schema} )x!!exists $config->{read_schema},
202196
schema => $config->{schema},
203197
);
204198
}

lib/Yancy/Backend.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ sub query_p { ... }
400400
my $schema = $be->read_schema;
401401
my $table = $be->read_schema( $table_name );
402402
403-
Read the schema from the database tables. Returns an OpenAPI schema
403+
Read the schema from the database tables. Returns a JSON Schema
404404
ready to be merged into the user's configuration. Can be restricted
405405
to only a single table.
406406

lib/Yancy/Backend/Dbic.pm

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ our $VERSION = '1.089';
88
use Mojolicious::Lite;
99
plugin Yancy => {
1010
backend => 'dbic://My::Schema/dbi:Pg:localhost',
11-
read_schema => 1,
1211
};
1312
1413
### DBIx::Class::Schema object
1514
use Mojolicious::Lite;
1615
use My::Schema;
1716
plugin Yancy => {
1817
backend => { Dbic => My::Schema->connect( 'dbi:SQLite:myapp.db' ) },
19-
read_schema => 1,
2018
};
2119
2220
### Arrayref
@@ -31,7 +29,6 @@ our $VERSION = '1.089';
3129
{ PrintError => 1 },
3230
],
3331
},
34-
read_schema => 1,
3532
};
3633
3734
=head1 DESCRIPTION

lib/Yancy/Backend/Mysql.pm

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ our $VERSION = '1.089';
88
use Mojolicious::Lite;
99
plugin Yancy => {
1010
backend => 'mysql:///mydb',
11-
read_schema => 1,
1211
};
1312
1413
### Mojo::mysql object
1514
use Mojolicious::Lite;
1615
use Mojo::mysql;
1716
plugin Yancy => {
1817
backend => { Mysql => Mojo::mysql->new( 'mysql:///mydb' ) },
19-
read_schema => 1,
2018
};
2119
2220
### Hash reference
@@ -29,7 +27,6 @@ our $VERSION = '1.089';
2927
password => 'b3nd3r1sgr34t',
3028
},
3129
},
32-
read_schema => 1,
3330
};
3431
3532
=head1 DESCRIPTION

lib/Yancy/Backend/Pg.pm

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ our $VERSION = '1.089';
88
use Mojolicious::Lite;
99
plugin Yancy => {
1010
backend => 'pg://user:pass@localhost/mydb',
11-
read_schema => 1,
1211
};
1312
1413
### Mojo::Pg object
1514
use Mojolicious::Lite;
1615
use Mojo::Pg;
1716
plugin Yancy => {
1817
backend => { Pg => Mojo::Pg->new( 'postgres:///myapp' ) },
19-
read_schema => 1,
2018
};
2119
2220
### Hashref
@@ -29,7 +27,6 @@ our $VERSION = '1.089';
2927
password => 'b3nd3r1sgr34t',
3028
},
3129
},
32-
read_schema => 1,
3330
};
3431
3532

lib/Yancy/Backend/Sqlite.pm

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ our $VERSION = '1.089';
88
use Mojolicious::Lite;
99
plugin Yancy => {
1010
backend => 'sqlite:data.db',
11-
read_schema => 1,
1211
};
1312
1413
### Mojo::SQLite object
1514
use Mojolicious::Lite;
1615
use Mojo::SQLite;
1716
plugin Yancy => {
1817
backend => { Sqlite => Mojo::SQLite->new( 'sqlite:data.db' ) },
19-
read_schema => 1,
2018
};
2119
2220
### Hashref
@@ -27,7 +25,6 @@ our $VERSION = '1.089';
2725
dsn => 'sqlite:data.db',
2826
},
2927
},
30-
read_schema => 1,
3128
};
3229
3330
=head1 DESCRIPTION

lib/Yancy/Guides/Cookbook.pod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ to handle the form before the final action is called.
4747
# Download this example: https://github.com/preaction/Yancy/tree/master/eg/cookbook/custom-filter-lite.pl
4848
use Mojolicious::Lite -signatures;
4949
# Download log.sqlite3: https://github.com/preaction/Yancy/tree/master/eg/cookbook/log.sqlite3
50-
plugin Yancy => { backend => 'sqlite:log.sqlite3', read_schema => 1 };
50+
plugin Yancy => { backend => 'sqlite:log.sqlite3' };
5151
under sub( $c ) {
5252
my $levels = $c->every_param( 'log_level' );
5353
if ( @$levels ) {
@@ -105,7 +105,6 @@ Then, we can call the action we want to end up at (in this case, the
105105
# Download log.db: http://github.com/preaction/Yancy/tree/master/eg/cookbook/log.sqlite3
106106
$self->plugin( Yancy => {
107107
backend => 'sqlite:log.sqlite3',
108-
read_schema => 1,
109108
} );
110109

111110
$self->routes->get( '/' )->to(

lib/Yancy/Guides/Schema.pod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use Mojolicious::Lite;
77
plugin Yancy => {
88
backend => 'pg://localhost/myapp',
9-
read_schema => 1,
109
schema => {
1110
users => {
1211
title => 'Users',

lib/Yancy/I18N/en.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ our %Lexicon = (
6969

7070
# Error description used when Yancy could not find any schemas to
7171
# manage (HTML allowed)
72-
'No Schema Configured description' => 'Please configure your data schema, or have Yancy scan your database by setting <code>read_schema =&gt; 1</code>.',
72+
'No Schema Configured description' => 'Please configure your data schema.',
7373

7474
# Error title used when Yancy could not fetch the API specification
7575
'Error Fetching API Spec' => 'Error Fetching API Spec',

0 commit comments

Comments
 (0)