# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1615331978 -3600
# Node ID ee4f2296e7dfcbba387a3658554c45a616b7b399
# Parent  25829015917cd591e37c4112cd0c1add07405d5c
util.datamapper: Add references with notes

diff -r 25829015917c -r ee4f2296e7df teal-src/util/datamapper.tl
--- 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
diff -r 25829015917c -r ee4f2296e7df util/datamapper.lua
--- 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