Skip to content

Commit

Permalink
Merge pull request #57 from OpenDataServices/56-array-row-missing
Browse files Browse the repository at this point in the history
jsonschema: Output row for an array even if items property is missing
  • Loading branch information
Bjwebb authored Oct 23, 2023
2 parents c166a00 + 3f4c306 commit 1ebf6a4
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [0.6.1] - 2023-10-18

### Fixed

- Output row for an array even if items property is missing https://github.com/OpenDataServices/sphinxcontrib-opendataservices-jsonschema/issues/56

## [0.6.0] - 2023-08-31

### Changed
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name='sphinxcontrib-opendataservices-jsonschema',
version='0.6.0',
version='0.6.1',
url='https://github.com/OpenDataServices/sphinxcontrib-opendataservices-jsonschema',
license='BSD',
author='Takeshi KOMIYA & Open Data Services Co-operative',
Expand Down
4 changes: 3 additions & 1 deletion sphinxcontrib/jsonschema.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,9 @@ def validations(self):

def __iter__(self):
if self.items is None:
return
# array object itself
array = Array(self.name, self.attributes, required=self.required, parent=self.parent)
yield array
elif isinstance(self.items, dict):
item = JSONSchema.instantiate(self.name + '/0', self.items, parent=self)

Expand Down
13 changes: 13 additions & 0 deletions tests/examples/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,19 @@
<p>None</p>
</td>
</tr>
<tr class="row-even">
<td colspan="2"><code class="docutils literal notranslate" id="test.json,,otherNames"><span class="pre">otherNames</span></code></td>
<td colspan="1">
<p>array</p>
</td>
<td colspan="1"></td>
<td colspan="1"></td>
</tr>
<tr class="row-odd">
<td colspan="1">
<p>None</p>
</td>
</tr>
</tbody>
</table>
</div>
Expand Down
4 changes: 4 additions & 0 deletions tests/examples/basic/subdir/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
"items" : {
"type" : "string"
}
},
"otherNames" : {
"meta_description": "Test an array that doesn't have items",
"type" : "array"
}
},
"required": ["otherContacts"],
Expand Down

0 comments on commit 1ebf6a4

Please sign in to comment.