Skip to content

Instantly share code, notes, and snippets.

@alehed
Last active September 14, 2021 19:59
Show Gist options
  • Save alehed/e5eb44e14f0dcf38a430421e62f9aa12 to your computer and use it in GitHub Desktop.
Save alehed/e5eb44e14f0dcf38a430421e62f9aa12 to your computer and use it in GitHub Desktop.
openapi: "3.0.0"
info:
version: 1.0.0
title: The Star Wars API
servers:
- url: https://swapi.dev/api/
paths:
/planets:
get:
tags:
- swapi
operationId: getPlanets
responses:
"200":
description: List of planets
content:
application/json:
schema:
$ref: "#/components/schemas/PlanetList"
/planets/{planetId}:
get:
tags:
- swapi
operationId: getPlanet
parameters:
- name: planetId
in: path
description: Planet ID
required: true
schema:
type: integer
responses:
"200":
description: Planet name
content:
application/json:
schema:
$ref: "#/components/schemas/Planet"
components:
schemas:
Planet:
type: string
description: Planet name
PlanetList:
type: array
description: List of planets
items:
$ref: "#/components/schemas/Planet"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment