Generating and exposing machine- and human-readable documentation for RESTful APIs is a must, and those built with Spin are no exception. The OpenAPI Specification (OAS) is the de facto standard when it comes to documenting RESTful APIs. In this article, we will explore how to generate OAS-compliant documentation from within Spin applications written in Rust. Before diving straight into a practical example, we’ll do a quick refresher on what OAS actually is. What is the OpenAPI Specification (OAS)? The OpenAPI Specification (OAS) serves as a universal, language-agnostic standard for describing the structure and features of RESTful APIs. By establishing a clear, machine- and human-readable contract, OAS allows developers, API consumers, and tools to understand available endpoints, request and response schemas, authentication methods, and more.…