Changeset

12990:939049732317

util.jsonschema: Reorder type definition by specification, section Also some comment headers and missing properties
author Kim Alvefur <zash@zash.se>
date Sun, 26 Mar 2023 16:07:34 +0200
parents 12989:dee080c2441e
children 12991:6d7e3d5463d8
files teal-src/prosody/util/jsonschema.tl
diffstat 1 files changed, 37 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/teal-src/prosody/util/jsonschema.tl	Sun Mar 26 15:20:07 2023 +0200
+++ b/teal-src/prosody/util/jsonschema.tl	Sun Mar 26 16:07:34 2023 +0200
@@ -1,4 +1,4 @@
--- Copyright (C) 2021 Kim Alvefur
+-- Copyright (C) Kim Alvefur
 --
 -- This project is MIT/X11 licensed. Please see the
 -- COPYING file in the source package for more information.
@@ -24,20 +24,49 @@
 	type json_type_name = json.json_type_name
 	type schema_object = json_schema_object
 
-	type : json_type_name | { json_type_name }
-	enum : { any }
-	const : any
+	-- json-schema-core meta stuff
+	["$schema"] : string
+	["$vocabulary"] : { string : boolean }
+	["$id"] : string
+	["$comment"] : string
+	["$defs"] : { string : schema_t }
+	["$anchor"] : string -- NYI
+	["$dynamicAnchor"] : string -- NYI
+	["$ref"] : string
+	["$dynamicRef"] : string -- NYI
 
+	-- combinations
 	allOf : { schema_t }
 	anyOf : { schema_t }
 	oneOf : { schema_t }
 
+	-- conditional logic
 	["not"] : schema_t
 	["if"] : schema_t
 	["then"] : schema_t
 	["else"] : schema_t
 
-	["$ref"] : string
+	dependentRequired : { string : { string } }
+
+	-- arrays
+	prefixItems : { schema_t }
+	items : schema_t
+	contains : schema_t
+
+	-- objects
+	properties : { string : schema_t }
+	patternProperties: schema_t -- NYI
+	additionalProperties: schema_t
+	propertyNames : schema_t
+
+	-- unevaluated
+	unevaluatedItems : schema_t -- NYI
+	unevaluatedProperties : schema_t -- NYI
+
+	-- json-schema-validation
+	type : json_type_name | { json_type_name }
+	enum : { any }
+	const : any
 
 	-- numbers
 	multipleOf : number
@@ -50,12 +79,8 @@
 	maxLength : integer
 	minLength : integer
 	pattern : string -- NYI
-	format : string
 
 	-- arrays
-	prefixItems : { schema_t }
-	items : schema_t
-	contains : schema_t
 	maxItems : integer
 	minItems : integer
 	uniqueItems : boolean
@@ -63,16 +88,14 @@
 	minContains : integer -- NYI
 
 	-- objects
-	properties : { string : schema_t }
 	maxProperties : integer -- NYI
 	minProperties : integer -- NYI
 	required : { string }
-	dependentRequired : { string : { string } }
-	additionalProperties: schema_t
-	patternProperties: schema_t -- NYI
-	propertyNames : schema_t
 	dependentSchemas : { string : schema_t }
 
+	-- semantic format
+	format : string
+
 	-- xml
 	record xml_t
 		name : string