NAME

Data::Sah::From::JSONSchema - Convert JSON schema to Sah schema

VERSION

This document describes version 0.02 of Data::Sah::From::JSONSchema (from Perl distribution Data-Sah-From-JSONSchema), released on 2015-09-06.

SYNOPSIS

use Data::Sah::From::JSONSchema qw(convert_json_schema_to_sah);

my $jsonsch = {
    description => "a representation of a person, company, organization, or place",
    type => "object",
    required => [qw/familyName givenName/],
    properties => {
        fn => {
            description => "formatted name",
            type => "string",
        },
        familyName => {type => "string"},
        givenName => {type => "string"},
    },
};
my $sahsch = convert_json_schema_to_sah($jsonsch);

# $sahsch will contain something like:
# [hash => {
#     description => "a representation of a person, company, organization, or place",
#     req_keys => ['familyName', 'givenName'],
#     keys => {
#         fn => [str => {
#             description => "formatted name",
#             req => 1,
#         }],
#         familyName => ['str', {req=>1}],
#         givenName => ['str', {req=>1}],
#     },
# }]

DESCRIPTION

EARLY DEVELOPMENT, EXPERIMENTAL.

Some features are not yet supported: $ref, $schema, id, array's uniqueItems, and so on.

FUNCTIONS

convert_json_schema_to_sah($jsonsch) => ARRAY

Convert JSON schema in $jsonsch (which must be a hash), to a Sah schema. Dies on failure.

SEE ALSO

http://json-schema.org/

Sah, Data::Sah

Implementation of JSON Schema in Perl: JSON::Schema

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Data-Sah-From-JSONSchema.

SOURCE

Source repository is at https://github.com/perlancar/perl-Data-Sah-From-JSONSchema.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Sah-From-JSONSchema

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.