Skip to content

refactor: Move cleaning/validation functions from SiloQueryModel further up the call stack, into the controllers. #1452

@fhennig

Description

@fhennig

In SiloQueryModel there is the getGenomicSequences function which uses two functions (mapSequenceNames, mapSequenceOrderByFields) to clean up/change cases of user input.

I think we should move these closer to the API endpoints.

For OrderByFields we actually have the OrderByFieldConverter which is used for get requests. It also does cleaning internally, but just for regular fields. There is actually this line:

fun clean(fieldName: String): String = caseInsensitiveFieldsCleaner.clean(fieldName) ?: fieldName

which is also not so elegant, because we're cleaning a few fields, but then if we don't know the field, we just pass it through. Apparently, in the passed-through fields could be sequence names. It would be good to instead move the logic from mapSequenceOrderByFields here (if possible), so it's all in one space. And we could actually reject user input that is neither a field, nor a sequence name.

For mapSequenceNames, this is also quite similar to the way we check for order by fields. Instead of a List<String> we could use a List<Gene> and use a Converter that validates the given gene input already at the API endpoint level.

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