Skip to content

Instantly share code, notes, and snippets.

@YusukeIwaki
Created July 19, 2021 12:56
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YusukeIwaki/ce8a7250fb7e5279267c495324de19f7 to your computer and use it in GitHub Desktop.
Save YusukeIwaki/ce8a7250fb7e5279267c495324de19f7 to your computer and use it in GitHub Desktop.
openapi: 3.0.1
info:
title: エンジニア・プログラマにしか使えないSNS
description: |
通常のSNSで胡散臭い人が多いと感じてしまいました
プログラミングスクールが流行り、エンジニアになって億稼いでます!みたいな・・・
そこで、本当のエンジニア・プログラマしか使えないSNSを作ってみました!
つまり、WebApi提供のみのSNSです
一般ピープルが使うようなフロントエンドなんてありません!!
Postmanなり、なんなりを使って叩いてください"
version: 1.0.0
externalDocs:
description: "元記事: エンジニア・プログラマにしか使えないSNSを作ってみた話"
url: https://qiita.com/HawkClaws/items/599d7666f55e79ef7f56
servers:
- url: https://versatileapi.herokuapp.com/api
paths:
/user/create_user:
post:
summary: ユーザ登録
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateUserRequest'
responses:
201:
description: OK
content:
application/json:
schema:
type: object
properties:
id:
type: string
description: ユーザID
put:
summary: ユーザ情報更新(なのにユーザIDを指定しない?!全項目必須?!)
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateUserRequest'
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
id:
type: string
description: ユーザID
/user/{id}:
get:
summary: ユーザ取得(単一)
parameters:
- name: id
in: path
description: ユーザID
required: true
schema:
type: string
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/User'
/user/all:
get:
summary: ユーザ一覧取得
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
/text:
post:
summary: つぶやく
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/TextRequest'
responses:
201:
description: OK
content:
application/json:
schema:
type: object
properties:
id:
type: string
description: TextID
/text/{id}:
get:
summary: つぶやき取得(単一)
parameters:
- name: id
in: path
description: TextID
required: true
schema:
type: string
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Text'
/text/all:
get:
summary: つぶやき一覧取得
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Text'
components:
schemas:
CreateUserRequest:
type: object
properties:
name:
type: string
description: ユーザ名
maxLength: 30
description:
type: string
description: 自己紹介文
maxLength: 300
required:
- name
- description
User:
type: object
properties:
id:
type: string
description: ユーザID
name:
type: string
description: ユーザ名
description:
type: string
description: 自己紹介文
_user_id:
type: string
description: ユーザID
_created_at:
type: string
description: 登録日時
_updated_at:
type: string
description: 最終更新日時
TextRequest:
type: object
properties:
text:
type: string
description: 投稿する文章
minLength: 1
maxLength: 280
in_reply_to_user_id:
type: string
description: 返信対象のUserId
minLength: 40
maxLength: 40
in_reply_to_text_id:
type: string
description: 返信対象のTextId
minLength: 36
maxLength: 36
required:
- text
- description
Text:
type: object
properties:
id:
type: string
description: TextID
text:
type: string
description: つぶやき
in_reply_to_user_id:
type: string
description: 返信対象のUserId
in_reply_to_text_id:
type: string
description: 返信対象のTextId
_user_id:
type: string
description: ユーザID
_created_at:
type: string
description: 投稿日時
_updated_at:
type: string
description: 最終更新日時
securitySchemes:
authorization_helloworld:
type: apiKey
in: header
name: Authorization