Skip to content

Instantly share code, notes, and snippets.

@borsch
Created March 18, 2022 10:11
Show Gist options
  • Save borsch/ab2f0041d60c318963fcf578c09fc3c5 to your computer and use it in GitHub Desktop.
Save borsch/ab2f0041d60c318963fcf578c09fc3c5 to your computer and use it in GitHub Desktop.
openapi: 3.0.3
info:
title: API
version: '1.0'
components:
schemas:
Attachment:
title: Attachment
type: object
description: Attachments - file management system
properties:
id:
type: string
pattern: '^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$'
example: 2ceacea5-6831-48f0-856a-3551d375fd89
type:
$ref: '#/components/schemas/AttachmentType'
link:
type: string
pattern: '^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)$'
required:
- id
- type
- link
AttachmentType:
title: AttachmentType
type: object
description: 'Type of attachment (example, solution, etc)'
properties:
id:
type: string
pattern: '^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$'
example: 383a40fd-9fdb-467b-a1bb-1b1432fa73e0
typeName:
type: string
required:
- id
- typeName
CreatePageBody:
type: object
properties:
attachments:
type: array
items:
$ref: '#/components/schemas/Attachment'
link:
type: string
pattern: '^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()!@:%_\+.~#?&\/\/=]*)$'
Whoami200Response:
type: object
properties:
username:
type: string
paths:
'/pages/{subject}':
post:
summary: Create new page
responses:
201:
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/Whoami200Response'
operationId: post-pages
description: |-
Create new pages and return it
Access level: Captains+
parameters: []
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreatePageBody'
parameters:
- schema:
type: string
name: subject
in: path
required: true
description: ID of subject
/whoami:
get:
summary: Gets username of current user
tags:
- persons
responses:
'200':
$ref: '#/components/responses/Whoami200Response'
operationId: get-whoami
description: |-
Gets username of current user
Access level: Any user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment