x-uigen-label
The x-uigen-label annotation overrides the display label that UIGen generates for a field, operation, or resource. By default, UIGen derives labels from property names and operation summaries using title-case conversion.
Purpose
Use x-uigen-label when:
- The property name is a technical identifier (e.g.
usr_id,created_at) - You want a more user-friendly label than the auto-generated one
- You need to localise labels without changing the spec's property names
Supported locations
| Location | Effect |
|---|---|
| Schema property | Overrides the field label in forms and tables |
| Schema object | Overrides the resource name in the sidebar and headings |
| Operation | Overrides the operation label in action buttons and page titles |
| Path item | Overrides the label for all operations on that path |
Precedence
When x-uigen-label appears at multiple levels, the most specific wins:
Operation > Path item > Schema property > Schema object
OpenAPI 3.x examples
Field label
components:
schemas:
User:
type: object
properties:
usr_id:
type: integer
x-uigen-label: User ID
created_at:
type: string
format: date
x-uigen-label: Created
Resource label
components:
schemas:
usr:
type: object
x-uigen-label: User
properties:
id:
type: integer
Operation label
paths:
/users/{id}/activate:
post:
summary: activate_user
x-uigen-label: Activate User
Swagger 2.0 examples
Field label
definitions:
User:
type: object
properties:
usr_id:
type: integer
x-uigen-label: User ID
Operation label
paths:
/users/{id}/activate:
post:
summary: activate_user
x-uigen-label: Activate User
Default label generation
Without x-uigen-label, UIGen generates labels by:
- Splitting the property name on
_,-, and camelCase boundaries - Title-casing each word
- Joining with spaces
For example: created_at → Created At, firstName → First Name.