Skip to content

Commit b6418e6

Browse files
committed
Initial commit
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
0 parents  commit b6418e6

66 files changed

Lines changed: 8995 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[Makefile]
13+
indent_style = tab
14+
15+
[*.mk]
16+
indent_style = tab

.github/workflows/ci.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Std
2+
3+
on:
4+
schedule:
5+
# Once per day, Monday to Friday
6+
- cron: '0 19 * * 1-5'
7+
push:
8+
branches:
9+
- main
10+
pull_request:
11+
12+
concurrency:
13+
group: std-ci-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
test:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- run: sudo snap install jsonschema
21+
- uses: actions/checkout@v4
22+
- run: make lint
23+
- run: make test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

LICENSE

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
© Sourcemeta.
2+
3+
These schemas and tests are licensed solely to active paying users of the
4+
Sourcemeta Registry. Use, copying, distribution, or sublicensing by anyone not
5+
currently paying for the Sourcemeta Registry is strictly prohibited.
6+
7+
The schemas are provided "as is" without any warranty, and Sourcemeta is not
8+
liable for any damages arising from its use.

Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
JSONSCHEMA = jsonschema
2+
SHELLCHECK = shellcheck
3+
4+
# TODO: Extend `validate` to take a directory as argument
5+
SCHEMAS = $(shell find schemas/ -type f -name '*.json')
6+
TESTS = $(shell find tests/ -type f -name '*.json')
7+
8+
all: common test
9+
$(JSONSCHEMA) fmt schemas tests conventions.json tests.json --verbose
10+
11+
common: .always
12+
$(JSONSCHEMA) metaschema schemas conventions.json tests.json --verbose
13+
$(JSONSCHEMA) lint schemas conventions.json tests.json --verbose
14+
$(JSONSCHEMA) validate conventions.json --verbose $(SCHEMAS)
15+
$(JSONSCHEMA) validate tests.json --verbose $(TESTS)
16+
$(SHELLCHECK) scripts/*.sh
17+
./scripts/schemas-tests-mirror.sh
18+
19+
lint: common
20+
$(JSONSCHEMA) fmt schemas tests conventions.json tests.json --verbose --check
21+
22+
test: .always
23+
$(JSONSCHEMA) test ./tests
24+
25+
.always:

README.markdown

Lines changed: 271 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,271 @@
1+
Sourcemeta JSON Schema Standard Library
2+
=======================================
3+
4+
A growing collection of hand-crafted high-quality schemas by Sourcemeta.
5+
6+
> [!CAUTION]
7+
> This repository is a work-in-progress and not ready for general use yet.
8+
9+
Roadmap
10+
-------
11+
12+
This section tracks standards and specifications that should ideally be covered in this library. Checkmarks (✓) indicate completed schemas.
13+
14+
### IETF RFCs (Internet Engineering Task Force)
15+
16+
#### HTTP (Hypertext Transfer Protocol)
17+
-[RFC 9110](https://www.rfc-editor.org/rfc/rfc9110) - HTTP Semantics
18+
- ✓ Status codes (all classes, standard enum)
19+
- ✓ Methods (generic pattern, standard enum)
20+
- ✓ ETags (strong, weak, combined)
21+
- ✓ HTTP/HTTPS URLs
22+
- [ ] Header field names
23+
- [ ] Header field values
24+
- [ ] Content-Type values
25+
- [ ] Cache-Control directives
26+
- [ ] Accept header values
27+
- [ ] Content-Encoding values
28+
- [ ] Transfer-Encoding values
29+
- [RFC 5789](https://www.rfc-editor.org/rfc/rfc5789) - PATCH Method (✓ included in method-standard)
30+
- [RFC 4918](https://www.rfc-editor.org/rfc/rfc4918) - WebDAV (✓ methods included in method-standard)
31+
- [RFC 6265](https://www.rfc-editor.org/rfc/rfc6265) - HTTP State Management (Cookies)
32+
- [ ] Cookie names
33+
- [ ] Cookie values
34+
- [ ] Set-Cookie directives
35+
- [RFC 7230-7235](https://www.rfc-editor.org/rfc/rfc7230) - HTTP/1.1 Message Syntax and Routing
36+
- [ ] Request-Line
37+
- [ ] Status-Line
38+
- [RFC 7540](https://www.rfc-editor.org/rfc/rfc7540) - HTTP/2
39+
- [RFC 9113](https://www.rfc-editor.org/rfc/rfc9113) - HTTP/2 (updated)
40+
41+
#### URI/URL (Uniform Resource Identifiers)
42+
-[RFC 3986](https://www.rfc-editor.org/rfc/rfc3986) - URI Generic Syntax
43+
- ✓ URI (generic)
44+
- ✓ URL
45+
- ✓ URN
46+
- ✓ URI references
47+
- ✓ Relative references
48+
- [ ] URI schemes (specific: ftp, file, ws, wss, etc.)
49+
- [ ] Authority component
50+
- [ ] Path segments
51+
- [ ] Query strings
52+
- [ ] Fragments
53+
54+
#### Email
55+
-[RFC 5322](https://www.rfc-editor.org/rfc/rfc5322) - Internet Message Format
56+
- ✓ Email addresses
57+
- [ ] Email headers
58+
- [ ] Message-ID
59+
- [RFC 6854](https://www.rfc-editor.org/rfc/rfc6854) - Group syntax in From and Sender headers
60+
- [RFC 2045-2049](https://www.rfc-editor.org/rfc/rfc2045) - MIME
61+
- [ ] MIME types
62+
- [ ] Content-Type headers
63+
- [ ] Content-Disposition
64+
- [ ] Multipart boundaries
65+
66+
#### JSON Related
67+
-[RFC 6901](https://www.rfc-editor.org/rfc/rfc6901) - JSON Pointer
68+
- [RFC 6902](https://www.rfc-editor.org/rfc/rfc6902) - JSON Patch
69+
- [ ] JSON Patch operations
70+
- [ ] JSON Patch documents
71+
- [RFC 7396](https://www.rfc-editor.org/rfc/rfc7396) - JSON Merge Patch
72+
-[RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) - Problem Details for HTTP APIs
73+
- [RFC 8259](https://www.rfc-editor.org/rfc/rfc8259) - JSON Data Interchange Format
74+
- [ ] JSON values (with strict validation)
75+
76+
#### Date and Time
77+
- [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339) - Date and Time on the Internet
78+
- [ ] date-time format
79+
- [ ] date format
80+
- [ ] time format
81+
- [ ] duration format
82+
- [RFC 2822](https://www.rfc-editor.org/rfc/rfc2822) - Internet Message Format (date-time)
83+
84+
#### Authentication and Security
85+
- [RFC 7519](https://www.rfc-editor.org/rfc/rfc7519) - JSON Web Token (JWT)
86+
- [ ] JWT structure
87+
- [ ] JWT claims (standard and custom)
88+
- [RFC 7515](https://www.rfc-editor.org/rfc/rfc7515) - JSON Web Signature (JWS)
89+
- [RFC 7516](https://www.rfc-editor.org/rfc/rfc7516) - JSON Web Encryption (JWE)
90+
- [RFC 7517](https://www.rfc-editor.org/rfc/rfc7517) - JSON Web Key (JWK)
91+
- [RFC 6749](https://www.rfc-editor.org/rfc/rfc6749) - OAuth 2.0
92+
- [ ] Authorization requests
93+
- [ ] Token responses
94+
- [RFC 8414](https://www.rfc-editor.org/rfc/rfc8414) - OAuth 2.0 Authorization Server Metadata
95+
96+
#### Identifiers
97+
- [RFC 4122](https://www.rfc-editor.org/rfc/rfc4122) - UUID
98+
- [ ] UUID v1 (time-based)
99+
- [ ] UUID v4 (random)
100+
- [ ] UUID v5 (name-based SHA-1)
101+
- [ ] UUID generic format
102+
- [RFC 9562](https://www.rfc-editor.org/rfc/rfc9562) - UUID (updated)
103+
- [ ] UUID v6 (time-ordered)
104+
- [ ] UUID v7 (Unix Epoch time-based)
105+
- [ ] UUID v8 (custom)
106+
107+
#### Network and IP
108+
- [RFC 791](https://www.rfc-editor.org/rfc/rfc791) - Internet Protocol (IPv4)
109+
- [ ] IPv4 addresses
110+
- [ ] IPv4 CIDR notation
111+
- [RFC 4291](https://www.rfc-editor.org/rfc/rfc4291) - IPv6 Addressing Architecture
112+
- [ ] IPv6 addresses (full, compressed)
113+
- [ ] IPv6 CIDR notation
114+
- [RFC 1034](https://www.rfc-editor.org/rfc/rfc1034) - Domain Names
115+
- [ ] Domain names (DNS)
116+
- [ ] Hostnames
117+
- [ ] Fully qualified domain names (FQDN)
118+
- [RFC 952](https://www.rfc-editor.org/rfc/rfc952) - Hostname specification
119+
- [RFC 5952](https://www.rfc-editor.org/rfc/rfc5952) - IPv6 Address Text Representation
120+
121+
#### Language and Locale
122+
- [RFC 5646](https://www.rfc-editor.org/rfc/rfc5646) / [BCP 47](https://www.rfc-editor.org/info/bcp47) - Language Tags
123+
- [ ] Language tags (e.g., en-US, zh-Hans)
124+
- [ ] Language subtags
125+
- [ ] Script subtags
126+
- [ ] Region subtags
127+
128+
#### Media Types
129+
- [RFC 6838](https://www.rfc-editor.org/rfc/rfc6838) - Media Type Specifications
130+
- [ ] Media types (MIME types)
131+
- [ ] Type/subtype structure
132+
- [ ] Parameters
133+
134+
#### Other IETF Standards
135+
- [RFC 1321](https://www.rfc-editor.org/rfc/rfc1321) - MD5 Message-Digest Algorithm
136+
- [ ] MD5 hash format
137+
- [RFC 3174](https://www.rfc-editor.org/rfc/rfc3174) - SHA-1
138+
- [ ] SHA-1 hash format
139+
- [RFC 6234](https://www.rfc-editor.org/rfc/rfc6234) - SHA-2 family
140+
- [ ] SHA-256 hash format
141+
- [ ] SHA-512 hash format
142+
- [RFC 4648](https://www.rfc-editor.org/rfc/rfc4648) - Base16, Base32, Base64 Encodings
143+
- [ ] Base64 encoded strings
144+
- [ ] Base64URL encoded strings
145+
- [ ] Base32 encoded strings
146+
147+
### ISO Standards (International Organization for Standardization)
148+
149+
#### Date, Time, and Duration
150+
- [ISO 8601-1:2019](https://www.iso.org/standard/70907.html) - Date and time representations
151+
- [ ] Date formats (YYYY-MM-DD, etc.)
152+
- [ ] Time formats (HH:MM:SS, etc.)
153+
- [ ] DateTime with timezone
154+
- [ ] Week dates
155+
- [ ] Ordinal dates
156+
- [ ] Duration (P notation)
157+
- [ ] Time intervals
158+
- [ ] Recurring time intervals
159+
160+
#### Language and Country Codes
161+
- [ISO 639-1:2002](https://www.iso.org/standard/22109.html) - Language codes (2-letter)
162+
- [ ] Two-letter language codes (en, es, fr, etc.)
163+
- [ISO 639-2:1998](https://www.iso.org/standard/4767.html) - Language codes (3-letter)
164+
- [ ] Three-letter language codes
165+
- [ISO 3166-1](https://www.iso.org/iso-3166-country-codes.html) - Country codes
166+
- [ ] Alpha-2 codes (US, GB, JP, etc.)
167+
- [ ] Alpha-3 codes (USA, GBR, JPN, etc.)
168+
- [ ] Numeric codes
169+
- [ISO 3166-2](https://www.iso.org/standard/72483.html) - Subdivision codes
170+
- [ ] Country subdivision codes (US-CA, GB-ENG, etc.)
171+
172+
#### Currency and Units
173+
- [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) - Currency codes
174+
- [ ] Currency codes (USD, EUR, GBP, etc.)
175+
- [ ] Currency numbers
176+
-[ISO 80000-1:2022](https://www.iso.org/standard/76921.html) - Quantities and units
177+
- ✓ Percentage (0-100)
178+
- [ ] Other units
179+
180+
#### Information Technology
181+
-[ISO/IEC 2382:2015](https://www.iso.org/standard/63598.html) - Information technology vocabulary
182+
- ✓ Byte (non-negative integer)
183+
- [ ] Bit
184+
- [ ] Kilobyte, Megabyte, Gigabyte, etc.
185+
186+
### IEEE Standards (Institute of Electrical and Electronics Engineers)
187+
188+
#### POSIX (Portable Operating System Interface)
189+
-[IEEE 1003.1 (POSIX.1-2017)](https://pubs.opengroup.org/onlinepubs/9699919799/) - POSIX.1
190+
- ✓ Absolute paths
191+
- ✓ Relative paths
192+
- ✓ Generic paths
193+
- [ ] File permissions (octal notation)
194+
- [ ] Process IDs
195+
- [ ] User IDs / Group IDs
196+
- [ ] File descriptors
197+
- [ ] Environment variable names
198+
- [ ] Shell command syntax
199+
200+
#### Floating Point
201+
- [IEEE 754](https://standards.ieee.org/standard/754-2019.html) - Floating-Point Arithmetic
202+
- [ ] Special values (NaN, Infinity, -Infinity)
203+
- [ ] Subnormal numbers
204+
205+
### IANA Registries (Internet Assigned Numbers Authority)
206+
207+
- [Media Types](https://www.iana.org/assignments/media-types/)
208+
- [ ] Registered media types
209+
- [Character Sets](https://www.iana.org/assignments/character-sets/)
210+
- [ ] Character set names
211+
- [Time Zone Database](https://www.iana.org/time-zones)
212+
- [ ] IANA time zone identifiers (America/New_York, etc.)
213+
- [Port Numbers](https://www.iana.org/assignments/service-names-port-numbers/)
214+
- [ ] Well-known ports (0-1023)
215+
- [ ] Registered ports (1024-49151)
216+
- [ ] Valid port range (0-65535)
217+
- [HTTP Status Codes](https://www.iana.org/assignments/http-status-codes/)
218+
- [ ] Extended status codes beyond RFC 9110
219+
220+
### Software Licensing
221+
222+
- [SPDX](https://spdx.org/licenses/) - Software Package Data Exchange
223+
- [ ] SPDX license identifiers (MIT, Apache-2.0, GPL-3.0, etc.)
224+
- [ ] SPDX license expressions (MIT OR Apache-2.0)
225+
226+
### Versioning
227+
228+
- [Semantic Versioning 2.0.0](https://semver.org/)
229+
- [ ] Semantic version strings (MAJOR.MINOR.PATCH)
230+
- [ ] Pre-release versions
231+
- [ ] Build metadata
232+
- [ ] Version ranges
233+
234+
### Cryptography
235+
236+
- [Bitcoin](https://bitcoin.org/bitcoin.pdf)
237+
- [ ] Bitcoin addresses
238+
- [ ] Bitcoin transaction hashes
239+
- [Ethereum](https://ethereum.org/)
240+
- [ ] Ethereum addresses
241+
- [ ] Ethereum transaction hashes
242+
243+
### Geographic and Geospatial
244+
245+
- [WGS 84](https://en.wikipedia.org/wiki/World_Geodetic_System) - World Geodetic System
246+
- [ ] Latitude (-90 to 90)
247+
- [ ] Longitude (-180 to 180)
248+
- [ ] Altitude
249+
250+
### Telecommunications
251+
252+
- [E.164](https://www.itu.int/rec/T-REC-E.164/) - International telephone numbers
253+
- [ ] Phone numbers (international format)
254+
- [ISSN](https://www.issn.org/) - International Standard Serial Number
255+
- [ ] ISSN format
256+
- [ISBN](https://www.isbn-international.org/) - International Standard Book Number
257+
- [ ] ISBN-10
258+
- [ ] ISBN-13
259+
260+
### Miscellaneous
261+
262+
- [Cron Expressions](https://en.wikipedia.org/wiki/Cron)
263+
- [ ] Cron schedule format
264+
- Credit Cards
265+
- [ ] Credit card numbers (Luhn algorithm)
266+
- [ ] CVV codes
267+
- [ ] Expiration dates
268+
- [MAC Addresses](https://standards.ieee.org/products-programs/regauth/)
269+
- [ ] MAC address formats (colon, hyphen, dot notation)
270+
- [VIN](https://www.iso.org/standard/52200.html) - Vehicle Identification Number
271+
- [ ] VIN format (17 characters)

conventions.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"type": "object",
4+
"required": [
5+
"x-license",
6+
"title",
7+
"description",
8+
"examples",
9+
"$comment",
10+
"$schema"
11+
],
12+
"properties": {
13+
"$schema": {
14+
"const": "https://json-schema.org/draft/2020-12/schema"
15+
},
16+
"$id": false,
17+
"$comment": {
18+
"$ref": "./schemas/ietf/http/https-url.json"
19+
},
20+
"examples": {
21+
"type": "array",
22+
"minItems": 3
23+
},
24+
"x-license": {
25+
"const": "https://github.com/sourcemeta/std/blob/main/LICENSE"
26+
}
27+
}
28+
}

jsonschema.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"title": "The JSON Schema Standard Library",
3+
"description": "A growing collection of hand-crafted high-quality schemas by Sourcemeta",
4+
"email": "hello@sourcemeta.com",
5+
"github": "sourcemeta/std",
6+
"path": "./schemas"
7+
}

0 commit comments

Comments
 (0)