Skip to content

Conversation

@bilalebi
Copy link
Contributor

@bilalebi bilalebi commented Nov 18, 2025

Description

Added a @model_validator so the type field is now derived from organism.strainType strain before model parsing, ensuring downstream fields receive the synthesized object only when present.
Removed the manual type injection from GenomeDetails.__init__, letting the validator handle it consistently for all subclasses.

Related JIRA Issue(s)

https://embl.atlassian.net/browse/ENSPLAT-272

Example(s)

Before

{
  "genome_id": "8bce37f6-5353-4fb4-962f-f7e9a6c4303d",
  ...
  "type": null,   <--- Boooh!
  ...
  "latest_genome": {
    "genome_id": "ce9c01fe-1d5c-4fea-a96a-b8eb3c3586f4",
    ...
    "type": null,   <--- Boooh!
    ...
  }
}

After

{
  "genome_id": "8bce37f6-5353-4fb4-962f-f7e9a6c4303d",
  ...
  "type": {             <-- Fixed!
    "kind": "strain",
    "value": "C57BL/6J"
  },
  "latest_genome": {
    "genome_id": "ce9c01fe-1d5c-4fea-a96a-b8eb3c3586f4",
    ...
    "type": {             <-- Fixed!
      "kind": "strain",
      "value": "C57BL/6J"
    },
    ...
  }
}

@bilalebi bilalebi self-assigned this Nov 18, 2025
@azangru azangru changed the title Fix null type in explain andpoint Fix null type in explain endpoint Nov 19, 2025
@bilalebi bilalebi merged commit c1cf5eb into main Nov 20, 2025
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.

4 participants