docs for ::Validate

releases
Yanick Champoux 2022-07-25 12:02:24 -04:00
parent ec4fee9e69
commit 92d3e10756
2 changed files with 19 additions and 11 deletions

View File

@ -3,13 +3,19 @@ package App::Changelord::Command::Validate;
use 5.36.0; use 5.36.0;
use Moo; use Moo;
use CLI::Osprey; use CLI::Osprey
doc => 'validate the changelog yaml',
description_pod => <<'END';
Validate the changelog against the JSON Schema used by changelord.
END
use Path::Tiny; use Path::Tiny;
use JSON; use JSON;
use YAML::XS; use YAML::XS;
use JSON::Schema::Modern; use JSON::Schema::Modern;
with 'App::Changelord::Role::Changelog';
option json => ( option json => (
is => 'ro', is => 'ro',
default => 0, default => 0,
@ -24,7 +30,7 @@ sub run($self) {
my $result = JSON::Schema::Modern->new( my $result = JSON::Schema::Modern->new(
output_format => 'detailed', output_format => 'detailed',
)->evaluate( )->evaluate(
$self->parent_command->changelog, $self->changelog,
YAML::XS::Load($schema), YAML::XS::Load($schema),
); );

View File

@ -42,16 +42,18 @@ properties:
- type: object - type: object
additionalProperties: false additionalProperties: false
properties: properties:
version: { type: string } version: { type: [ 'null', string ] }
date: { type: ['null',string] } date: { type: ['null',string] }
changes: { type: 'array', items: { $ref: '#/$defs/change' } } changes: { type: 'array', items: { $ref: '#/$defs/change' } }
$defs: $defs:
change: change:
type: object oneOf:
required: [ desc ] - type: string
additionalProperties: false - type: object
properties: required: [ desc ]
desc: { type: string } additionalProperties: false
ticket: { type: [ string, 'null' ] } properties:
type: { type: [ string, 'null' ] } desc: { type: string }
commit: { type: [ string, 'null' ] } ticket: { type: [ string, 'null' ] }
type: { type: [ string, 'null' ] }
commit: { type: [ string, 'null' ] }