tobyink / p5-json-schema

1 stars 4 forks source link

keyword "required" not used like documented in latest json schema #5

Closed nicolasfranck closed 9 years ago

nicolasfranck commented 10 years ago

According to the latest specification of JSON-Schema, one can require the existance of some keys like this:

{
        "title": "Example Schema",
        "type": "object",
        "properties": {
                "firstName": {
                        "type": "string"
                },
                "lastName": {
                        "type": "string"
                },
                "age": {
                        "description": "Age in years",
                        "type": "integer",
                        "minimum": 0
                }
        },
        "required": ["firstName", "lastName"]
}

But this "required" is not supported in your module in this way. Your module does it like this:

..
"lastName": {
   "type": "string",
   "required": 1
}
..

Cf. http://json-schema.org/examples.html

Are you using an older version of the specification? Doesn't matter if it is older. But I just need to know what version is supported, so I can document it.

It seems like you're using draft-03:

http://json-schema.org/draft-03/schema

where "required" is a boolean, and applies to the object being described, instead of

http://json-schema.org/draft-04/schema

where "required" is an array, that lists the required properties for the object being described.

Thanks in advance

Relequestual commented 9 years ago

The module currently only supports draft 3.

nicolasfranck commented 9 years ago

Thanks!

Relequestual commented 9 years ago

I'm hoping to complete draft 3 support (some parts are missing), and then update it to draft 4. It seems like the original developer has vanished. Luckily I've been eyeing this project up for some time, and managed to get added as a maintainer on PAUSE before he vanished.

nicolasfranck commented 9 years ago

Ah! I'm happy someone has the guts to proceed on this project. Thanks!

Relequestual commented 9 years ago

Can't make any promise on timescale... learning how distributions work with cpan...

nicolasfranck commented 9 years ago

milla can help you out:

http://search.cpan.org/~miyagawa/Dist-Milla-v1.0.15/lib/Dist/Milla/Tutorial.pod

Relequestual commented 9 years ago

Thanks. It's been suggested I use dzil, but this potentially looks preferable as a layer ontop of crazy.

nicolasfranck commented 9 years ago

It uses Dist::Zilla under the hood, but makes a lot of preassumptions to make things more easily, and keep configuration to an absolute minimum.