Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DavidBiesack/cdcb51e60268fe466f8845b09e07d6db to your computer and use it in GitHub Desktop.
Save DavidBiesack/cdcb51e60268fe466f8845b09e07d6db to your computer and use it in GitHub Desktop.
chainLinkItem schema composition with contentField.yaml
openapi: 3.0.3
info:
title: Chain Links
version: 0.0.0
description: chain links API
tags:
- name: Chain Links
description: Story Element Items in a CHain
servers:
- url: https://api.chain-links.io/
paths:
/chainLinks:
get:
operationId: listChainLinks
summary: List the chain links
description: :-
Return a paginated list of the
chain links in the system.
tags: [ 'Chain Links' ]
responses:
'200':
description: OK. The operation succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/chainLinks'
components:
schemas:
chainLinks:
title: Chain Links
description: >-
A page of chain link items from a
collection of chain links.
type: object
required: [ items ]
properties:
items:
title: Chain Link Items
description: A list of chain links in this page
type: array
maxItems: 10000
items:
$ref: '#/components/schemas/chainLinkItem'
example:
items:
- id: cl-2343-fjke
type: text
authorId: au-49j4d-3jch3
createdAt: '2023-06-06T17:39:21.375Z'
chains_url: /chain?chainLinks=cl-2343-fjke
chainLinkItem:
title: Chain Link Item
description: >-
A concise representation of
a chain link item in a list of chain links.
type: object
required:
- id
- type
- authorId
- createdAt
properties:
id:
description: >-
This chain link's unique resource identifier.
type: string
minLength: 4
maxLength: 48
pattern: ^[-_a-zA-Z0-9:+$]{4,48}$
type:
description: >-
Describes what type of chain link this is.
type: string
authorId:
description: >-
The ID of the author who created this chain link.
type: string
minLength: 4
maxLength: 48
pattern: ^[-_a-zA-Z0-9:+$]{4,48}$
createdAt: >-
description: The [https://www.rfc-editor.org/rfc/rfc3339#section-5](date-time)
when this chain link was created.
type: string
format: date-time
chainLink:
title: A Chain Link
description: >-
Representation of one chain link which can be used
in multiple story chains.
allOf:
- $ref: '#/components/schemas/chainLinkItem'
- $ref: '#/components/schemas/chainLinkContentField'
- type: object
required:
# - content
- chains_url
properties:
chains_url:
description: >-
A link to the API operation to return the paginated
list of chains in which that this chain link is used.
type: string
format: uri
maxLength: 256
example:
id: cl-2343-fjke
type: text
authorId: au-49j4d-3jch3
createdAt: '2023-06-06T17:39:21.375Z'
chains_url: /chain?chainLinks=cl-2343-fjke
chainLinkContent:
type: object
properties:
plainText:
type: string
maxLength: 5000
richText:
type: string
format: commonmark
maxLength: 5000
image:
type: string
format: byte
imageCaption:
type: string
format: commonmark
maxLength: 500
chainLinkContentField:
type: object
required:
- content
properties:
content:
$ref: '#/components/schemas/chainLinkContent'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment