diff --git a/doc/01-sensible-defaults.md b/doc/01-sensible-defaults.md index ec1376f..bfd6942 100644 --- a/doc/01-sensible-defaults.md +++ b/doc/01-sensible-defaults.md @@ -23,8 +23,28 @@ Your modules and classes would, of course, follow the same structure: `API::V1:: `API::V1::Post::Operation::Create` and so on and so forth. If you adhere to this structure, the gem will be able to locate all of your classes without explicit -configuration (i.e. no `#policy` or `#contract` calls etc.). +configuration (i.e. no `#policy` or `#contract` calls etc.). This will save you a lot of time and is +highly recommended, especially when used in conjunction with the provided CRUD operations. -This will save you a lot of time and is highly recommended, especially when used in conjunction with -the provided CRUD operations. If no policy or contract are specified, then the provided operations -will simply skip the authorization/validation step. +To leverage automatic discovery, include `Pragma::Operation::Defaults` in your operation: + +```ruby +module API + module V1 + module Post + module Operation + class Create < Pragma::Operation::Base + include Pragma::Operation::Defaults + + def call + # You can use `decorate`, `validate` and `authorize` without having to explicitly + # specify the decorator, validator and policy classes. + # + # ... + end + end + end + end + end +end +```