Skip to content

Commit

Permalink
Merge pull request #20 from nulib/docs-with-redirect
Browse files Browse the repository at this point in the history
Add root redirect to /docs/v2
  • Loading branch information
mbklein authored Sep 7, 2022
2 parents 0645bd3 + 7d16c1f commit b98536f
Show file tree
Hide file tree
Showing 9 changed files with 2,548 additions and 49 deletions.
17 changes: 16 additions & 1 deletion docs/docs/spec/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,15 @@ paths:
tags:
- Search
parameters:
- name: query
in: query
required: false
description: Keyword query
schema:
type: string
- name: searchToken
in: query
required: true
required: false
description: Search token from previous search response
schema:
type: string
Expand All @@ -117,6 +123,15 @@ paths:
schema:
type: integer
minimum: 1
- name: as
in: query
required: false
description: Desired output format
schema:
type: string
enum:
- iiif
- opensearch
responses:
200:
$ref: "./types.yaml#/components/responses/SearchResponse"
Expand Down
25 changes: 16 additions & 9 deletions docs/docs/spec/types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,26 @@ components:
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: "#/components/schemas/IndexDocument"
description: An array of response documents
pagination:
$ref: "#/components/schemas/PaginationInfo"
oneOf:
- $ref: "#/components/schemas/OpenSearchResponse"
- $ref: "#/components/schemas/IiifPresentationManifest"
schemas:
IiifPresentationManifest:
type: object
description: A [IIIF Presentation v3.x](https://iiif.io/api/presentation/3.0/) Manifest
IndexDocument:
type: object
description: A single index document
OpenSearchResponse:
type: object
properties:
data:
type: array
items:
$ref: "#/components/schemas/IndexDocument"
description: An array of response documents
pagination:
$ref: "#/components/schemas/PaginationInfo"
PaginationInfo:
type: object
description: Pagination info for the current response
Expand Down
49 changes: 38 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 5 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
{
"name": "dc-api",
"name": "dc-api-build",
"version": "2.0.0pre",
"description": "NUL Digital Collections API",
"repository": "https://github.com/awslabs/aws-sam-cli/tree/develop/samcli/local/init/templates/cookiecutter-aws-sam-hello-nodejs",
"description": "NUL Digital Collections API Build Environment",
"repository": "https://github.com/nulib/dc-api-v2",
"author": "nulib",
"license": "Apache-2.0",
"dependencies": {
"@aws-crypto/sha256-browser": "^2.0.1",
"@aws-sdk/credential-provider-node": "^3.142.0",
"@aws-sdk/node-http-handler": "^3.127.0",
"@aws-sdk/protocol-http": "^3.127.0",
"@aws-sdk/signature-v4": "^3.130.0",
"axios": ">=0.21.1",
"base64-js": "^1.5.1",
"jsonwebtoken": "^8.5.1",
"lz-string": "^1.4.4"
"dc-api": "file:./src"
},
"scripts": {
"preinstall": "cd src && npm i && cd -",
"prettier": "prettier -c src test",
"prettier:fix": "prettier -cw src test",
"test": "mocha",
Expand Down
12 changes: 12 additions & 0 deletions redirect/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
exports.handler = async () => {
const target = process.env.REDIRECT_TO;

return {
statusCode: 302,
headers: {
"content-type": "text/html",
location: target
},
body: `<p>Redirecting to <a href="${target}">API Documentation</a></p>`
}
}
Loading

0 comments on commit b98536f

Please sign in to comment.