| 1 | package Sah::Schema::cpan::meta20; | ||
| 2 | |||
| 3 | 1 | our $schema = ['hash', { | |
| 4 | summary => 'CPAN Meta specification 2.0', | ||
| 5 | req_keys => [qw/abstract author dynamic_config generated_by license meta-spec name release_status version/], | ||
| 6 | re_keys => { | ||
| 7 | |||
| 8 | # sorted alphabetically | ||
| 9 | |||
| 10 | '^[Xx]_' => ['any', {}, {}], | ||
| 11 | |||
| 12 | '^abstract$' => ['str', {req=>1}, {}], | ||
| 13 | |||
| 14 | '^author$' => ['array', { | ||
| 15 | req => 1, | ||
| 16 | min_len => 1, | ||
| 17 | of => ['str', { | ||
| 18 | req => 1, | ||
| 19 | |||
| 20 | match => '^\S.* <.+@.+>$', | ||
| 21 | "match.err_level" => "warn", | ||
| 22 | "match.err_msg" => "preferred format is author-name <email-address>", | ||
| 23 | }, {}], | ||
| 24 | }, {}], | ||
| 25 | |||
| 26 | '^build_requires$' => ['cpan::meta20::prereq', { | ||
| 27 | forbidden => 1, | ||
| 28 | "forbidden.err_level" => "warn", | ||
| 29 | "forbidden.err_msg" => "build_requires is deprecated in spec 2 and has been replaced by prereqs", | ||
| 30 | }, {}], | ||
| 31 | |||
| 32 | '^configure_requires$' => ['cpan::meta20::prereq', { | ||
| 33 | forbidden => 1, | ||
| 34 | "forbidden.err_level" => "warn", | ||
| 35 | "forbidden.err_msg" => "configure_requires is deprecated in spec 2 and has been replaced by prereqs", | ||
| 36 | }, {}], | ||
| 37 | |||
| 38 | '^conflicts$' => ['cpan::meta20::prereq', { | ||
| 39 | forbidden => 1, | ||
| 40 | "forbidden.err_level" => "warn", | ||
| 41 | "forbidden.err_msg" => "conflicts is deprecated in spec 2 and has been replaced by prereqs", | ||
| 42 | }, {}], | ||
| 43 | |||
| 44 | '^description$' => ['str', {req=>1}, {}], | ||
| 45 | |||
| 46 | '^distribution_type$' => ['str', { | ||
| 47 | req => 1, | ||
| 48 | in => ['module', 'script'], | ||
| 49 | |||
| 50 | forbidden => 1, | ||
| 51 | "forbidden.err_level" => 'warn', | ||
| 52 | "forbidden.err_msg" => 'distribution_type is deprecated in spec 2 since it is meaningless for many distributions which are hybrid or modules and scripts', | ||
| 53 | }, {}], | ||
| 54 | |||
| 55 | '^dynamic_config$' => ['bool', {req=>1}, {}], | ||
| 56 | |||
| 57 | '^generated_by$' => ['str', {req=>1}, {}], | ||
| 58 | |||
| 59 | '^keywords$' => ['array', {req=>1, of => ['str', {req=>1, match=>'^\S+$'}, {}]}, {}], | ||
| 60 | |||
| 61 | '^license$' => ['array', {req=>1, of => ['cpan::meta20::license', {req=>1}, {}]}, {}], | ||
| 62 | |||
| 63 | '^license_uri$' => ['str', { | ||
| 64 | forbidden => 1, | ||
| 65 | "forbidden.err_level" => 'warn', | ||
| 66 | "forbidden.err_msg" => 'license_uri is deprecated in 1.2 and has been replaced by license in resources', | ||
| 67 | }, {}], | ||
| 68 | |||
| 69 | '^meta-spec$' => ['hash', { | ||
| 70 | req => 1, | ||
| 71 | req_keys => [qw/version/], | ||
| 72 | keys => { | ||
| 73 | version => ['float', {req=>1, is=>2}, {}], | ||
| 74 | url => ['str', {req=>1}, {}], | ||
| 75 | }, | ||
| 76 | }, {}], | ||
| 77 | |||
| 78 | '^name$' => ['perl::distname', {req=>1}, {}], | ||
| 79 | |||
| 80 | '^no_index$' => ['cpan::meta20::no_index', {req=>1}, {}], | ||
| 81 | |||
| 82 | '^optional_features$' => ['hash', { | ||
| 83 | req => 1, | ||
| 84 | each_value => ['cpan::meta20::optional_feature', {req=>1}, {}], | ||
| 85 | }, {}], | ||
| 86 | |||
| 87 | '^prereqs$' => ['cpan::meta20::prereqs', {req=>1}, {}], | ||
| 88 | |||
| 89 | '^private$' => ['cpan::meta20::no_index', { | ||
| 90 | forbidden => 1, | ||
| 91 | "forbidden.err_level" => 'warn', | ||
| 92 | "forbidden.err_msg" => "private is deprecated in spec 1.2 and has been renamed to no_index", | ||
| 93 | }, {}], | ||
| 94 | |||
| 95 | '^provides$' => ['hash', { | ||
| 96 | req => 1, | ||
| 97 | each_key => ['perl::modname', {req=>1}, {}], | ||
| 98 | each_value => ['hash', { | ||
| 99 | req => 1, | ||
| 100 | req_keys => [qw/file version/], | ||
| 101 | keys => { | ||
| 102 | file => ['str', {req=>1}, {}], | ||
| 103 | version => ['cpan::meta20::version', {req=>1}, {}], | ||
| 104 | }, | ||
| 105 | }, {}], | ||
| 106 | }, {}], | ||
| 107 | |||
| 108 | '^recommends$' => ['cpan::meta20::prereq', { | ||
| 109 | forbidden => 1, | ||
| 110 | "forbidden.err_level" => "warn", | ||
| 111 | "forbidden.err_msg" => "recommends is deprecated in spec 2 and has been replaced by prereqs", | ||
| 112 | }, {}], | ||
| 113 | |||
| 114 | '^release_status$' => ['cpan::meta20::release_status', {req=>1}, {}], | ||
| 115 | |||
| 116 | '^requires$' => ['cpan::meta20::prereq', { | ||
| 117 | forbidden => 1, | ||
| 118 | "forbidden.err_level" => "warn", | ||
| 119 | "forbidden.err_msg" => "requires is deprecated in spec 2 and has been replaced by prereqs", | ||
| 120 | }, {}], | ||
| 121 | |||
| 122 | '^resources$' => ['hash', { | ||
| 123 | req => 1, | ||
| 124 | allowed_keys => [qw/homepage license bugtracker repository/], | ||
| 125 | each_value => ['cpan::meta20::resource'], | ||
| 126 | }, {}], | ||
| 127 | |||
| 128 | '^version$' => ['cpan::meta20::version', {req=>1}, {}], | ||
| 129 | |||
| 130 | }, # re_keys | ||
| 131 | |||
| 132 | # XXX if version contains underscore, release_status must not be stable | ||
| 133 | }, {}]; | ||
| 134 | |||
| 135 | 1 | 1; | |
| 136 | # ABSTRACT: | ||
| 137 | |||
| 138 | __END__ |