json_skooma 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +22 -0
- data/LICENSE.txt +21 -0
- data/README.md +107 -0
- data/data/draft-2019-09/README.md +60 -0
- data/data/draft-2019-09/hyper-schema.json +26 -0
- data/data/draft-2019-09/links.json +91 -0
- data/data/draft-2019-09/meta/applicator.json +56 -0
- data/data/draft-2019-09/meta/content.json +17 -0
- data/data/draft-2019-09/meta/core.json +57 -0
- data/data/draft-2019-09/meta/format.json +14 -0
- data/data/draft-2019-09/meta/hyper-schema.json +29 -0
- data/data/draft-2019-09/meta/meta-data.json +37 -0
- data/data/draft-2019-09/meta/validation.json +98 -0
- data/data/draft-2019-09/output/hyper-schema.json +62 -0
- data/data/draft-2019-09/output/schema.json +86 -0
- data/data/draft-2019-09/output/verbose-example.json +130 -0
- data/data/draft-2019-09/schema.json +42 -0
- data/data/draft-2020-12/README.md +89 -0
- data/data/draft-2020-12/adr/README.md +15 -0
- data/data/draft-2020-12/archive/hyper-schema.json +28 -0
- data/data/draft-2020-12/archive/links.json +93 -0
- data/data/draft-2020-12/archive/meta/hyper-schema.json +30 -0
- data/data/draft-2020-12/hyper-schema.json +27 -0
- data/data/draft-2020-12/links.json +85 -0
- data/data/draft-2020-12/meta/applicator.json +48 -0
- data/data/draft-2020-12/meta/content.json +17 -0
- data/data/draft-2020-12/meta/core.json +51 -0
- data/data/draft-2020-12/meta/format-annotation.json +14 -0
- data/data/draft-2020-12/meta/format-assertion.json +14 -0
- data/data/draft-2020-12/meta/hyper-schema.json +29 -0
- data/data/draft-2020-12/meta/meta-data.json +37 -0
- data/data/draft-2020-12/meta/unevaluated.json +15 -0
- data/data/draft-2020-12/meta/validation.json +98 -0
- data/data/draft-2020-12/output/hyper-schema.json +62 -0
- data/data/draft-2020-12/output/schema.json +96 -0
- data/data/draft-2020-12/output/verbose-example.json +130 -0
- data/data/draft-2020-12/schema.json +58 -0
- data/lib/json_skooma/dialects/draft201909.rb +137 -0
- data/lib/json_skooma/dialects/draft202012.rb +146 -0
- data/lib/json_skooma/formatters.rb +135 -0
- data/lib/json_skooma/inflector.rb +13 -0
- data/lib/json_skooma/json_node.rb +100 -0
- data/lib/json_skooma/json_pointer.rb +79 -0
- data/lib/json_skooma/json_schema.rb +176 -0
- data/lib/json_skooma/keywords/applicator/additional_properties.rb +37 -0
- data/lib/json_skooma/keywords/applicator/all_of.rb +25 -0
- data/lib/json_skooma/keywords/applicator/any_of.rb +26 -0
- data/lib/json_skooma/keywords/applicator/contains.rb +31 -0
- data/lib/json_skooma/keywords/applicator/dependent_schemas.rb +35 -0
- data/lib/json_skooma/keywords/applicator/else.rb +22 -0
- data/lib/json_skooma/keywords/applicator/if.rb +17 -0
- data/lib/json_skooma/keywords/applicator/items.rb +36 -0
- data/lib/json_skooma/keywords/applicator/not.rb +19 -0
- data/lib/json_skooma/keywords/applicator/one_of.rb +35 -0
- data/lib/json_skooma/keywords/applicator/pattern_properties.rb +46 -0
- data/lib/json_skooma/keywords/applicator/prefix_items.rb +31 -0
- data/lib/json_skooma/keywords/applicator/properties.rb +34 -0
- data/lib/json_skooma/keywords/applicator/property_names.rb +25 -0
- data/lib/json_skooma/keywords/applicator/then.rb +22 -0
- data/lib/json_skooma/keywords/base.rb +74 -0
- data/lib/json_skooma/keywords/base_annotation.rb +12 -0
- data/lib/json_skooma/keywords/content/content_encoding.rb +12 -0
- data/lib/json_skooma/keywords/content/content_media_type.rb +12 -0
- data/lib/json_skooma/keywords/content/content_schema.rb +19 -0
- data/lib/json_skooma/keywords/core/anchor.rb +22 -0
- data/lib/json_skooma/keywords/core/comment.rb +12 -0
- data/lib/json_skooma/keywords/core/defs.rb +13 -0
- data/lib/json_skooma/keywords/core/dynamic_anchor.rb +22 -0
- data/lib/json_skooma/keywords/core/dynamic_ref.rb +67 -0
- data/lib/json_skooma/keywords/core/id.rb +28 -0
- data/lib/json_skooma/keywords/core/ref.rb +35 -0
- data/lib/json_skooma/keywords/core/schema.rb +26 -0
- data/lib/json_skooma/keywords/core/vocabulary.rb +34 -0
- data/lib/json_skooma/keywords/draft_2019_09/additional_items.rb +40 -0
- data/lib/json_skooma/keywords/draft_2019_09/items.rb +41 -0
- data/lib/json_skooma/keywords/draft_2019_09/recursive_anchor.rb +12 -0
- data/lib/json_skooma/keywords/draft_2019_09/recursive_ref.rb +46 -0
- data/lib/json_skooma/keywords/draft_2019_09/unevaluated_items.rb +56 -0
- data/lib/json_skooma/keywords/format_annotation/format.rb +27 -0
- data/lib/json_skooma/keywords/meta_data/default.rb +11 -0
- data/lib/json_skooma/keywords/meta_data/deprecated.rb +11 -0
- data/lib/json_skooma/keywords/meta_data/description.rb +11 -0
- data/lib/json_skooma/keywords/meta_data/examples.rb +11 -0
- data/lib/json_skooma/keywords/meta_data/read_only.rb +11 -0
- data/lib/json_skooma/keywords/meta_data/title.rb +11 -0
- data/lib/json_skooma/keywords/meta_data/write_only.rb +11 -0
- data/lib/json_skooma/keywords/unevaluated/unevaluated_items.rb +59 -0
- data/lib/json_skooma/keywords/unevaluated/unevaluated_properties.rb +43 -0
- data/lib/json_skooma/keywords/unknown.rb +21 -0
- data/lib/json_skooma/keywords/validation/const.rb +17 -0
- data/lib/json_skooma/keywords/validation/dependent_required.rb +24 -0
- data/lib/json_skooma/keywords/validation/enum.rb +19 -0
- data/lib/json_skooma/keywords/validation/exclusive_maximum.rb +18 -0
- data/lib/json_skooma/keywords/validation/exclusive_minimum.rb +18 -0
- data/lib/json_skooma/keywords/validation/max_contains.rb +24 -0
- data/lib/json_skooma/keywords/validation/max_items.rb +18 -0
- data/lib/json_skooma/keywords/validation/max_length.rb +18 -0
- data/lib/json_skooma/keywords/validation/max_properties.rb +18 -0
- data/lib/json_skooma/keywords/validation/maximum.rb +18 -0
- data/lib/json_skooma/keywords/validation/min_contains.rb +31 -0
- data/lib/json_skooma/keywords/validation/min_items.rb +18 -0
- data/lib/json_skooma/keywords/validation/min_length.rb +18 -0
- data/lib/json_skooma/keywords/validation/min_properties.rb +18 -0
- data/lib/json_skooma/keywords/validation/minimum.rb +18 -0
- data/lib/json_skooma/keywords/validation/multiple_of.rb +20 -0
- data/lib/json_skooma/keywords/validation/pattern.rb +23 -0
- data/lib/json_skooma/keywords/validation/required.rb +19 -0
- data/lib/json_skooma/keywords/validation/type.rb +26 -0
- data/lib/json_skooma/keywords/validation/unique_items.rb +20 -0
- data/lib/json_skooma/keywords/value_schemas.rb +87 -0
- data/lib/json_skooma/memoizable.rb +21 -0
- data/lib/json_skooma/metaschema.rb +32 -0
- data/lib/json_skooma/registry.rb +130 -0
- data/lib/json_skooma/result.rb +125 -0
- data/lib/json_skooma/sources.rb +55 -0
- data/lib/json_skooma/validators/base.rb +31 -0
- data/lib/json_skooma/validators/date.rb +18 -0
- data/lib/json_skooma/validators/date_time.rb +24 -0
- data/lib/json_skooma/validators/duration.rb +25 -0
- data/lib/json_skooma/validators/email.rb +36 -0
- data/lib/json_skooma/validators/hostname.rb +17 -0
- data/lib/json_skooma/validators/idn_email.rb +30 -0
- data/lib/json_skooma/validators/idn_hostname.rb +15 -0
- data/lib/json_skooma/validators/ipv4.rb +20 -0
- data/lib/json_skooma/validators/ipv6.rb +16 -0
- data/lib/json_skooma/validators/iri.rb +47 -0
- data/lib/json_skooma/validators/iri_reference.rb +15 -0
- data/lib/json_skooma/validators/json_pointer.rb +19 -0
- data/lib/json_skooma/validators/regex.rb +15 -0
- data/lib/json_skooma/validators/relative_json_pointer.rb +18 -0
- data/lib/json_skooma/validators/time.rb +32 -0
- data/lib/json_skooma/validators/uri.rb +60 -0
- data/lib/json_skooma/validators/uri_reference.rb +15 -0
- data/lib/json_skooma/validators/uri_template.rb +26 -0
- data/lib/json_skooma/validators/uuid.rb +15 -0
- data/lib/json_skooma/validators.rb +17 -0
- data/lib/json_skooma/version.rb +5 -0
- data/lib/json_skooma/vocabulary.rb +12 -0
- data/lib/json_skooma.rb +39 -0
- metadata +244 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b1be68fa71fa29965063cf60e9bab950139b697e0222371eb8ce1eec8fc5bf95
|
4
|
+
data.tar.gz: 83599b9f53a2d41483f2b700200971088db482d57bccf1ce9cee91d641dc27e6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: '0691050d428ab71fa386697900c51d6322a7ebb7e2086a86c45079fbae4e2d61cf53d799e504dddde6041afae2668cd792f9d0acc195168ceb7cf7eb49643f16'
|
7
|
+
data.tar.gz: ecfe5c2115714a08df92dd5ebcd0ddd723a3636e0fdec668d76f4b0471aab0ef3f33bf0d3ab2a8896f0d479a7f10181024b52e004d70efe26575590a97544b9a
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog],
|
6
|
+
and this project adheres to [Semantic Versioning].
|
7
|
+
|
8
|
+
## [Unreleased]
|
9
|
+
|
10
|
+
## [0.1.0] - 2023-09-27
|
11
|
+
|
12
|
+
### Added
|
13
|
+
|
14
|
+
- Initial implementation. ([@skryukov])
|
15
|
+
|
16
|
+
[@skryukov]: https://github.com/skryukov
|
17
|
+
|
18
|
+
[Unreleased]: https://github.com/skryukov/json_skooma/compare/v0.1.0...HEAD
|
19
|
+
[0.1.0]: https://github.com/skryukov/json_skooma/commits/v0.1.0
|
20
|
+
|
21
|
+
[Keep a Changelog]: https://keepachangelog.com/en/1.0.0/
|
22
|
+
[Semantic Versioning]: https://semver.org/spec/v2.0.0.html
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 Svyatoslav Kryukov
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
# JSONSkooma – Sugar for your JSONs
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/json_skooma.svg)](https://rubygems.org/gems/json_skooma)
|
4
|
+
[![Ruby](https://github.com/skryukov/json_skooma/actions/workflows/main.yml/badge.svg)](https://github.com/skryukov/json_skooma/actions/workflows/main.yml)
|
5
|
+
|
6
|
+
JSONSkooma is a Ruby library for validating JSONs against JSON Schemas.
|
7
|
+
|
8
|
+
### Features
|
9
|
+
|
10
|
+
- Supports JSON Schema 2019-09 and 2020-12
|
11
|
+
- Supports custom dialects, vocabularies, keywords, format validators, output formatters
|
12
|
+
- Supports custom schema resolvers
|
13
|
+
|
14
|
+
<a href="https://evilmartians.com/?utm_source=json_skooma&utm_campaign=project_page">
|
15
|
+
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54">
|
16
|
+
</a>
|
17
|
+
|
18
|
+
## Installation
|
19
|
+
|
20
|
+
Install the gem and add to the application's Gemfile by executing:
|
21
|
+
|
22
|
+
$ bundle add json_skooma
|
23
|
+
|
24
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
25
|
+
|
26
|
+
$ gem install json_skooma
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
require "json_skooma"
|
32
|
+
|
33
|
+
# Create a registry to store schemas, vocabularies, dialects, etc.
|
34
|
+
JSONSkooma.create_registry("2020-12", assert_formats: true)
|
35
|
+
|
36
|
+
# Load a schema
|
37
|
+
schema_hash = {
|
38
|
+
"$schema" => "https://json-schema.org/draft/2020-12/schema",
|
39
|
+
"type" => "object",
|
40
|
+
"properties" => {
|
41
|
+
"name" => {"type" => "string"},
|
42
|
+
"race" => {"enum" => %w[Nord Khajiit Argonian Breton Redguard Dunmer Altmer Bosmer Orc Imperial]},
|
43
|
+
"class" => {"type" => "string"},
|
44
|
+
"level" => {"type" => "integer", "minimum" => 1},
|
45
|
+
"equipment" => {
|
46
|
+
"type" => "array",
|
47
|
+
"items" => {"type" => "string"}
|
48
|
+
}
|
49
|
+
},
|
50
|
+
"required" => %w[name race class level]
|
51
|
+
}
|
52
|
+
|
53
|
+
schema = JSONSkooma::JSONSchema.new(schema_hash)
|
54
|
+
|
55
|
+
data_hash = {
|
56
|
+
name: "Matz",
|
57
|
+
race: "Human",
|
58
|
+
class: "Dragonborn",
|
59
|
+
level: 50,
|
60
|
+
equipment: %w[Ruby],
|
61
|
+
}
|
62
|
+
|
63
|
+
result = schema.evaluate(data_hash)
|
64
|
+
|
65
|
+
result.valid? # => false
|
66
|
+
|
67
|
+
result.output(:basic)
|
68
|
+
# {"valid"=>false,
|
69
|
+
# "errors"=>
|
70
|
+
# [{"instanceLocation"=>"",
|
71
|
+
# "keywordLocation"=>"/properties",
|
72
|
+
# "absoluteKeywordLocation"=>"urn:uuid:f477b6ca-7308-4be6-b88c-e848b9002793#/properties",
|
73
|
+
# "error"=>"Properties [\"race\"] are invalid"},
|
74
|
+
# {"instanceLocation"=>"/race",
|
75
|
+
# "keywordLocation"=>"/properties/race/enum",
|
76
|
+
# "absoluteKeywordLocation"=>"urn:uuid:f477b6ca-7308-4be6-b88c-e848b9002793#/properties/race/enum",
|
77
|
+
# "error"=>
|
78
|
+
# "The instance value \"Human\" must be equal to one of the elements in the defined enumeration: [\"Nord\", \"Khajiit\", \"Argonian\", \"Breton\", \"Redguard\", \"Dunmer\", \"Altmer\", \"Bosmer\", \"Orc\", \"Imperial\"]"}]}
|
79
|
+
```
|
80
|
+
|
81
|
+
## Alternatives
|
82
|
+
|
83
|
+
- [json_schemer](https://github.com/davishmcclurg/json_schemer) – Draft 4, 6, 7, 2019-09 and 2020-12 compliant
|
84
|
+
- [json-schema](https://github.com/voxpupuli/json-schema) – Draft 1, 2, 3, 4 and 6 compliant
|
85
|
+
|
86
|
+
## Feature plans
|
87
|
+
|
88
|
+
- Custom error messages
|
89
|
+
- EcmaScript regexp
|
90
|
+
- Short circuit errors
|
91
|
+
- IRI as schema identifiers
|
92
|
+
- Relative JSONPointer
|
93
|
+
- More unit tests
|
94
|
+
|
95
|
+
## Development
|
96
|
+
|
97
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
98
|
+
|
99
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
100
|
+
|
101
|
+
## Contributing
|
102
|
+
|
103
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/skryukov/json_skooma.
|
104
|
+
|
105
|
+
## License
|
106
|
+
|
107
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# Welcome to JSON Schema
|
2
|
+
|
3
|
+
JSON Schema is a vocabulary that allows you to validate, annotate, and manipulate JSON documents.
|
4
|
+
|
5
|
+
This repository contains the sources for the **work in progress** of the next set of JSON Schema IETF Internet Draft (I-D) documents.
|
6
|
+
For the latest released I-Ds, please see the [Specification page](http://json-schema.org/documentation.html) on the website.
|
7
|
+
|
8
|
+
## Call for contributions and feedback
|
9
|
+
|
10
|
+
Reviews, comments and suggestions are most welcome!
|
11
|
+
Please read our [guidelines for contributing](CONTRIBUTING.md).
|
12
|
+
|
13
|
+
## Status
|
14
|
+
For the current status of issues and pull requests, please see the following labels
|
15
|
+
|
16
|
+
[![Available](https://img.shields.io/github/issues/json-schema-org/json-schema-spec/Status:%20Available.svg?color=brightgreen)](https://github.com/json-schema-org/json-schema-spec/issues?q=is%3Aopen+is%3Aissue+label%3A%22Status%3A+Available%22) [![In Progress](https://img.shields.io/github/issues/json-schema-org/json-schema-spec/Status:%20In%20Progress.svg)](https://github.com/json-schema-org/json-schema-spec/labels/Status:%20In%20Progress) [![Review Needed](https://img.shields.io/github/issues/json-schema-org/json-schema-spec/Status:%20Review%20Needed.svg)](https://github.com/json-schema-org/json-schema-spec/labels/Status%3A%20Review%20Needed)
|
17
|
+
|
18
|
+
[![Critical](https://img.shields.io/github/issues/json-schema-org/json-schema-spec/Priority:%20Critical.svg?color=critical
|
19
|
+
)](https://github.com/json-schema-org/json-schema-spec/labels/Priority%3A%20Critical) [![High](https://img.shields.io/github/issues/json-schema-org/json-schema-spec/Priority:%20High.svg?color=important)](https://github.com/json-schema-org/json-schema-spec/labels/Priority%3A%20High) [![Medium](https://img.shields.io/github/issues/json-schema-org/json-schema-spec/Priority:%20Medium.svg)](https://github.com/json-schema-org/json-schema-spec/labels/Priority%3A%20Medium) [![Low](https://img.shields.io/github/issues/json-schema-org/json-schema-spec/Priority:%20Low.svg)](https://github.com/json-schema-org/json-schema-spec/labels/Priority%3A%20Low)
|
20
|
+
|
21
|
+
|
22
|
+
Labels are assigned based on [Sensible Github Labels](https://github.com/Relequestual/sensible-github-labels).
|
23
|
+
|
24
|
+
## Contents
|
25
|
+
|
26
|
+
* Makefile - scripts to build the Internet-Draft txt/html
|
27
|
+
* _Internet-Draft sources_
|
28
|
+
* jsonschema-core.xml - source for JSON Schema's "core" I-D
|
29
|
+
* jsonschema-validation.xml - source for the validation vocabulary I-D
|
30
|
+
* jsonschema-hyperschema.xml - source for the hyper-schema vocabulary I-D
|
31
|
+
* relative-json-pointer.xml - source for the Relative JSON Pointer I-D
|
32
|
+
* _meta-schemas and recommended output formats_
|
33
|
+
* schema.json - JSON Schema "core" and Validation meta-schema
|
34
|
+
* hyper-schema.json - JSON Hyper-Schema meta-schema
|
35
|
+
* links.json - JSON Hyper-Schema's Link Description Object meta-schema
|
36
|
+
* hyper-schema-output.json - The recommended output format for JSON Hyper-Schema links
|
37
|
+
|
38
|
+
Type "make" at a shell to build the .txt and .html spec files.
|
39
|
+
|
40
|
+
Descriptions of the xml2rfc, I-D documents, and RFC processes:
|
41
|
+
|
42
|
+
* https://xml2rfc.tools.ietf.org/authoring/draft-mrose-writing-rfcs.html
|
43
|
+
* https://www.ietf.org/tao.html
|
44
|
+
* https://www.ietf.org/ietf-ftp/1id-guidelines.html
|
45
|
+
* https://www.rfc-editor.org/rfc/rfc7322.txt
|
46
|
+
|
47
|
+
## Test suites
|
48
|
+
|
49
|
+
Conformance tests for JSON Schema and its vocabularies may be found
|
50
|
+
[in their own repository](https://github.com/json-schema-org/JSON-Schema-Test-Suite).
|
51
|
+
|
52
|
+
## The website
|
53
|
+
|
54
|
+
The JSON Schema web site is at http://json-schema.org/
|
55
|
+
|
56
|
+
The source for the website is [maintained in a separate repository](https://github.com/json-schema-org/json-schema-org.github.io).
|
57
|
+
|
58
|
+
## License
|
59
|
+
|
60
|
+
The source material in this repository is licensed under the AFL or BSD license.
|
@@ -0,0 +1,26 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/draft/2019-09/hyper-schema",
|
3
|
+
"$id": "https://json-schema.org/draft/2019-09/hyper-schema",
|
4
|
+
"$vocabulary": {
|
5
|
+
"https://json-schema.org/draft/2019-09/vocab/core": true,
|
6
|
+
"https://json-schema.org/draft/2019-09/vocab/applicator": true,
|
7
|
+
"https://json-schema.org/draft/2019-09/vocab/validation": true,
|
8
|
+
"https://json-schema.org/draft/2019-09/vocab/meta-data": true,
|
9
|
+
"https://json-schema.org/draft/2019-09/vocab/format": false,
|
10
|
+
"https://json-schema.org/draft/2019-09/vocab/content": true,
|
11
|
+
"https://json-schema.org/draft/2019-09/vocab/hyper-schema": true
|
12
|
+
},
|
13
|
+
"$recursiveAnchor": true,
|
14
|
+
|
15
|
+
"title": "JSON Hyper-Schema",
|
16
|
+
"allOf": [
|
17
|
+
{"$ref": "https://json-schema.org/draft/2019-09/schema"},
|
18
|
+
{"$ref": "https://json-schema.org/draft/2019-09/meta/hyper-schema"}
|
19
|
+
],
|
20
|
+
"links": [
|
21
|
+
{
|
22
|
+
"rel": "self",
|
23
|
+
"href": "{+%24id}"
|
24
|
+
}
|
25
|
+
]
|
26
|
+
}
|
@@ -0,0 +1,91 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
3
|
+
"$id": "https://json-schema.org/draft/2019-09/links",
|
4
|
+
"title": "Link Description Object",
|
5
|
+
"allOf": [
|
6
|
+
{ "required": [ "rel", "href" ] },
|
7
|
+
{ "$ref": "#/$defs/noRequiredFields" }
|
8
|
+
],
|
9
|
+
"$defs": {
|
10
|
+
"noRequiredFields": {
|
11
|
+
"type": "object",
|
12
|
+
"properties": {
|
13
|
+
"anchor": {
|
14
|
+
"type": "string",
|
15
|
+
"format": "uri-template"
|
16
|
+
},
|
17
|
+
"anchorPointer": {
|
18
|
+
"type": "string",
|
19
|
+
"anyOf": [
|
20
|
+
{ "format": "json-pointer" },
|
21
|
+
{ "format": "relative-json-pointer" }
|
22
|
+
]
|
23
|
+
},
|
24
|
+
"rel": {
|
25
|
+
"anyOf": [
|
26
|
+
{ "type": "string" },
|
27
|
+
{
|
28
|
+
"type": "array",
|
29
|
+
"items": { "type": "string" },
|
30
|
+
"minItems": 1
|
31
|
+
}
|
32
|
+
]
|
33
|
+
},
|
34
|
+
"href": {
|
35
|
+
"type": "string",
|
36
|
+
"format": "uri-template"
|
37
|
+
},
|
38
|
+
"hrefSchema": {
|
39
|
+
"$ref": "https://json-schema.org/draft/2019-09/hyper-schema",
|
40
|
+
"default": false
|
41
|
+
},
|
42
|
+
"templatePointers": {
|
43
|
+
"type": "object",
|
44
|
+
"additionalProperties": {
|
45
|
+
"type": "string",
|
46
|
+
"anyOf": [
|
47
|
+
{ "format": "json-pointer" },
|
48
|
+
{ "format": "relative-json-pointer" }
|
49
|
+
]
|
50
|
+
}
|
51
|
+
},
|
52
|
+
"templateRequired": {
|
53
|
+
"type": "array",
|
54
|
+
"items": {
|
55
|
+
"type": "string"
|
56
|
+
},
|
57
|
+
"uniqueItems": true
|
58
|
+
},
|
59
|
+
"title": {
|
60
|
+
"type": "string"
|
61
|
+
},
|
62
|
+
"description": {
|
63
|
+
"type": "string"
|
64
|
+
},
|
65
|
+
"targetSchema": {
|
66
|
+
"$ref": "https://json-schema.org/draft/2019-09/hyper-schema",
|
67
|
+
"default": true
|
68
|
+
},
|
69
|
+
"targetMediaType": {
|
70
|
+
"type": "string"
|
71
|
+
},
|
72
|
+
"targetHints": { },
|
73
|
+
"headerSchema": {
|
74
|
+
"$ref": "https://json-schema.org/draft/2019-09/hyper-schema",
|
75
|
+
"default": true
|
76
|
+
},
|
77
|
+
"submissionMediaType": {
|
78
|
+
"type": "string",
|
79
|
+
"default": "application/json"
|
80
|
+
},
|
81
|
+
"submissionSchema": {
|
82
|
+
"$ref": "https://json-schema.org/draft/2019-09/hyper-schema",
|
83
|
+
"default": true
|
84
|
+
},
|
85
|
+
"$comment": {
|
86
|
+
"type": "string"
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
3
|
+
"$id": "https://json-schema.org/draft/2019-09/meta/applicator",
|
4
|
+
"$vocabulary": {
|
5
|
+
"https://json-schema.org/draft/2019-09/vocab/applicator": true
|
6
|
+
},
|
7
|
+
"$recursiveAnchor": true,
|
8
|
+
|
9
|
+
"title": "Applicator vocabulary meta-schema",
|
10
|
+
"type": ["object", "boolean"],
|
11
|
+
"properties": {
|
12
|
+
"additionalItems": { "$recursiveRef": "#" },
|
13
|
+
"unevaluatedItems": { "$recursiveRef": "#" },
|
14
|
+
"items": {
|
15
|
+
"anyOf": [
|
16
|
+
{ "$recursiveRef": "#" },
|
17
|
+
{ "$ref": "#/$defs/schemaArray" }
|
18
|
+
]
|
19
|
+
},
|
20
|
+
"contains": { "$recursiveRef": "#" },
|
21
|
+
"additionalProperties": { "$recursiveRef": "#" },
|
22
|
+
"unevaluatedProperties": { "$recursiveRef": "#" },
|
23
|
+
"properties": {
|
24
|
+
"type": "object",
|
25
|
+
"additionalProperties": { "$recursiveRef": "#" },
|
26
|
+
"default": {}
|
27
|
+
},
|
28
|
+
"patternProperties": {
|
29
|
+
"type": "object",
|
30
|
+
"additionalProperties": { "$recursiveRef": "#" },
|
31
|
+
"propertyNames": { "format": "regex" },
|
32
|
+
"default": {}
|
33
|
+
},
|
34
|
+
"dependentSchemas": {
|
35
|
+
"type": "object",
|
36
|
+
"additionalProperties": {
|
37
|
+
"$recursiveRef": "#"
|
38
|
+
}
|
39
|
+
},
|
40
|
+
"propertyNames": { "$recursiveRef": "#" },
|
41
|
+
"if": { "$recursiveRef": "#" },
|
42
|
+
"then": { "$recursiveRef": "#" },
|
43
|
+
"else": { "$recursiveRef": "#" },
|
44
|
+
"allOf": { "$ref": "#/$defs/schemaArray" },
|
45
|
+
"anyOf": { "$ref": "#/$defs/schemaArray" },
|
46
|
+
"oneOf": { "$ref": "#/$defs/schemaArray" },
|
47
|
+
"not": { "$recursiveRef": "#" }
|
48
|
+
},
|
49
|
+
"$defs": {
|
50
|
+
"schemaArray": {
|
51
|
+
"type": "array",
|
52
|
+
"minItems": 1,
|
53
|
+
"items": { "$recursiveRef": "#" }
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
3
|
+
"$id": "https://json-schema.org/draft/2019-09/meta/content",
|
4
|
+
"$vocabulary": {
|
5
|
+
"https://json-schema.org/draft/2019-09/vocab/content": true
|
6
|
+
},
|
7
|
+
"$recursiveAnchor": true,
|
8
|
+
|
9
|
+
"title": "Content vocabulary meta-schema",
|
10
|
+
|
11
|
+
"type": ["object", "boolean"],
|
12
|
+
"properties": {
|
13
|
+
"contentMediaType": { "type": "string" },
|
14
|
+
"contentEncoding": { "type": "string" },
|
15
|
+
"contentSchema": { "$recursiveRef": "#" }
|
16
|
+
}
|
17
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
3
|
+
"$id": "https://json-schema.org/draft/2019-09/meta/core",
|
4
|
+
"$vocabulary": {
|
5
|
+
"https://json-schema.org/draft/2019-09/vocab/core": true
|
6
|
+
},
|
7
|
+
"$recursiveAnchor": true,
|
8
|
+
|
9
|
+
"title": "Core vocabulary meta-schema",
|
10
|
+
"type": ["object", "boolean"],
|
11
|
+
"properties": {
|
12
|
+
"$id": {
|
13
|
+
"type": "string",
|
14
|
+
"format": "uri-reference",
|
15
|
+
"$comment": "Non-empty fragments not allowed.",
|
16
|
+
"pattern": "^[^#]*#?$"
|
17
|
+
},
|
18
|
+
"$schema": {
|
19
|
+
"type": "string",
|
20
|
+
"format": "uri"
|
21
|
+
},
|
22
|
+
"$anchor": {
|
23
|
+
"type": "string",
|
24
|
+
"pattern": "^[A-Za-z][-A-Za-z0-9.:_]*$"
|
25
|
+
},
|
26
|
+
"$ref": {
|
27
|
+
"type": "string",
|
28
|
+
"format": "uri-reference"
|
29
|
+
},
|
30
|
+
"$recursiveRef": {
|
31
|
+
"type": "string",
|
32
|
+
"format": "uri-reference"
|
33
|
+
},
|
34
|
+
"$recursiveAnchor": {
|
35
|
+
"type": "boolean",
|
36
|
+
"default": false
|
37
|
+
},
|
38
|
+
"$vocabulary": {
|
39
|
+
"type": "object",
|
40
|
+
"propertyNames": {
|
41
|
+
"type": "string",
|
42
|
+
"format": "uri"
|
43
|
+
},
|
44
|
+
"additionalProperties": {
|
45
|
+
"type": "boolean"
|
46
|
+
}
|
47
|
+
},
|
48
|
+
"$comment": {
|
49
|
+
"type": "string"
|
50
|
+
},
|
51
|
+
"$defs": {
|
52
|
+
"type": "object",
|
53
|
+
"additionalProperties": { "$recursiveRef": "#" },
|
54
|
+
"default": {}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
3
|
+
"$id": "https://json-schema.org/draft/2019-09/meta/format",
|
4
|
+
"$vocabulary": {
|
5
|
+
"https://json-schema.org/draft/2019-09/vocab/format": true
|
6
|
+
},
|
7
|
+
"$recursiveAnchor": true,
|
8
|
+
|
9
|
+
"title": "Format vocabulary meta-schema",
|
10
|
+
"type": ["object", "boolean"],
|
11
|
+
"properties": {
|
12
|
+
"format": { "type": "string" }
|
13
|
+
}
|
14
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/draft/2019-09/hyper-schema",
|
3
|
+
"$id": "https://json-schema.org/draft/2019-09/meta/hyper-schema",
|
4
|
+
"$vocabulary": {
|
5
|
+
"https://json-schema.org/draft/2019-09/vocab/hyper-schema": true
|
6
|
+
},
|
7
|
+
"$recursiveAnchor": true,
|
8
|
+
|
9
|
+
"title": "JSON Hyper-Schema Vocabulary Schema",
|
10
|
+
"type": ["object", "boolean"],
|
11
|
+
"properties": {
|
12
|
+
"base": {
|
13
|
+
"type": "string",
|
14
|
+
"format": "uri-template"
|
15
|
+
},
|
16
|
+
"links": {
|
17
|
+
"type": "array",
|
18
|
+
"items": {
|
19
|
+
"$ref": "https://json-schema.org/draft/2019-09/links"
|
20
|
+
}
|
21
|
+
}
|
22
|
+
},
|
23
|
+
"links": [
|
24
|
+
{
|
25
|
+
"rel": "self",
|
26
|
+
"href": "{+%24id}"
|
27
|
+
}
|
28
|
+
]
|
29
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
3
|
+
"$id": "https://json-schema.org/draft/2019-09/meta/meta-data",
|
4
|
+
"$vocabulary": {
|
5
|
+
"https://json-schema.org/draft/2019-09/vocab/meta-data": true
|
6
|
+
},
|
7
|
+
"$recursiveAnchor": true,
|
8
|
+
|
9
|
+
"title": "Meta-data vocabulary meta-schema",
|
10
|
+
|
11
|
+
"type": ["object", "boolean"],
|
12
|
+
"properties": {
|
13
|
+
"title": {
|
14
|
+
"type": "string"
|
15
|
+
},
|
16
|
+
"description": {
|
17
|
+
"type": "string"
|
18
|
+
},
|
19
|
+
"default": true,
|
20
|
+
"deprecated": {
|
21
|
+
"type": "boolean",
|
22
|
+
"default": false
|
23
|
+
},
|
24
|
+
"readOnly": {
|
25
|
+
"type": "boolean",
|
26
|
+
"default": false
|
27
|
+
},
|
28
|
+
"writeOnly": {
|
29
|
+
"type": "boolean",
|
30
|
+
"default": false
|
31
|
+
},
|
32
|
+
"examples": {
|
33
|
+
"type": "array",
|
34
|
+
"items": true
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
@@ -0,0 +1,98 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "https://json-schema.org/draft/2019-09/schema",
|
3
|
+
"$id": "https://json-schema.org/draft/2019-09/meta/validation",
|
4
|
+
"$vocabulary": {
|
5
|
+
"https://json-schema.org/draft/2019-09/vocab/validation": true
|
6
|
+
},
|
7
|
+
"$recursiveAnchor": true,
|
8
|
+
|
9
|
+
"title": "Validation vocabulary meta-schema",
|
10
|
+
"type": ["object", "boolean"],
|
11
|
+
"properties": {
|
12
|
+
"multipleOf": {
|
13
|
+
"type": "number",
|
14
|
+
"exclusiveMinimum": 0
|
15
|
+
},
|
16
|
+
"maximum": {
|
17
|
+
"type": "number"
|
18
|
+
},
|
19
|
+
"exclusiveMaximum": {
|
20
|
+
"type": "number"
|
21
|
+
},
|
22
|
+
"minimum": {
|
23
|
+
"type": "number"
|
24
|
+
},
|
25
|
+
"exclusiveMinimum": {
|
26
|
+
"type": "number"
|
27
|
+
},
|
28
|
+
"maxLength": { "$ref": "#/$defs/nonNegativeInteger" },
|
29
|
+
"minLength": { "$ref": "#/$defs/nonNegativeIntegerDefault0" },
|
30
|
+
"pattern": {
|
31
|
+
"type": "string",
|
32
|
+
"format": "regex"
|
33
|
+
},
|
34
|
+
"maxItems": { "$ref": "#/$defs/nonNegativeInteger" },
|
35
|
+
"minItems": { "$ref": "#/$defs/nonNegativeIntegerDefault0" },
|
36
|
+
"uniqueItems": {
|
37
|
+
"type": "boolean",
|
38
|
+
"default": false
|
39
|
+
},
|
40
|
+
"maxContains": { "$ref": "#/$defs/nonNegativeInteger" },
|
41
|
+
"minContains": {
|
42
|
+
"$ref": "#/$defs/nonNegativeInteger",
|
43
|
+
"default": 1
|
44
|
+
},
|
45
|
+
"maxProperties": { "$ref": "#/$defs/nonNegativeInteger" },
|
46
|
+
"minProperties": { "$ref": "#/$defs/nonNegativeIntegerDefault0" },
|
47
|
+
"required": { "$ref": "#/$defs/stringArray" },
|
48
|
+
"dependentRequired": {
|
49
|
+
"type": "object",
|
50
|
+
"additionalProperties": {
|
51
|
+
"$ref": "#/$defs/stringArray"
|
52
|
+
}
|
53
|
+
},
|
54
|
+
"const": true,
|
55
|
+
"enum": {
|
56
|
+
"type": "array",
|
57
|
+
"items": true
|
58
|
+
},
|
59
|
+
"type": {
|
60
|
+
"anyOf": [
|
61
|
+
{ "$ref": "#/$defs/simpleTypes" },
|
62
|
+
{
|
63
|
+
"type": "array",
|
64
|
+
"items": { "$ref": "#/$defs/simpleTypes" },
|
65
|
+
"minItems": 1,
|
66
|
+
"uniqueItems": true
|
67
|
+
}
|
68
|
+
]
|
69
|
+
}
|
70
|
+
},
|
71
|
+
"$defs": {
|
72
|
+
"nonNegativeInteger": {
|
73
|
+
"type": "integer",
|
74
|
+
"minimum": 0
|
75
|
+
},
|
76
|
+
"nonNegativeIntegerDefault0": {
|
77
|
+
"$ref": "#/$defs/nonNegativeInteger",
|
78
|
+
"default": 0
|
79
|
+
},
|
80
|
+
"simpleTypes": {
|
81
|
+
"enum": [
|
82
|
+
"array",
|
83
|
+
"boolean",
|
84
|
+
"integer",
|
85
|
+
"null",
|
86
|
+
"number",
|
87
|
+
"object",
|
88
|
+
"string"
|
89
|
+
]
|
90
|
+
},
|
91
|
+
"stringArray": {
|
92
|
+
"type": "array",
|
93
|
+
"items": { "type": "string" },
|
94
|
+
"uniqueItems": true,
|
95
|
+
"default": []
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}
|