Comparison

teal-src/util/datamapper.tl @ 11451:ee4f2296e7df

util.datamapper: Add references with notes
author Kim Alvefur <zash@zash.se>
date Wed, 10 Mar 2021 00:19:38 +0100
parent 11450:25829015917c
child 11452:c799bac7ca59
comparison
equal deleted inserted replaced
11450:25829015917c 11451:ee4f2296e7df
1 -- Copyright (C) 2021 Kim Alvefur 1 -- Copyright (C) 2021 Kim Alvefur
2 -- 2 --
3 -- This project is MIT/X11 licensed. Please see the 3 -- This project is MIT/X11 licensed. Please see the
4 -- COPYING file in the source package for more information. 4 -- COPYING file in the source package for more information.
5 --
6 -- Based on
7 -- https://json-schema.org/draft/2020-12/json-schema-core.html
8 -- https://json-schema.org/draft/2020-12/json-schema-validation.html
9 -- http://spec.openapis.org/oas/v3.0.1#xmlObject
10 -- https://github.com/OAI/OpenAPI-Specification/issues/630 (text:true)
11 --
12 -- XML Object Extensions:
13 -- text to refer to the text content at the same time as attributes
14 -- x_name_is_value for enum fields where the <tag-name/> is the value
15 -- x_single_attribute for <tag attr="this"/>
5 -- 16 --
6 17
7 local st = require "util.stanza"; 18 local st = require "util.stanza";
8 local js = require "util.jsonschema" 19 local js = require "util.jsonschema"
9 20
46 prefix = propschema.xml.prefix 57 prefix = propschema.xml.prefix
47 end 58 end
48 if propschema.xml.attribute then 59 if propschema.xml.attribute then
49 is_attribute = true 60 is_attribute = true
50 elseif propschema.xml.text then 61 elseif propschema.xml.text then
62 -- XXX Not yet in OpenAPI
51 is_text = true 63 is_text = true
52 elseif propschema.xml.x_name_is_value then 64 elseif propschema.xml.x_name_is_value then
65 -- XXX Custom extension
53 name_is_value = true 66 name_is_value = true
54 elseif propschema.xml.x_single_attribute then 67 elseif propschema.xml.x_single_attribute then
68 -- XXX Custom extension
55 single_attribute = propschema.xml.x_single_attribute 69 single_attribute = propschema.xml.x_single_attribute
56 end 70 end
57 end 71 end
58 72
59 if name_is_value then 73 if name_is_value then