Skip to content

Instantly share code, notes, and snippets.

@chamilaadhi
Created July 8, 2025 15:57
Show Gist options
  • Select an option

  • Save chamilaadhi/4475f919d6ee4256a14c77f519d05ff8 to your computer and use it in GitHub Desktop.

Select an option

Save chamilaadhi/4475f919d6ee4256a14c77f519d05ff8 to your computer and use it in GitHub Desktop.
openapi: 3.0.0
info:
title: Vehicles
description: A simple API to retrieve vehicle information.
version: 1.0.0
servers:
- url: https://686d3e17c9090c495385b953.mockapi.io
description: Mock API server
paths:
/vehicles:
get:
summary: Get a list of all vehicles
description: Returns a list of all vehicles in the database.
responses:
'200':
description: A successful response with a list of vehicles.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Vehicle'
/vehicles/{id}:
get:
summary: Get a single vehicle by ID
description: Returns a single vehicle object based on its unique ID.
parameters:
- name: id
in: path
required: true
description: The ID of the vehicle to retrieve.
schema:
type: string
responses:
'200':
description: A successful response with a single vehicle object.
content:
application/json:
schema:
$ref: '#/components/schemas/Vehicle'
'404':
description: Vehicle not found.
components:
schemas:
Vehicle:
type: object
properties:
id:
type: string
description: The unique identifier for the vehicle.
example: "1"
model:
type: string
description: The model of the vehicle.
example: "ATS"
type:
type: string
description: The type or body style of the vehicle.
example: "Wagon"
manufacturer:
type: string
description: The manufacturer of the vehicle.
example: "Maserati"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment