Skip to content

Commit 1ebf6a4

Browse files
authored
Merge pull request #57 from OpenDataServices/56-array-row-missing
jsonschema: Output row for an array even if items property is missing
2 parents c166a00 + 3f4c306 commit 1ebf6a4

File tree

5 files changed

+27
-2
lines changed

5 files changed

+27
-2
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## [Unreleased]
88

9+
## [0.6.1] - 2023-10-18
10+
11+
### Fixed
12+
13+
- Output row for an array even if items property is missing https://github.com/OpenDataServices/sphinxcontrib-opendataservices-jsonschema/issues/56
14+
915
## [0.6.0] - 2023-08-31
1016

1117
### Changed

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
setup(
88
name='sphinxcontrib-opendataservices-jsonschema',
9-
version='0.6.0',
9+
version='0.6.1',
1010
url='https://github.com/OpenDataServices/sphinxcontrib-opendataservices-jsonschema',
1111
license='BSD',
1212
author='Takeshi KOMIYA & Open Data Services Co-operative',

sphinxcontrib/jsonschema.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,9 @@ def validations(self):
430430

431431
def __iter__(self):
432432
if self.items is None:
433-
return
433+
# array object itself
434+
array = Array(self.name, self.attributes, required=self.required, parent=self.parent)
435+
yield array
434436
elif isinstance(self.items, dict):
435437
item = JSONSchema.instantiate(self.name + '/0', self.items, parent=self)
436438

tests/examples/basic.html

+13
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,19 @@
8383
<p>None</p>
8484
</td>
8585
</tr>
86+
<tr class="row-even">
87+
<td colspan="2"><code class="docutils literal notranslate" id="test.json,,otherNames"><span class="pre">otherNames</span></code></td>
88+
<td colspan="1">
89+
<p>array</p>
90+
</td>
91+
<td colspan="1"></td>
92+
<td colspan="1"></td>
93+
</tr>
94+
<tr class="row-odd">
95+
<td colspan="1">
96+
<p>None</p>
97+
</td>
98+
</tr>
8699
</tbody>
87100
</table>
88101
</div>

tests/examples/basic/subdir/test.json

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
"items" : {
2121
"type" : "string"
2222
}
23+
},
24+
"otherNames" : {
25+
"meta_description": "Test an array that doesn't have items",
26+
"type" : "array"
2327
}
2428
},
2529
"required": ["otherContacts"],

0 commit comments

Comments
 (0)