Skip to content

Consistent handling of affordance title fields #218

@rwb27

Description

@rwb27

Currently, we try to use the first line of a docstring as the title of Action and Property affordances. This is used both in the OpenAPI document and the Thing Description. By convention, the first line of a docstring is a summary of the function or property.

While reviewing #215 @julianstirling pointed out this is a slightly confusing way to do things. I have also entertained the idea that it might be neater simply to title-case the name of each affordance to generate the title by default. This would result in rather shorter titles, which is probably in line with what's usually expected.

Currently, the title is used in the Thing Description and OpenAPI documents, the OpenAPI document titles then appear in the SwaggerUI interface. I don't believe either is particularly prominent in the UI of the OpenFlexure Microscope, but in theory one might expect that title would be a reasonable string to put on a button for an action, or to use as a label for a property. I think in both these cases, a title-cased version of name is probably preferable.

We could and should provide a way to set an explicit title (or indeed multilingual titles) in the future, but that's probably not a task for the short term.

I think I have talked myself round to suggesting that name should be turned into title rather than pulling it out of __doc__, but I'm open to other opinions, up to and including the suggestion that we keep the status quo.

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