Skip to content

Commit 5260d43

Browse files
committed
Add documentation about schema location
1 parent 9123d35 commit 5260d43

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/Whelk/Schema.pm

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,19 @@ its input before using it, some nested parts of C<%common_fields> may get
200200
changed or blessed. Don't rely on its contents being exactly as you defined it,
201201
or deep-clone it yourself before passing it to Whelk.
202202
203+
=head2 Where to define the schemas?
204+
205+
It is not important where your schemas are defined, as long as they are defined
206+
before they are used. Whelk provides C<schemas> method as syntax sugar, which
207+
will be called just once for each controller. That does not mean schemas must
208+
be defined there, they may as well be called at the package level (during
209+
package compilation) or anywhere else.
210+
211+
You can use it to your advantage when creating schemas which should be used for
212+
the entire application, not just for one controller. It can safely be put in a
213+
separate package, or even in the C<app.psgi> itself (even though it's surely
214+
not a good place to keep them).
215+
203216
=head2 Available types
204217
205218
Each new schema must have a C<type> defined. All types share these common configuration values:

0 commit comments

Comments
 (0)