7. OpenAPI Basics
Explain the role of OpenAPI
Minimal example for GET /api/snippets
paths:
/api/snippets:
get:
summary: List public code snippets
responses:
"200":
description: List of snippets
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Snippet"
"500":
description: Server error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
components:
schemas:
Snippet:
type: object
properties:
id:
type: integer
title:
type: string
contents:
type: string
Error:
type: object
properties:
error:
type: stringLast updated