docs for ::Validate

This commit is contained in:
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 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 JSON;
use YAML::XS;
use JSON::Schema::Modern;
with 'App::Changelord::Role::Changelog';
option json => (
is => 'ro',
default => 0,
@ -24,7 +30,7 @@ sub run($self) {
my $result = JSON::Schema::Modern->new(
output_format => 'detailed',
)->evaluate(
$self->parent_command->changelog,
$self->changelog,
YAML::XS::Load($schema),
);

View File

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