Omnihedron

Naming Conventions

How omnihedron maps PostgreSQL names to GraphQL names (PostGraphile-compatible)

All naming logic lives in src/schema/inflector.rs and must match PostGraphile's conventions exactly. Existing clients depend on these names being identical.

snake_case to camelCase

  • Leading underscores are preserved: _my_field_myField
  • Consecutive uppercase runs are normalised: cumulative_volume_u_s_dscumulativeVolumeUsds

snake_case to PascalCase

Same rules as camelCase, but the initial character is uppercased: asset_teleportedAssetTeleported.

Pluralisation rules

Some non-obvious cases:

InputOutputRule
metadatummetadataLatin neuter
responsesresponseVowel-before-S (not respons)
V2V2sDigit suffix gets lowercase s
CumulativeVolumeUSDSCumulativeVolumeUsdsConsecutive uppercase normalised

Table to field names

Given a table transfers:

PurposeName
GraphQL typeTransfer
Connection querytransfers
Single querytransfer
Connection typeTransferConnection
Edge typeTransferEdge
Filter typeTransferFilter
OrderBy enumTransfersOrderBy
Distinct enumTransfersDistinctEnum

Relation field names

Forward relations

The FK column name with _id stripped, then camelCased.

Example: FK column account_id → field name account.

Backward relations

Pattern: {relatedEntitiesPlural}By{FkColumn}

Example: accounts table has FK creator_id → users.id → the User type gets a field accountsByCreatorId.

If the FK has a unique constraint (one-to-one), the backward relation returns a single record instead of a connection.

Enum type names

PostgreSQL enum type names go through a separate path that replicates PostGraphile's coerceToGraphQLName + lodash upperCamelCase:

  1. Prepend _ if the name starts with a digit
  2. Apply upperCamelCase with digit→letter transitions as word boundaries

This handles SubQuery's blake2 10-character hex hash enum names:

869e90c211 → _869E90C211

This logic is separate from regular to_camel_case — the digit→letter split only applies to enum type names.

OrderBy enum values

Standard columns: {COLUMN_NAME}_ASC / {COLUMN_NAME}_DESC

Forward-relation scalar ordering: {SINGULAR_TABLE}_BY_{FK_COL}__{TARGET_COL}_ASC / _DESC

Example: TEST_AUTHOR_BY_CREATOR_ID__NAME_ASC

On this page