This repository has been archived by the owner on May 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
257 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>DOR Indexing API documentation</title> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
||
<style> | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<redoc spec-url='https://raw.githubusercontent.com/sul-dlss/dor_indexing_app/master/openapi.yml'></redoc> | ||
<script src="https://cdn.jsdelivr.net/npm/redoc@2.0.0-rc.30/bundles/redoc.standalone.js"> </script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
openapi: 3.0.0 | ||
info: | ||
description: API for Stanford Digital Repository indexing service | ||
version: 1.0.0 | ||
title: Dor Indexing API | ||
license: | ||
name: Apache 2.0 | ||
url: 'http://www.apache.org/licenses/LICENSE-2.0.html' | ||
servers: | ||
- url: 'https://dor-indexing-app-{env}-{node}.stanford.edu' | ||
description: Production service | ||
variables: | ||
env: | ||
default: prod | ||
node: | ||
default: a | ||
enum: [a b c] | ||
- url: 'https://dor-indexing-app-{env}-{node}.stanford.edu' | ||
description: Staging service | ||
variables: | ||
env: | ||
default: stage | ||
node: | ||
default: a | ||
enum: [a b] | ||
- url: 'https://dor-indexing-app-{env}-{node}.stanford.edu' | ||
description: Quality Assurance service | ||
variables: | ||
env: | ||
default: qa | ||
node: | ||
default: a | ||
enum: [a b] | ||
tags: | ||
- name: indexing | ||
description: Indexing operations | ||
- name: informational | ||
description: Informational operations | ||
paths: | ||
/dor/reindex/{pid}: | ||
post: | ||
tags: | ||
- indexing | ||
summary: Reindex a repository object | ||
description: '' | ||
operationId: 'dor#reindex' | ||
parameters: | ||
- name: pid | ||
in: path | ||
description: 'a digital repository identifier' | ||
required: true | ||
schema: | ||
$ref: '#/components/schemas/Druid' | ||
- name: commitWithin | ||
in: query | ||
description: 'time within which to trigger Solr commit' | ||
required: false | ||
schema: | ||
type: integer | ||
responses: | ||
'200': | ||
description: Object successfully reindexed | ||
content: | ||
text/plain: # This is why we can't enable Committee response validation. See TODO in config/application.rb | ||
schema: | ||
type: string | ||
'404': | ||
description: Object not found | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/ErrorResponse' | ||
'500': | ||
description: Internal server error | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/ErrorResponse' | ||
/dor/delete_from_index/{pid}: | ||
post: | ||
tags: | ||
- indexing | ||
summary: Remove a repository object's index entry | ||
description: '' | ||
operationId: 'dor#delete_from_index' | ||
parameters: | ||
- name: pid | ||
in: path | ||
description: 'a digital repository identifier' | ||
required: true | ||
schema: | ||
$ref: '#/components/schemas/Druid' | ||
- name: commitWithin | ||
in: query | ||
description: 'time within which to trigger Solr commit' | ||
required: false | ||
schema: | ||
type: integer | ||
responses: | ||
'200': | ||
description: Object successfully removed from index | ||
content: | ||
text/plain: # This is why we can't enable Committee response validation. See TODO in config/application.rb | ||
schema: | ||
type: string | ||
'500': | ||
description: Internal server error | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/ErrorResponse' | ||
/dor/queue_size: | ||
get: | ||
tags: | ||
- informational | ||
summary: Return size of indexing queue | ||
description: '' | ||
operationId: 'dor#queue_size' | ||
responses: | ||
'200': | ||
description: OK | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
value: | ||
type: integer | ||
components: | ||
schemas: | ||
Druid: | ||
description: Digital Repository Unique Identifier (DRUID) with `druid:` prefix | ||
type: string | ||
pattern: '^druid:[b-df-hjkmnp-tv-z]{2}[0-9]{3}[b-df-hjkmnp-tv-z]{2}[0-9]{4}$' | ||
example: 'druid:bc123df4567' | ||
ErrorResponse: | ||
type: object | ||
properties: | ||
errors: | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/Error' | ||
Error: | ||
type: object | ||
properties: | ||
title: | ||
type: string | ||
description: 'a short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem.' | ||
example: Invalid Attribute | ||
detail: | ||
type: string | ||
description: a human-readable explanation specific to this occurrence of the problem. | ||
example: Title must contain at least three characters. | ||
source: | ||
type: object | ||
properties: | ||
pointer: | ||
type: string | ||
example: /data/attributes/title |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
set -ev | ||
|
||
result=$(openapi-enforcer validate openapi.yml) | ||
[[ $result =~ "Document is valid" ]] && { | ||
echo "Validation good" | ||
exit 0 | ||
} || { | ||
echo $result | ||
exit 1 | ||
} |