liveBook · Manning

Preposition

As explained in API Design Patterns

A preposition is a grammatical word that expresses a relationship between a noun phrase and other elements of a phrase or sentence.

Prepositions such as “with,” “to,” and “for” can make API names readable, but they may also expose an underlying design problem. In resource names, “with” often signals that a response needs optional related data rather than a new resource type. section 3.3.2

Books with related resources

Suppose a Library API lists Book resources and includes their Authors. A resource named BookWithAuthor and an RPC named ListBooksWithAuthors may work initially, but adding Publishers or both relationships multiplies specialized RPCs. Use a field mask or view to select included attributes instead of encoding every combination in a resource name. section 3.3.2

Apply these naming checks:

  • Treat prepositions as design signals, not automatically forbidden words. section 3.3.2
  • When “with” describes selectable response content, prefer a field mask or view over a new combined resource. section 3.3.2
  • Keep legitimate domain names possible; prepositions may still fit fields such as bits_per_second. section 3.3.2

How API Design Patterns covers it

How deep it goes
Explains the naming smell, demonstrates its combinatorial consequence, and recommends field masks or views without implementation detail.
Examples
Uses a Library API with Book, Author, and Publisher resources, including BookWithAuthor and ListBooksWithAuthors.
What you can do after
Evaluate API names and redirect optional related-data selection toward field masks or views when appropriate.
How it connects
Connects prepositions with resource naming, RPCs, field masks, views, and response shapes.

Also explained in

Compare how 2 books explain preposition →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of API Design Patterns. The section links point to the parts of the book it draws on.