aboutsummaryrefslogtreecommitdiffstats
path: root/spec/util_datamapper_spec.lua
Commit message (Collapse)AuthorAgeFilesLines
* util.datamapper: Simplify test schemaKim Alvefur2022-12-201-12/+12
| | | | | Don't need the function, more compact to just reference the same reference table.
* util.datamapper: Improve handling of schemas with non-obvious "type"Kim Alvefur2022-07-081-3/+5
| | | | | | | | | | | | The JSON Schema specification says that schemas are objects or booleans, and that the 'type' property is optional and can be an array. This module previously allowed bare type names as schemas and did not really handle booleans. It now handles missing 'type' properties and boolean 'true' as a schema. Objects and arrays are guessed based on the presence of 'properties' or 'items' field.
* util_datamapper: Fix typo in unit testsKim Alvefur2021-12-291-1/+1
|
* util.datamapper: Add support for $ref pointersKim Alvefur2021-12-291-1/+3
| | | | Allows reuse of repetitive definitions in schemas.
* util.datamapper: Fix spelling in testsKim Alvefur2021-03-281-2/+2
|
* util.datamapper: Revert one special attribute to longer formKim Alvefur2021-03-261-1/+1
| | | | Had a name, using attr() broke it.
* util.datamapper: Use attribute convenience function throughoutKim Alvefur2021-03-261-3/+4
|
* util.datamapper: Add test coverage of unwrapped arrays of objectsKim Alvefur2021-03-241-0/+14
| | | | | Should the xml name/ns go on the array or the items schema? The later apparently.
* util.datamapper: Deal with locally built stanzas missing xmlnsKim Alvefur2021-03-231-0/+28
| | | | | | | | | | | | | | | | | | | | | So the problem is that xmlns is not inherited when building a stanza, and then :get_child(n, ns) with an explicit namespace does not find that such child tags. E.g. local t = st.stanza("foo", { xmlns = "urn:example:bar" }) :text_tag("hello", "world"); assert(t:get_child("hello", "urn:example:bar"), "This fails"); Meanwhile, during parsing (util.xmppstream or util.xml) child tags do get the parents xmlns when not overriding them. Thus, in the above example, if the stanza is passed trough `t = util.xml.parse(tostring(t))` then the assert succeeds. This change makes it so that it leaves out the namespace argument to :get_child when it is the same as the current/parent namespace, which behaves the same for both built and parsed stanzas.
* util.datamapper: Complete array building supportKim Alvefur2021-03-201-0/+11
|
* util.datamapper: Finally implement support for parsing arraysKim Alvefur2021-03-201-0/+63
|
* util.datamapper: Fix arrays nesting one level too deepKim Alvefur2021-03-191-7/+15
|
* util.datamapper: Limited support for unparsing simple arrays of stringsKim Alvefur2021-03-181-6/+2
|
* util.datamapper: Add initial support for parsing arraysKim Alvefur2021-03-181-1/+24
|
* util.datamapper: Enumerated elementsKim Alvefur2021-03-121-1/+9
| | | | E.g. error conditions or chat states.
* util.datamapper: Add support for mapping of elements where only one ↵Kim Alvefur2021-03-071-0/+7
| | | | | | | attribute matters E.g. <feature var='foo'/> in XEP-0030 and some other simple specifications.
* util.datamapper: Add logic for "boolean" tags here the presence means trueKim Alvefur2021-03-071-0/+6
|
* util.datamapper: Invent extension for using tag name as valueKim Alvefur2021-03-061-5/+11
| | | | | Useful for certain enum-like uses where the element name is the relevant information, e.g. chat states.
* util.datamapper: Add 'unparse' for turning tables into XMLKim Alvefur2021-03-071-0/+12
|
* util.datamapper: Library for extracting data from stanzasKim Alvefur2021-03-071-0/+56
Based on the XML support in the OpenAPI specification.