OpenDataServices / sphinxcontrib-opendataservices-jsonschema

https://sphinxcontrib-opendataservices-jsonschema.readthedocs.io/en/latest/
Other
3 stars 0 forks source link

sphinxcontrib/jsonschema.py: Fix include and collapse logic #60

Closed duncandewhurst closed 1 week ago

duncandewhurst commented 3 weeks ago

The old logic meant that properties beginning with names specified in the include and collapse options would also be included or collapsed.

For example, given the following schema and directive, both id and identifier would be included in the output when only id is specified in the include option:

Schema

{
   "properties": {
      "id": {},
      "identifier": {}
   }
}

Directive

.. jsonschema:: schema.json
   :include: id

Output on main branch:

image

Output on this branch:

image

duncandewhurst commented 3 weeks ago

I don't know how to resolve the pytest error.

Bjwebb commented 2 weeks ago

The change looks good.

As I think you expect, the error looks to be with recent library versions, not the changes here. I'll try to take a look at it later in the week.

Bjwebb commented 1 week ago

I've fixed the tests by setting a project name explicitly, and by not testing the new myst-parser=4.0.0 (I've added a new issue for this https://github.com/OpenDataServices/sphinxcontrib-opendataservices-jsonschema/issues/61). This is now with @odscjames to review.

odscjames commented 1 week ago

No tests for include option existed (in PR or previously), so I added one that also checks the work done here.

odscjames commented 1 week ago

Ah, and changelog. I'll Edit original PR to add one then I'm happy.