Skip to content

Display names

Adam Mahmood edited this page Sep 12, 2018 · 2 revisions

Introduction

This wiki page captures current design thinking about how consistent display names would be implemented from a technical point of view.

Background

We have inconsistent display values scattered through the author application. In some places we display titles, in other places we display labels and in other places we have inconsistent unnamed or untitled placeholders.

This technical improvement makes it the responsibility of the API to provide the most relevant displayable value.

GraphQL schema

The team are proposing adding a new field to types that need to be displayed which returns a non-nullable string. e.g.

type QuestionPage {
  id: ID!
  displayName: String!
}

type Answer {
  id: ID!
  displayName: String!
}

Assumptions

  • The displayName field will be resolved to the most appropriate value for the type. i.e. For Answers it may return the answer label, for QuestionPages it may return the question title.
  • The field will attempt to resolve a value in a predictable and consistent order: e.g. if Alias is supplied it will return the alias if Alias is not supplied it will fall back to label if title is not supplied it will fall back to "Untitled Answer" (or whatever is most appropriate)
  • The format "Untitled [entity]" should be used as the default fallback.
  • There is no need to update the displayName in a mutation. It is a computed field that can be queried.
  • There is no need to persist the displayName. It is already stored by alias/title/label etc.
  • There is no need to query alias in publisher. It is just a consistent display value used throughout Author.
Clone this wiki locally