Skip to content

No needs results in broken needs.json #1569

@a-zw

Description

@a-zw

If a documentation contains no needs elements, you can still build a needs.json file and use it elsewhere. The consumer breaks though:

Traceback (most recent call last):
  File .../_main/bazel-out/k8-fastbuild/bin/docs.runfiles/.docs.venv/lib/python3.12/site-packages/sphinx_needs/external_needs.py", line 97, in load_external_needs
    data = needs_json["versions"][version]
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
KeyError: '0.1.0'

The needs.json file in my case looked like this:

{"current_version": "0.1.0", "project": "foo", "project_url": "https://bar", "versions": {}}

Judging from exception above, it should work if it were:

{"current_version": "0.1.0", "project": "foo", "project_url": "https://bar", "versions": {"0.1.0": {}}}

Alternatively, the consumer code could be made more robust or both?

Worked around here: https://github.com/eclipse-score/reference_integration/pull/28/files#diff-3053677e4333a96b20ed76c662bca07fb2e1ce059479170139209356787da09cR20

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions