Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the "instance" field in LinkML validation errors #5

Merged
merged 2 commits into from
Sep 16, 2024

Conversation

candleindark
Copy link
Member

This PR removes the "instance" field in each LinkML validation error in serialization, and doing so in a way that the correct schema for the serialization is readily available.

For example, the printout of the following code snippet produces the subsequent schema in which TrimmedValidationResult has no "instance" property.

import json

from dandisets_linkml_status_tools.cli.models import linkml_validation_errs_adapter

print(
    json.dumps(
        linkml_validation_errs_adapter.json_schema(mode="serialization"), indent=2
    )
)
{
  "$defs": {
    "Severity": {
      "description": "Enum to represent the severity of a validation message.",
      "enum": [
        "FATAL",
        "ERROR",
        "WARN",
        "INFO"
      ],
      "title": "Severity",
      "type": "string"
    },
    "TrimmedValidationResult": {
      "properties": {
        "type": {
          "title": "Type",
          "type": "string"
        },
        "severity": {
          "$ref": "#/$defs/Severity"
        },
        "message": {
          "title": "Message",
          "type": "string"
        },
        "instance_index": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Instance Index"
        },
        "instantiates": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Instantiates"
        },
        "context": {
          "items": {
            "type": "string"
          },
          "title": "Context",
          "type": "array"
        }
      },
      "required": [
        "type",
        "severity",
        "message",
        "instance_index",
        "instantiates",
        "context"
      ],
      "title": "TrimmedValidationResult",
      "type": "object"
    }
  },
  "items": {
    "$ref": "#/$defs/TrimmedValidationResult"
  },
  "type": "array"
}

@candleindark candleindark merged commit 00e0514 into dandi:main Sep 16, 2024
1 check passed
@candleindark candleindark deleted the remove-instance-in-linkml-errs branch September 16, 2024 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant