-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into apidocs-dap-updating-link
- Loading branch information
Showing
15 changed files
with
9,203 additions
and
143 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
{ | ||
"extends": "eslint:recommended", | ||
"env": { | ||
"browser": true | ||
"browser": true, | ||
"es6": true | ||
}, | ||
"extends": "eslint:recommended" | ||
"rules": { | ||
"max-len": "off" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -2,30 +2,55 @@ | |
|
||
GSA teams can host their API documentation directly on this site if they prefer. | ||
|
||
A live example of this is available here: https://open.gsa.gov/api/sample-api-basic/ | ||
A live example of this is available here: | ||
- Without the Swagger UI interactive documentation: https://open.gsa.gov/api/sample-api-basic/ | ||
- With the Swagger UI interactive documentation: https://open.gsa.gov/api/sample-api/ | ||
|
||
|
||
## Steps to add API doco | ||
## Steps to add you API documentation to the GSA API Directory | ||
|
||
1. Contact [email protected] and ask for access to manage API docs, sharing your github ID. (Your GitHub ID will have to be in the GSA org.) | ||
|
||
2. Create a branch of the site from the `master` branch. Naming convention for new branch: `apidocs-apiname-YYYYMMDD` (replace `apiname` with the name of your API without spaces) | ||
|
||
3. In the new branch: | ||
3A. If you want to use the Swagger UI for interactive documentation | ||
In the new branch: | ||
* Copy the file _apidocs/sample-api.md to a file named _apidocs/apiname.md | ||
* Create a folder _apidocs/apiname/v1/ (or the correct version). | ||
* In this new folder, add the OpenAPI specification file, with the name openapi.yaml (if it is OpenAPI v.3) or openapi.json (if it is OpenAPI or Swagger v.2) | ||
* In the new apinamed.md file, modify the `url: "v1/openapi.yaml",` entry to match the name of your OpenAPI specification file. | ||
|
||
3B. If you do _not_ want to use the Swagger UI for interactive documentation | ||
In the new branch: | ||
* Copy the file _apidocs/sample-api-basic.md to a file named _apidocs/apiname.md | ||
* Create a folder _apidocs/apiname/v1/ (or the correct version). | ||
* In this new folder, add the OpenAPI specification file, with the name openapi.yaml (if it is OpenAPI v.3) or openapi.json (if it is OpenAPI or Swagger v.2) | ||
|
||
Note: the navigation bar is generated from the headings in the markdown file, so those can be customized to meet your needs. | ||
|
||
4. When you commit your changes to your repo in github, a preview will be available of the site (with your doco) at this URL: | ||
4. Edit the apiname.md file with all of the information about your API. When you commit your changes to your repo in github, a preview will be available of the site (with your doco) at this URL after 5 min or so for the preview to build: | ||
|
||
https://federalist-proxy.app.cloud.gov/preview/gsa/open-gsa-redesign/[branch-name]/api/[apiname]/ | ||
|
||
|
||
5. When you are ready to publish in the API directory, submit a pull request to merge your branch with the `master` branch and @mention Ryan Day or Jeff Fredrickson from the CTO team. | ||
5. When you are ready to publish in the API directory, submit a pull request to merge your branch with the `master` branch. Post a comment with the preview URL from step 4 and @mention Ryan Day or Jeff Fredrickson from the CTO team. | ||
|
||
6. The CTO team will merge your branch with master, publishing your doco. At this point, you will see your API doco at: https://open.gsa.gov/api/apiname/ | ||
|
||
You can also ask the CTO team to update the /_data/api-list.yml, which will add your API to the directory page: https://open.gsa.gov/api/ | ||
|
||
## Adding swagger UI to your existing API documentation | ||
|
||
If you already host your documentation on this site, and you'd like to add the Swagger UI, add this section following the section with the OpenAPI specification: | ||
|
||
``` | ||
## API Calls | ||
[Insert descriptive text here] | ||
At this point, you will see your API doco at: https://open.gsa.gov/api/apiname/ | ||
{% include swagger-section-header.html %} | ||
url: "v1/[Name of OpenAPI file]", | ||
{% include swagger-section-footer.html %} | ||
6. The CTO team will merge your branch with master, publishing your doco. They will also update the /_data/api-list.yml, which will add your API to the directory page: https://open.gsa.gov/api/ | ||
<p><small><a href="#">Back to top</a></small></p>``` |
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 |
---|---|---|
|
@@ -127,4 +127,4 @@ DEPENDENCIES | |
rake | ||
|
||
BUNDLED WITH | ||
1.17.2 | ||
1.17.2 |
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,73 @@ | ||
void (function (root, factory) { | ||
if (typeof define === 'function' && define.amd) define(factory) | ||
else if (typeof exports === 'object') module.exports = factory() | ||
else factory() | ||
}(this, function () { | ||
var DETAILS = 'details' | ||
var SUMMARY = 'summary' | ||
|
||
var supported = checkSupport() | ||
if (supported) return | ||
|
||
// Add a classname | ||
document.documentElement.className += ' no-details' | ||
|
||
window.addEventListener('click', clickHandler) | ||
|
||
injectStyle('details-polyfill-style', | ||
'html.no-details ' + DETAILS + ':not([open]) > :not(' + SUMMARY + ') { display: none; }\n' + | ||
'html.no-details ' + DETAILS + ' > ' + SUMMARY + ':before { content: "\u25b6"; display: inline-block; font-size: .8em; width: 1.5em; }\n' + | ||
'html.no-details ' + DETAILS + '[open] > ' + SUMMARY + ':before { content: "\u25bc"; }') | ||
|
||
/* | ||
* Click handler for `<summary>` tags | ||
*/ | ||
|
||
function clickHandler (e) { | ||
if (e.target.nodeName.toLowerCase() === 'summary') { | ||
var details = e.target.parentNode | ||
if (!details) return | ||
|
||
if (details.getAttribute('open')) { | ||
details.open = false | ||
details.removeAttribute('open') | ||
} else { | ||
details.open = true | ||
details.setAttribute('open', 'open') | ||
} | ||
} | ||
} | ||
|
||
/* | ||
* Checks for support for `<details>` | ||
*/ | ||
|
||
function checkSupport () { | ||
var el = document.createElement(DETAILS) | ||
if (!('open' in el)) return false | ||
|
||
el.innerHTML = '<' + SUMMARY + '>a</' + SUMMARY + '>b' | ||
document.body.appendChild(el) | ||
|
||
var diff = el.offsetHeight | ||
el.open = true | ||
var result = (diff != el.offsetHeight) | ||
|
||
document.body.removeChild(el) | ||
return result | ||
} | ||
|
||
/* | ||
* Injects styles (idempotent) | ||
*/ | ||
|
||
function injectStyle (id, style) { | ||
if (document.getElementById(id)) return | ||
|
||
var el = document.createElement('style') | ||
el.id = id | ||
el.innerHTML = style | ||
|
||
document.getElementsByTagName('head')[0].appendChild(el) | ||
} | ||
})); // eslint-disable-line semi |
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.