API / Swagger Interview questions
What is the purpose of Swagger?
Swagger's core purpose is to make API documentation a byproduct of a structured, machine-readable definition rather than a manually written document that has to be kept in sync by hand every time the API changes.
Because the definition describes every endpoint, parameter, request body, and response shape in a standard format, that same source of truth can drive several different needs at once: human-readable documentation via Swagger UI, generated client libraries in multiple languages via code generation tools, automated request/response validation, and even mock servers for frontend teams to develop against before the real backend is finished.
This matters most on teams with more than a handful of API consumers, where documentation drift — docs describing behavior the API no longer actually has — becomes a real, recurring source of integration bugs; a spec-driven approach makes the documentation testable and enforceable rather than purely descriptive.
More Related questions...