Changeset

11451:ee4f2296e7df

util.datamapper: Add references with notes
author Kim Alvefur <zash@zash.se>
date Wed, 10 Mar 2021 00:19:38 +0100 (2021-03-09)
parents 11450:25829015917c
children 11452:c799bac7ca59
files teal-src/util/datamapper.tl util/datamapper.lua
diffstat 2 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/teal-src/util/datamapper.tl	Wed Mar 10 00:18:39 2021 +0100
+++ b/teal-src/util/datamapper.tl	Wed Mar 10 00:19:38 2021 +0100
@@ -3,6 +3,17 @@
 -- This project is MIT/X11 licensed. Please see the
 -- COPYING file in the source package for more information.
 --
+-- Based on
+-- https://json-schema.org/draft/2020-12/json-schema-core.html
+-- https://json-schema.org/draft/2020-12/json-schema-validation.html
+-- http://spec.openapis.org/oas/v3.0.1#xmlObject
+-- https://github.com/OAI/OpenAPI-Specification/issues/630 (text:true)
+--
+-- XML Object Extensions:
+-- text to refer to the text content at the same time as attributes
+-- x_name_is_value for enum fields where the <tag-name/> is the value
+-- x_single_attribute for <tag attr="this"/>
+--
 
 local st = require "util.stanza";
 local js = require "util.jsonschema"
@@ -48,10 +59,13 @@
 				if propschema.xml.attribute then
 					is_attribute = true
 				elseif propschema.xml.text then
+					-- XXX Not yet in OpenAPI
 					is_text = true
 				elseif propschema.xml.x_name_is_value then
+					-- XXX Custom extension
 					name_is_value = true
 				elseif propschema.xml.x_single_attribute then
+					-- XXX Custom extension
 					single_attribute = propschema.xml.x_single_attribute
 				end
 			end
--- a/util/datamapper.lua	Wed Mar 10 00:18:39 2021 +0100
+++ b/util/datamapper.lua	Wed Mar 10 00:19:38 2021 +0100
@@ -41,10 +41,13 @@
 				if propschema.xml.attribute then
 					is_attribute = true
 				elseif propschema.xml.text then
+
 					is_text = true
 				elseif propschema.xml.x_name_is_value then
+
 					name_is_value = true
 				elseif propschema.xml.x_single_attribute then
+
 					single_attribute = propschema.xml.x_single_attribute
 				end
 			end