Skip to content

Instantly share code, notes, and snippets.

@piti118
Created February 15, 2024 08:03
Show Gist options
  • Save piti118/e7406dfda8c1e36c1be26e7e2f8d1af4 to your computer and use it in GitHub Desktop.
Save piti118/e7406dfda8c1e36c1be26e7e2f8d1af4 to your computer and use it in GitHub Desktop.
openapi: '3.0.2'
info:
title: API Title
version: '1.0'
servers:
- url: https://api.server.test/v1
paths:
/what-time-is-it:
get:
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Time'
/students:
get:
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
students:
type: array
items:
$ref: '#/components/schemas/Student'
status:
type: string
example: "ok"
/students/{id}:
get:
parameters:
- name: id
in: path
required: true
schema:
type: integer
example: 1
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Student'
'404':
description: Not Found
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: "not found"
required:
- status
additionalProperties: false
components: # $ref: '#/components/schemas/Pet
schemas:
Time:
type: object
properties:
date:
type: integer
example: 12
month:
type: string
example: January
year:
type: integer
example: 2011
Student:
type: object
properties:
id:
type: integer
example: 1
name:
type: string
example: John Doe
year:
type: integer
example: 21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment