Dochia Logo

ochia CLI

[INFO] Bringing Chaos with Love

I Like Enums, but I’ve Stopped Calling Them Closed

Enums feel wonderfully closed inside a codebase, where the compiler knows every possible value. Across an API boundary, that guarantee disappears: a new value can break generated clients, vanish in application logic, or complicate database migrations. This article looks at how OpenAPI, Java, PostgreSQL, and protobuf handle that gap—and how to test for the enum value that does not exist yet.

OpenAPI as a Single Source of Truth for APIs

By treating the OpenAPI specification as the single source of truth, teams can design APIs up front, generate always-accurate documentation, enforce contract-based tests, and even auto-produce client SDKs and server stubs across languages. This eliminates drift between code, tests, and docs, reduces duplication, and creates a shared foundation that streamlines collaboration throughout the API lifecycle.

Ready to make your APIs unbreakable?

Get Started with Dochia