Skip to content

Generating API Documentation in Martini

Introduction

Documenting a public API is essential for its usability and understanding by external developers. Martini simplifies this process, allowing for direct integration of documentation within the API configuration.

The Importance of API Documentation

  • Functionality Explanation: Helps developers understand what the API does.
  • Request Configuration Guidance: Informs about acceptable request structures.
  • Response Clarity: Clarifies expected responses.

Prerequisites

  • Existing API: This guide assumes you have an already created API. Refer to the "Creating an API" documentation if needed.

Documentation Process in Martini

  1. General and Documentation Information:

    • Populate fields under the General and Documentation tabs.
    • These details contribute to Swagger, OpenAPI, and Postman definitions.
  2. Documenting Paths:

    • For each path, provide values for Description and Summary by double-clicking the Value column.
    • Description vs. Summary: Use Description for detailed path information and Summary for a concise overview.
  3. Documenting Operations:

    • Expand the operation node and fill in Description and Summary.
    • Martini defaults to the service's comment if Description is left empty.
  4. Parameter and Response Documentation:

    • For each parameter, add a Description by editing its Value column.
    • Similar process applies to responses; descriptions default to comments on output properties if left empty.

Previewing Your Documentation

To preview the documentation you have created: - Click on the Documentation tab within the Martini interface. - Click on the URL displayed to view your API documentation.