Skip to content

Commit

Permalink
Merge pull request #504 from MITLibraries/docs_options
Browse files Browse the repository at this point in the history
Provides end user documentation via GitHub pages
  • Loading branch information
JPrevost authored Mar 2, 2022
2 parents e3b4cdc + 1bb91c8 commit 6628687
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 109 deletions.
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,8 @@ particular order so as not to break production services.

### Automatic generation from openapi specification

- Sign into stoplight.io with an account that has access to the MIT Libraries organization
- copy the source of `openapi.json` file from this repository to the code tab in our [stoplight model](https://next.stoplight.io/mit-libraries/timdex/version%2F1.0/openapi.oas3.yml)
- In [Stoplight's Publish](https://next.stoplight.io/mit-libraries/timdex/version%2F1.0/timdex.hub.yml?view=/&show=publish&domain=mitlibraries-timdex.docs.stoplight.io) section, Uncheck "set live" and then click "Build"
- Once docs are built, check they are sane with the preview feature then click "set live"

We are using Swagger UI to automatically generate documentation from the `openapi.json` file in GitHub Pages. The HTML
file is in `docs/index.html` and the `openapi.json` file always pulls from the `main` branch.
## Required Environment Variables (all ENVs)

- `EMAIL_FROM`: email address to send message from, including the registration
Expand Down
4 changes: 2 additions & 2 deletions app/views/static/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

<p>TIMDEX is a free discovery API into collections at MIT Libraries.</p>

<p>This initial release provides discovery of records in MIT Libraries Barton catalog. We intend to expand the scope of collections discoverable via this API.</p>
<p>This release provides discovery of records in MIT Libraries catalog and ArchivesSpace. We intend to expand the scope of collections discoverable via this API.</p>

<p>Interactive <a href="https://mitlibraries-timdex.docs.stoplight.io">end user documentation</a> is available for the REST API with selectable language code samples and live API calls against real production data.</p>
<p>Interactive <a href="https://mitlibraries.github.io/timdex/">end user documentation</a> is available for the REST API with Curl examples and live API calls against real production data.</p>

<p>There is also a <a href="https://graphql.org">GraphQL</a> endpoint by posting to <%= link_to(graphql_url) %> as well as an <a href="/playground">interactive GraphQL playground.</a> It's neat, check it out!.</p>

Expand Down
65 changes: 13 additions & 52 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -1,61 +1,22 @@
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>TIMDEX API Documentationd</title>
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@3.19.5/swagger-ui.css" >
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
<style>
html
{
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}

*,
*:before,
*:after
{
box-sizing: inherit;
}

body
{
margin:0;
background: #fafafa;
}
</style>

<script src="https://unpkg.com/swagger-ui-dist@3/swagger-ui-bundle.js"></script>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="MIT Libraries TIMDEX API Documentation" />
<title>MIT Libraries TIMDEX API Documentation</title>
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@4.5.2/swagger-ui.css" />
</head>

<body>
<div id="swagger-ui"></div>

<script src="https://unpkg.com/swagger-ui-dist@4.5.2/swagger-ui-bundle.js" crossorigin></script>
<script>

window.onload = function() {
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
url: "../openapi.json",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
// SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
// layout: "StandaloneLayout"
})
// End Swagger UI call region

window.ui = ui
}
</script>
window.onload = () => {
window.ui = SwaggerUIBundle({
url: "https://raw.githubusercontent.com/MITLibraries/timdex/main/openapi.json",
dom_id: "#swagger-ui",
});
};
</script>
</body>
</html>
15 changes: 0 additions & 15 deletions docs/rapidoc.html

This file was deleted.

35 changes: 0 additions & 35 deletions docs/redoc.html

This file was deleted.

0 comments on commit 6628687

Please sign in to comment.