-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdraft-oskarsson-jsond-00.txt
349 lines (199 loc) · 9.61 KB
/
draft-oskarsson-jsond-00.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
Internet Engineering Task Force D. Oskarsson
Internet-Draft JSOND.org
Intended status: Informational March 9, 2015
Expires: August 5, 2015
JavaScript Object Notation Definition (JSOND)
draft-oskarsson-jsond-00
Abstract
JSOND (JSON Definition) is a simple, yet powerful, definition
language for JSON text.
Status of this Memo
This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress."
This Internet-Draft will expire on August 5, 2015.
Copyright Notice
Copyright (c) 2015 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.
Oskarsson Expires August 5, 2015 [Page 1]
Internet-Draft JSOND March 2015
1. Introduction
JSOND (JSON Definition) is a simple, yet powerful, definition
language for JSON text.
The purpose of JSOND is to facilitate development and documentation
of JSON text.
JSOND is designed to be a minimal superset of JSON.
1.1. Conventions Used in This Document
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in RFC 2119 [RFC2119].
2. JSOND Grammar
JSOND text is JSON text that MAY include JSOND grammar. JSOND
grammar is a superset of JSON grammar [RFC7159] [RFC4627]
[ECMA-404]. The rest of this document describes the JSOND grammar
in ABNF [RFC5234] and text.
2.1. Values
A JSOND value MUST be an object, array or a string.
value = object / array / string
2.2. Objects
A JSOND object MUST define all members in the corresponding JSON
object. A JSON object MUST NOT contain a member that has not been
defined in the corresponding JSOND object.
value = object ; e.g. { "a": "string" }
2.3. Arrays
A JSOND array defines zero or more values. All values in a JSON
array MUST be defined by at least one of the values in the
corresponding JSOND array.
value = array ; e.g. [ "string" ]
2.4. Booleans
A JSOND boolean defines that the corresponding JSON value MUST be
true or false.
value = %x22.62.6f.6f.6c.65.61.6e.22 ; "boolean"
Oskarsson Expires August 5, 2015 [Page 2]
Internet-Draft JSOND March 2015
2.5. Strings
A JSOND string defines that the corresponding JSON value MUST be any
string.
value = %x22.73.74.72.69.6e.67.22 ; "string"
Regular expressions [ECMA-262] MAY be used to define a subset of
strings.
value = %x22 regular-expression %x22 ; e.g. "[a-z]"
2.4. Numbers and Integers
A JSOND number defines that the corresponding JSON value MUST be any
number.
value = %x22.6e.75.6d.62.65.72.22 ; "number"
A JSOND integer defines that the corresponding JSON value MUST be
any integer.
value = %x22.69.6e.74.65.67.65.72.22 ; "integer"
2.4.1 Sets and Intervals
An arbitrary number of mathematical sets and intervals [ISO-80000-2]
MAY be used to define a subset of numbers.
A corresponding JSON number MUST match a number in the defined
subset.
begin-exclusive = %x28 ; (
end-exclusive = %x29 ; )
integer = [ minus ] zero / ( digit1-9 *DIGIT )
number = integer [ frac ] [ exp ]
set = begin-object number *( value-separator number ) end-object
interval = begin-array / begin-exclusive ( ( number
value-separator ) / ( number value-separator number ) /
( value-separator number ) ) end-array / end-exclusive
value = %x22 1*( set / interval ) %x22 ; e.g. "[1.0,2.0)"
Set elements SHOULD be ordered in increasing order from the least
to the greatest element. There must be at least one element.
Oskarsson Expires August 5, 2015 [Page 3]
Internet-Draft JSOND March 2015
The left or right interval endpoint is OPTIONAL. An undefined left
endpoint defines negative infinity. An undefined right endpoint
defines positive infinity. If both endpoints are provided the left
endpoint MUST be less than the right endpoint.
An interval that is declared using integers defines the
corresponding subset of integers. An interval MUST be declared using
at least one number with an explicit decimal component to define a
subset of real numbers. The decimal component MAY be .0.
Insignificant whitespace is OPTIONAL in sets and intervals.
2.5. References
Any JSOND value MAY be persisted as a file. A file SHOULD be
referenced using a relative path, an absolute path, or using the
http or https scheme [RFC3986].
value = %x22 [ scheme ] path %x22 ; e.g. "file.jsond"
JSOND files SHOULD have the filename extension .jsond. Circular
references SHOULD be avoided.
2.6. Constants
A value that is not valid JSOND grammar SHOULD be interpreted as a
constant and thus REQUIRED in the corresponding JSON text.
The literals, true, false, and null are not valid JSOND grammar.
Numbers are not valid JSOND grammar.
Most strings are valid regular expressions and thus valid JSOND
grammar. String constants SHOULD include boundary matchers.
2.7. Optionals
A member can be defined as optional by appending a question mark to
the end of the name.
name = %x22 *char [ %x3f ] %x22 ; e.g. "name?"
An optional member MAY have the value null. An optional member MAY
be undefined in JSON text.
Oskarsson Expires August 5, 2015 [Page 4]
Internet-Draft JSOND March 2015
3. IANA Considerations
Additional information:
Magic number(s): n/a
File extension(s): .jsond
Macintosh file type code(s): TEXT
4. Security Considerations
See Security Considerations in [RFC7159] Section 12.
5. References
5.1. Normative References
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC3986] Berners-Lee, T., Fielding R., and Masinter, L., "Uniform
Resource Identifier (URI): Generic Syntax", RFC 3986,
January 2005.
[RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax
Specifications: ABNF", STD 68, RFC 5234, January 2008.
[RFC7159] Bray, T., "The JavaScript Object Notation (JSON) Data
Interchange Format", RFC 7159, March 2014.
5.2. Informative References
[ECMA-404] Ecma International, "The JSON Data Interchange Format",
Standard ECMA-404, October 2013, <http://www.ecma-
international.org/publications/standards/Ecma-404.htm>.
[ECMA-262] Ecma International, "ECMAScript Language Specification",
Standard ECMA-262, June 2011, <http://www.ecma-
international.org/publications/standards/Ecma-262.htm>.
[ISO-80000-2] International Organization for Standardization,
"Quantities and units - Part 2: Mathematical signs and
symbols to be used in the natural sciences and
technology", Standard ISO 80000-2:2009, December 2009,
<http://www.iso.org/iso/home/store/catalogue_tc/
catalogue_tc_browse.htm?commid=46202>.
[RFC4627] Crockford, D., "The application/json Media Type for
JavaScript Object Notation (JSON)", RFC 4627, July 2006.
Oskarsson Expires August 5, 2015 [Page 5]
Internet-Draft JSOND March 2015
Appendix A. Examples
Example 1:
[
{
"id": "integer",
"slug": "string",
"url": "string"
"category": "integer",
"price": "number",
"reduced": "boolean",
}
]
Example 2:
[
{
"id": "[0,)",
"slug": "[a-z0-9]",
"url": "url.jsond"
"category": "{10,25,50}",
"price": "(0.0,)",
"reduced?": "boolean",
"margin": "(high|medium|low)",
"available": true,
}
]
Author's Address
Daniel Oskarsson
Satuna Vekabacken
SE-541 94
SWEDEN
Email: [email protected]
Oskarsson Expires August 5, 2015 [Page 5]