Skip to content

Consider generalizing the external link property to reduce custom front-end code #621

@bencap

Description

@bencap

With more than one item in the external link field now (UCSC, IGVF), we might consider generalizing the external link type to include more information for the UI to display.

The item could look more similar to:

class ExternalLinkItem(BaseModel):
    label: str = Field(..., description="Human-readable label for the link")
    url: HttpUrl = Field(..., description="Absolute URL for the external resource")
    source: Optional[str] = Field(None, description="Optional source/system for this link (e.g., IGVF, GEO)")
    icon: Optional[str] = Field(None, description="Optional icon key for UI")
    type: Optional[str] = Field(None, description="Optional tag to group/filter links")

    @field_validator("label")
    @classmethod
    def _strip_label(cls, v: str) -> str:
        v = v.strip()
        if not v:
            raise ValueError("label cannot be empty")
        return v

This would allow the interface to write less dedicated code for each individual external link, increasing maintainability and reducing duplication.

Metadata

Metadata

Assignees

No one assigned

    Labels

    app: backendTask implementation touches the backendapp: frontendTask implementation touches the frontendtype: discussionTeam discussion requiredtype: enhancementEnhancement to an existing feature

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions