2020-09-18 01:07:26 +00:00
|
|
|
---
|
|
|
|
openapi: "3.0.2"
|
|
|
|
info:
|
|
|
|
version: 0.1.0
|
2021-10-28 23:03:09 +00:00
|
|
|
title: Fresnel Lens
|
2020-09-18 01:07:26 +00:00
|
|
|
description: >-
|
2021-05-06 05:36:43 +00:00
|
|
|
A simple HTTP service for mucking about with images. This is a super basic HTTP
|
2021-10-28 22:33:41 +00:00
|
|
|
service for autogenerating website-ready banner and preview images from full-size
|
2021-05-06 05:36:43 +00:00
|
|
|
source images. The generated images are automatically cached with deterministic
|
|
|
|
URLs.
|
2020-09-18 01:07:26 +00:00
|
|
|
license:
|
|
|
|
name: MIT
|
|
|
|
url: https://mit-license.org/
|
|
|
|
x-anchors:
|
|
|
|
DefaultHeaders: &headers-default
|
2021-10-28 22:33:41 +00:00
|
|
|
Server:
|
2020-09-18 01:07:26 +00:00
|
|
|
$ref: "#/components/headers/Version"
|
|
|
|
OptionsResponses: &responses-options
|
|
|
|
'204':
|
|
|
|
description: "Available HTTP verbs in header, per RFC 7231"
|
|
|
|
headers:
|
|
|
|
Allowed:
|
|
|
|
$ref: "#/components/headers/Allowed"
|
|
|
|
'500':
|
|
|
|
$ref: "#/components/responses/InternalServerError"
|
2021-10-28 22:33:41 +00:00
|
|
|
ImageHeaders: &headers-image
|
|
|
|
<<: *headers-default
|
|
|
|
Digest:
|
|
|
|
description: SHA256 hash of the provided image content
|
|
|
|
schema:
|
|
|
|
type: string
|
|
|
|
format: sha256
|
2021-10-28 23:35:56 +00:00
|
|
|
example: sha-256=f2bf647325d5a6ad2d7ca138293f9cb224dd863fde0e3fa46bc5c15b43fece5c
|
2021-10-28 22:33:41 +00:00
|
|
|
Content-Type:
|
|
|
|
description: Content type of the image being returned
|
|
|
|
schema:
|
|
|
|
type: string
|
|
|
|
enum: [image/jpeg, image/png]
|
|
|
|
Cache-Control:
|
|
|
|
description: Cache settings for the image to prevent unnecessary reloads
|
|
|
|
schema:
|
|
|
|
type: string
|
|
|
|
example: public, max-age=604800, immutable
|
2020-09-18 01:07:26 +00:00
|
|
|
paths:
|
|
|
|
/openapi.json:
|
|
|
|
get:
|
|
|
|
summary: Retrieve the OpenAPI specification file
|
|
|
|
operationId: OpenAPI
|
|
|
|
tags: ["meta"]
|
|
|
|
responses:
|
|
|
|
'200':
|
|
|
|
description: Contents of the OpenAPI spec file
|
|
|
|
headers: *headers-default
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
type: object
|
2021-10-28 22:33:41 +00:00
|
|
|
/heartbeat:
|
|
|
|
head:
|
|
|
|
summary: Check whether the service is online
|
|
|
|
operationId: Heartbeat
|
|
|
|
tags: ["meta"]
|
|
|
|
responses:
|
|
|
|
'200':
|
|
|
|
description: Server is operational
|
|
|
|
headers: *headers-default
|
|
|
|
'500':
|
|
|
|
description: Server is not operating correctly
|
|
|
|
headers: *headers-default
|
|
|
|
/image/{image_name}:
|
|
|
|
head:
|
|
|
|
summary: Returns metadata about the image request
|
|
|
|
operationId: ImageHead
|
|
|
|
tags: ["meta"]
|
2021-05-06 05:36:43 +00:00
|
|
|
parameters:
|
|
|
|
- $ref: "#/components/parameters/ImageName"
|
|
|
|
- $ref: "#/components/parameters/ImageFormat"
|
|
|
|
responses:
|
|
|
|
'200':
|
2021-10-28 22:33:41 +00:00
|
|
|
$ref: "#/components/responses/ImageMeta"
|
|
|
|
'401':
|
|
|
|
$ref: "#/components/responses/UnauthenticatedError"
|
2021-05-06 05:36:43 +00:00
|
|
|
'404':
|
|
|
|
$ref: "#/components/responses/NotFoundError"
|
2021-10-28 22:33:41 +00:00
|
|
|
'405':
|
|
|
|
$ref: "#/components/responses/MethodNotAllowedError"
|
2021-05-06 05:36:43 +00:00
|
|
|
'410':
|
|
|
|
$ref: "#/components/responses/DeletedError"
|
2021-10-28 22:33:41 +00:00
|
|
|
'422':
|
|
|
|
$ref: "#/components/responses/UnacceptableError"
|
2021-05-06 05:36:43 +00:00
|
|
|
'500':
|
|
|
|
$ref: "#/components/responses/InternalServerError"
|
2021-10-28 22:33:41 +00:00
|
|
|
'501':
|
|
|
|
$ref: "#/components/responses/NotImplementedError"
|
2020-09-18 01:07:26 +00:00
|
|
|
get:
|
2021-10-28 22:33:41 +00:00
|
|
|
summary: Retrieve the image resource with the specified ID
|
|
|
|
operationId: ImageGet
|
|
|
|
tags: ["image"]
|
2020-09-18 01:07:26 +00:00
|
|
|
parameters:
|
2021-05-06 05:36:43 +00:00
|
|
|
- $ref: "#/components/parameters/ImageName"
|
|
|
|
- $ref: "#/components/parameters/ImageFormat"
|
2020-09-18 01:07:26 +00:00
|
|
|
responses:
|
|
|
|
'200':
|
2021-05-09 03:01:16 +00:00
|
|
|
$ref: "#/components/responses/Image"
|
2021-10-28 22:33:41 +00:00
|
|
|
'401':
|
|
|
|
$ref: "#/components/responses/UnauthenticatedError"
|
2020-09-18 01:07:26 +00:00
|
|
|
'404':
|
|
|
|
$ref: "#/components/responses/NotFoundError"
|
2021-10-28 22:33:41 +00:00
|
|
|
'405':
|
|
|
|
$ref: "#/components/responses/MethodNotAllowedError"
|
2020-09-18 01:07:26 +00:00
|
|
|
'410':
|
|
|
|
$ref: "#/components/responses/DeletedError"
|
2021-10-28 22:33:41 +00:00
|
|
|
'422':
|
|
|
|
$ref: "#/components/responses/UnacceptableError"
|
2020-09-18 01:07:26 +00:00
|
|
|
'500':
|
|
|
|
$ref: "#/components/responses/InternalServerError"
|
2021-10-28 22:33:41 +00:00
|
|
|
'501':
|
|
|
|
$ref: "#/components/responses/NotImplementedError"
|
2021-05-06 05:36:43 +00:00
|
|
|
options:
|
|
|
|
summary: Retrieve available HTTP verbs for the selected endpoint
|
2021-10-28 22:33:41 +00:00
|
|
|
operationId: ImageOptions
|
2021-05-06 05:36:43 +00:00
|
|
|
tags: ["meta"]
|
|
|
|
parameters:
|
|
|
|
- $ref: "#/components/parameters/ImageName"
|
|
|
|
- $ref: "#/components/parameters/ImageFormat"
|
|
|
|
responses: *responses-options
|
2021-10-28 22:33:41 +00:00
|
|
|
/image/{image_name}/{alias}:
|
|
|
|
head:
|
|
|
|
summary: Returns metadata about the image request
|
|
|
|
operationId: ImageAliasHead
|
|
|
|
tags: ["meta"]
|
2020-09-18 01:07:26 +00:00
|
|
|
parameters:
|
2021-05-06 05:36:43 +00:00
|
|
|
- $ref: "#/components/parameters/ImageName"
|
|
|
|
- $ref: "#/components/parameters/ImageFormat"
|
2021-10-28 22:33:41 +00:00
|
|
|
- $ref: "#/components/parameters/ImageAlias"
|
2020-09-18 01:07:26 +00:00
|
|
|
responses:
|
|
|
|
'200':
|
2021-05-09 03:01:16 +00:00
|
|
|
$ref: "#/components/responses/Image"
|
2021-10-28 22:33:41 +00:00
|
|
|
'401':
|
|
|
|
$ref: "#/components/responses/UnauthenticatedError"
|
2020-09-18 01:07:26 +00:00
|
|
|
'404':
|
|
|
|
$ref: "#/components/responses/NotFoundError"
|
2021-10-28 22:33:41 +00:00
|
|
|
'405':
|
|
|
|
$ref: "#/components/responses/MethodNotAllowedError"
|
2020-09-18 01:07:26 +00:00
|
|
|
'410':
|
|
|
|
$ref: "#/components/responses/DeletedError"
|
2021-10-28 22:33:41 +00:00
|
|
|
'422':
|
|
|
|
$ref: "#/components/responses/UnacceptableError"
|
2020-09-18 01:07:26 +00:00
|
|
|
'500':
|
|
|
|
$ref: "#/components/responses/InternalServerError"
|
2021-05-08 23:46:05 +00:00
|
|
|
get:
|
|
|
|
summary: Fetch a pre configured version of the image
|
2021-10-28 22:33:41 +00:00
|
|
|
operationId: ImageAliasGet
|
|
|
|
tags: ["image"]
|
2021-05-08 23:46:05 +00:00
|
|
|
parameters:
|
|
|
|
- $ref: "#/components/parameters/ImageName"
|
|
|
|
- $ref: "#/components/parameters/ImageFormat"
|
|
|
|
- $ref: "#/components/parameters/ImageAlias"
|
|
|
|
responses:
|
|
|
|
'200':
|
2021-05-09 03:01:16 +00:00
|
|
|
$ref: "#/components/responses/Image"
|
2021-10-28 22:33:41 +00:00
|
|
|
'401':
|
|
|
|
$ref: "#/components/responses/UnauthenticatedError"
|
2021-05-08 23:46:05 +00:00
|
|
|
'404':
|
|
|
|
$ref: "#/components/responses/NotFoundError"
|
2021-10-28 22:33:41 +00:00
|
|
|
'405':
|
|
|
|
$ref: "#/components/responses/MethodNotAllowedError"
|
2021-05-08 23:46:05 +00:00
|
|
|
'410':
|
|
|
|
$ref: "#/components/responses/DeletedError"
|
2021-10-28 22:33:41 +00:00
|
|
|
'422':
|
|
|
|
$ref: "#/components/responses/UnacceptableError"
|
2021-05-08 23:46:05 +00:00
|
|
|
'500':
|
|
|
|
$ref: "#/components/responses/InternalServerError"
|
|
|
|
options:
|
|
|
|
summary: Retrieve available HTTP verbs for the selected endpoint
|
|
|
|
operationId: ImageAliasOptions
|
|
|
|
tags: ["meta"]
|
|
|
|
parameters:
|
|
|
|
- $ref: "#/components/parameters/ImageName"
|
|
|
|
- $ref: "#/components/parameters/ImageFormat"
|
|
|
|
- $ref: "#/components/parameters/ImageAlias"
|
|
|
|
responses: *responses-options
|
2020-09-18 01:07:26 +00:00
|
|
|
components:
|
|
|
|
schemas:
|
|
|
|
Error:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
event_id:
|
|
|
|
type: string
|
|
|
|
format: uuid
|
|
|
|
message:
|
|
|
|
type: string
|
|
|
|
data:
|
|
|
|
type: object
|
|
|
|
example:
|
|
|
|
event_id: 0de388ae-8277-49ba-b225-3ef7f5b9d084
|
2021-10-28 22:33:41 +00:00
|
|
|
message: Website go brrr
|
2020-09-18 01:07:26 +00:00
|
|
|
data: {}
|
|
|
|
headers:
|
|
|
|
Version:
|
2021-10-28 23:03:09 +00:00
|
|
|
description: Application name and version
|
2020-09-18 01:07:26 +00:00
|
|
|
schema:
|
|
|
|
type: string
|
2021-10-28 23:03:09 +00:00
|
|
|
example: fresnel-lens-1.0.0
|
2020-09-18 01:07:26 +00:00
|
|
|
Allowed:
|
|
|
|
description: Comma delimited list of valid HTTP verbs
|
|
|
|
schema:
|
|
|
|
type: string
|
|
|
|
parameters:
|
2021-05-06 05:36:43 +00:00
|
|
|
ImageName:
|
|
|
|
name: image_name
|
|
|
|
in: path
|
|
|
|
description: Image resource name
|
|
|
|
required: true
|
|
|
|
schema:
|
|
|
|
type: string
|
|
|
|
ImageFormat:
|
2021-10-28 22:33:41 +00:00
|
|
|
name: Accept
|
|
|
|
in: header
|
|
|
|
description: Content type indicating what format the image should be returned in
|
|
|
|
required: false
|
2020-09-18 01:07:26 +00:00
|
|
|
schema:
|
|
|
|
type: string
|
2021-10-28 22:33:41 +00:00
|
|
|
default: image/jpeg
|
|
|
|
enum: [image/jpeg, image/png]
|
2021-05-08 23:46:05 +00:00
|
|
|
ImageAlias:
|
|
|
|
name: alias
|
|
|
|
in: path
|
|
|
|
description: Name of the image config alias to use
|
|
|
|
required: true
|
|
|
|
schema:
|
|
|
|
type: string
|
2020-09-18 01:07:26 +00:00
|
|
|
responses:
|
2021-05-09 03:01:16 +00:00
|
|
|
Image:
|
2021-10-28 22:33:41 +00:00
|
|
|
description: Image content for the specified ID
|
|
|
|
headers: *headers-image
|
2021-05-09 03:01:16 +00:00
|
|
|
content:
|
|
|
|
image/jpeg: {}
|
|
|
|
image/png: {}
|
2021-10-28 22:33:41 +00:00
|
|
|
ImageMeta:
|
|
|
|
description: Image content for the specified ID
|
|
|
|
headers: *headers-image
|
2020-09-18 01:07:26 +00:00
|
|
|
InternalServerError:
|
|
|
|
description: Internal server error
|
|
|
|
headers: *headers-default
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/Error"
|
|
|
|
NotFoundError:
|
|
|
|
description: Image with provided ID does not exist
|
|
|
|
headers: *headers-default
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/Error"
|
2021-05-06 05:36:43 +00:00
|
|
|
MethodNotAllowedError:
|
|
|
|
description: The request's HTTP method is not allowed on this endpoint
|
|
|
|
headers: *headers-default
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/Error"
|
2020-09-18 01:07:26 +00:00
|
|
|
DeletedError:
|
|
|
|
description: Image with provided ID was deleted
|
|
|
|
headers: *headers-default
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/Error"
|
2021-10-28 22:33:41 +00:00
|
|
|
UnacceptableError:
|
|
|
|
description: Requested image format is not supported by the server
|
|
|
|
headers: *headers-default
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/Error"
|
|
|
|
UnauthenticatedError:
|
|
|
|
description: Resource requires authentication that was not successfully provided
|
|
|
|
headers: *headers-default
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/Error"
|
|
|
|
NotImplementedError:
|
|
|
|
description: The server does not support retriving the full resolution image
|
|
|
|
headers: *headers-default
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: "#/components/schemas/Error"
|