This repository contains a process to download the Quivo API OpenAPI specification and enhance it using OpenAPI Overlays.
An OpenAPI Overlay is a specification that allows you to apply modifications to an existing OpenAPI document without directly editing it. This is useful for:
- Adding descriptions and documentation
- Adding examples to requests/responses
- Enhancing metadata (tags, operation IDs, etc.)
- Maintaining customizations separately from the source spec
- Python 3.7 or higher
- pip (Python package manager)
- Install required dependencies:
pip install -r requirements.txtEdit overlay.yaml to add your desired modifications. The file contains examples for common operations:
overlay: 1.0.0
info:
title: Quivo API Overlay
version: 1.0.0
actions:
# Add description to an endpoint
- target: $.paths./your-endpoint.get
update:
description: "Your description here"
summary: "Brief summary"
# Add request body example
- target: $.paths./your-endpoint.post.requestBody.content.application/json
update:
example:
field1: "value"
field2: 123Execute the script to download, enhance, and save the OpenAPI specification:
python apply_overlay.pyThis will:
- Download the OpenAPI spec from:
https://s3-eu-west-1.amazonaws.com/quivo-connector-prod-api-docs/swagger.json - Apply the transformations defined in
overlay.yaml - Save the enhanced specification to
openapi-enhanced.json
The enhanced OpenAPI specification will be saved as openapi-enhanced.json in the current directory.
The overlay file uses JSONPath-like syntax to target specific parts of the OpenAPI spec:
$.info- Targets the info object$.paths./endpoint.get- Targets a specific GET operation$.paths./endpoint.post.requestBody.content.application/json- Targets request body content$.paths./endpoint.get.responses.200- Targets a specific response
- target: $.info
update:
description: "Enhanced API description"- target: $.paths./users.get
update:
summary: "List all users"
description: "Retrieves a paginated list of all users"- target: $.paths./users.post.requestBody.content.application/json
update:
example:
name: "John Doe"
email: "john@example.com"- target: $.paths./users.get.responses.200.content.application/json
update:
example:
- id: 1
name: "John Doe"
- id: 2
name: "Jane Smith".
├── apply_overlay.py # Main script to download and apply overlay
├── overlay.yaml # Overlay specification with your customizations
├── requirements.txt # Python dependencies
├── openapi-enhanced.json # Output file (generated)
└── README.md # This file
If you get connection errors when downloading the spec, check:
- Your internet connection
- The URL is accessible:
https://s3-eu-west-1.amazonaws.com/quivo-connector-prod-api-docs/swagger.json
If your overlay changes aren't showing up:
- Verify the target path matches the structure in the original spec
- Check the YAML syntax in
overlay.yaml - Look at the console output for any error messages
Make sure you're using Python 3.7 or higher:
python --version- Explore the downloaded
openapi-enhanced.jsonto see your API structure - Add more overlay actions to enhance documentation
- Use the enhanced spec with tools like Swagger UI, Redoc, or API clients