diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-07-24 22:17:03 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-07-24 22:17:03 +0200 |
commit | f8d1ab946205440ed3c44511ef42e5ad13fb9e5e (patch) | |
tree | b9cae2ce60a010300777528063932d80307a7746 /include | |
parent | b3e6d445cbf73da2b00062c3f639c2453041ee41 (diff) | |
download | qpdf-f8d1ab946205440ed3c44511ef42e5ad13fb9e5e.tar.zst |
JSON schema -- accept single item in place of array
When the schema wants a variable-length array, allow a single item as
well as allowing an array.
Diffstat (limited to 'include')
-rw-r--r-- | include/qpdf/JSON.hh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/qpdf/JSON.hh b/include/qpdf/JSON.hh index ef1632c2..ebeaaec8 100644 --- a/include/qpdf/JSON.hh +++ b/include/qpdf/JSON.hh @@ -184,6 +184,14 @@ class JSON // * The schema is a nested structure containing dictionaries, // single-element arrays, and strings only. // * Recursively walk the schema. + // * Whenever the schema has an array of length 1 and the object + // does not have an array in the corresponding location, + // validate the object against the array's single element. + // This effectively enables a single element to appear in + // place of an array and be treated as if it were an array of + // one element. This makes it possible to decide later that + // something that used to contain a single element now allows + // an array without invalidating any old data. // * If the current value is a dictionary, this object must have // a dictionary in the same place with the same keys. If flags // contains f_optional, a key in the schema does not have to |