6 / 7 · Book 14 · Exercises · drill: interview Q&A← prev⊞ allnext →Get the book →
1.9Question 2
Prompt: A developer tells you their API does not need an OpenAPI spec because "the code is the documentation." How do you push back, and what testing risks does the absence of a spec create?
What a strong answer should cover:
- Concrete testing impact: no auto-generated Postman collections, no schema validation, no contract testing
- Team-wide costs: every new tester has to reverse-engineer the API by reading code or asking developers
- Drift risk: without a spec, the actual behavior and the intended behavior diverge silently
- Pragmatic compromise: even a minimal spec is better than none
Example answer:
- "Without an OpenAPI spec, I cannot auto-generate Postman collections, so every endpoint has to be discovered manually -- which is slow and error-prone."
- "More importantly, I lose the ability to do schema validation in tests. Instead of validating responses against a contract, I am guessing at what fields should be present. When the developer adds or removes a field, my tests do not catch it unless I manually update expectations."
- "I would propose a compromise: let me generate a spec from the existing code using a tool like swagger-autogen or FastAPI's built-in spec generation. That gives us a starting point without requiring the developer to write it from scratch."