Skip to content

schema: additionalProperties leads to error #1723

Description

@danwos

When I have the following schema with additionalProperties:

{
  "schemas": [
    {
      "id": "req-must-have-status-and-tags",
      "severity": "info",
      "message": "Requirements must have status and tags defined",
      "select": {
        "properties": {
            "type": {
            "const": "req"
      }}},
      "validate": {
        "local": {
          "required": [
            "status"
          ],
          "properties": {
            "status": {
              "type": "string",
              "minLength": 1
            }
          },
          "additionalProperties": false
}}}]}

I get this traceback with Sphinx-Needs 8.1.1:

Traceback
=========

      File "/home/daniel/workspace/sphinx/sphinx-needs-demo/.venv/lib/python3.12/site-packages/sphinx_needs/schema/config_utils.py", line 131, in resolve_schemas_config
        raise NeedsConfigException(
    sphinx_needs.exceptions.NeedsConfigException: Schemas entry 'req-must-have-status-and-tags[0]' is not valid:
    {"additionalProperties":false,"properties":{"status":{"minLength":1,"type":"string"}},"required":["status","rere"],"type":"object"} is not valid under any of the schemas listed in the 'anyOf' keyword
    
    Failed validating "anyOf" in schema["properties"]["validate"]["$ref"]["properties"]["local"]
    
    On instance["validate"]["local"]:
        {"additionalProperties":false,"properties":{"status":{"minLength":1,"type":"string"}},"required":["status","rere"],"type":"object"}

Doing the check with ubc runs without an error.

Questions

  • Is the usage of additionalProperties correct?
  • Is the error message meaningful and what shall it tell me?

The test was done with the Sphinx-Needs-Demo project, there I have created a test branch:
https://github.com/useblocks/sphinx-needs-demo/tree/str_test

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions