Skip to content
This repository was archived by the owner on Dec 21, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
_site/
.idea
*.iml
.project
.DS_Store
*.sublime*
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.swp
*.swo
node_modules
dist
.jekyll-metadata
vendor
.bundle
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: package-lock is enabled by default, it may be better to remove .npmrc completely. Just FYI, no change is needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm aware but as mentioned in a different PR by @raymondfeng some developers like him have it disabled globally by default -- this was intentional :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I have package-lock disabled globally too.

2 changes: 1 addition & 1 deletion CNAME
Original file line number Diff line number Diff line change
@@ -1 +1 @@
explorer.loopback.io
explorer.loopback.io
24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Copyright (c) IBM Corp. 2018. All Rights Reserved.
This project is licensed under the MIT License. The full text is below.

--------

MIT license

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
54 changes: 53 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,54 @@
# explorer.loopback.io
Hosted API Explorer

API Explorer for LoopBack 4.

## Explorer

The UI will be available at https://explorer.loopback.io/?url=*your-openapi-or-swagger-spec-url* or http://explorer.loopback.io/?url=*your-openapi-or-swagger-spec-url*.

## Setup

To preview this website locally,
- Install [Node.js](https://nodejs.org/en/) version 8 or higher
- Clone this repo:
```sh
git clone https://github.com/strongloop/explorer.loopback.io.git
```
- Enter the repository directory and run the following commands:
```sh
cd explorer.loopback.io
npm install
npm start
```

## Making Changes

Running `npm run swagger-ui` will update the explorer by first **DELETING** all files/folder in this repository except the ones in the `filesToKeep` array in `update-swagger-ui.js` and then copying the new files in their place.

To change the base templates, please modify `index.loopback.html`.

### Updating the UI

To upgrade `swagger-ui` to a newer version:

1. Update the [`swagger-ui-dist`](https://www.npmjs.com/package/swagger-ui-dist) version in [package.json](https://github.com/strongloop/explorer.loopback.io/blob/master/package.json). You can use `npm update swagger-ui-dist`.

2. Run `npm install` which in turn executes `node ./update-swagger-ui.sh` to copy files.

3. Create a pull request to merge changes to `master` branch.

## Contributing

This project uses [DCO](https://developercertificate.org/). Be sure to sign off
your commits using the `-s` flag or adding `Signed-off-By: Name<Email>` in the
commit message.

**Example**

```
git commit -s -m "feat: my commit message"
```

## License

This repository is provided under the [MIT License](LICENSE).
14 changes: 14 additions & 0 deletions absolute-path.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* getAbsoluteFSPath
* @return {string} When run in NodeJS env, returns the absolute path to the current directory
* When run outside of NodeJS, will return an error message
*/
const getAbsoluteFSPath = function () {
// detect whether we are running in a browser or nodejs
if (typeof module !== "undefined" && module.exports) {
return require("path").resolve(__dirname)
}
throw new Error('getAbsoluteFSPath can only be called within a Nodejs environment');
}

module.exports = getAbsoluteFSPath
Binary file added favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
230 changes: 230 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>LoopBack API Explorer</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="./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" />
<!-- Bootstrap core CSS -->
<link href="https://v4.loopback.io/dist/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=IBM+Plex+Sans" rel="stylesheet">
<link href="https://v4.loopback.io/css/loopback.css" rel="stylesheet">
<!-- Style Overrides -->
<style>
html {
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}

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

body {
margin:0;
background: #fafafa;
}

section {
padding: 0px;
}

h2 {
line-height: initial;
font-weight: initial;
}

.information-container.wrapper {
padding-top: 30px;
}
</style>

<!-- Site Analytics -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-125843766-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('set', 'anonymizeIp', true);
gtag('config', 'UA-125843766-4');
</script>
</head>

<body>
<!-- Navbar -->
<nav class="navbar navbar-expand-lg navbar-light fixed-top">
<a class="navbar-brand" href="/#">
<img src="https://v4.loopback.io/img/global/loopback-full-logo-blue.svg" width=150px>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>

<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="https://v4.loopback.io/getting-started.html">Getting Started</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://github.com/strongloop/loopback-next/blob/master/docs/CONTRIBUTING.md">Contribute</a>
</li>
<li class="nav-item">
<a class="nav-link" href="http://loopback.io/doc/en/lb4">Docs</a>
</li>
<li class="nav-item" style="padding-top: 10px">
<a class="github-button" href="https://github.com/strongloop/loopback-next" data-icon="octicon-star" data-show-count="true"
aria-label="Star strongloop/loopback-next on GitHub">Star</a>
</li>

</ul>

</div>
</nav>

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0">
<defs>
<symbol viewBox="0 0 20 20" id="unlocked">
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"></path>
</symbol>

<symbol viewBox="0 0 20 20" id="locked">
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z"/>
</symbol>

<symbol viewBox="0 0 20 20" id="close">
<path d="M14.348 14.849c-.469.469-1.229.469-1.697 0L10 11.819l-2.651 3.029c-.469.469-1.229.469-1.697 0-.469-.469-.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-.469-.469-.469-1.228 0-1.697.469-.469 1.228-.469 1.697 0L10 8.183l2.651-3.031c.469-.469 1.228-.469 1.697 0 .469.469.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c.469.469.469 1.229 0 1.698z"/>
</symbol>

<symbol viewBox="0 0 20 20" id="large-arrow">
<path d="M13.25 10L6.109 2.58c-.268-.27-.268-.707 0-.979.268-.27.701-.27.969 0l7.83 7.908c.268.271.268.709 0 .979l-7.83 7.908c-.268.271-.701.27-.969 0-.268-.269-.268-.707 0-.979L13.25 10z"/>
</symbol>

<symbol viewBox="0 0 20 20" id="large-arrow-down">
<path d="M17.418 6.109c.272-.268.709-.268.979 0s.271.701 0 .969l-7.908 7.83c-.27.268-.707.268-.979 0l-7.908-7.83c-.27-.268-.27-.701 0-.969.271-.268.709-.268.979 0L10 13.25l7.418-7.141z"/>
</symbol>


<symbol viewBox="0 0 24 24" id="jump-to">
<path d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z"/>
</symbol>

<symbol viewBox="0 0 24 24" id="expand">
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
</symbol>

</defs>
</svg>

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

<script src="./swagger-ui-bundle.js"> </script>
<script src="./swagger-ui-standalone-preset.js"> </script>
<script>
window.onload = function() {

// Build a system
// https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md
const ui = SwaggerUIBundle({
// Default to petstore. LoopBack 4 applications will override it by setting
// the url parameter, such as https://loopback.io/api-explorer?url=<swagger-spec-url>
url: "http://petstore.swagger.io/v2/swagger.json",
dom_id: '#swagger-ui',
deepLinking: true,
filter: true,
defaultModelsExpandDepth: 0,
defaultModelExpandDepth: 0,
presets: [
SwaggerUIBundle.presets.apis,
// SwaggerUIStandalonePreset
SwaggerUIStandalonePreset.slice(1) // Disable the top bar
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})

window.ui = ui
}
</script>

<!-- footer -->
<footer>
<div class="container">
<div class="row text-center">
<div class="col-md-3">
<img src="https://v4.loopback.io/img/global/loopback-mark-frame-white.svg" width=40px/>
</div>
<div class="col-md-3">
<p class="label text-uppercase">Product</p>
<p class="regular">
<a href="http://loopback.io/doc/en/lb4/Getting-started.html">Getting Started</a>
</p>
<p class="regular">
<a href="http://loopback.io/doc/en/lb4/Examples-and-tutorials.html">Tutorials</a>
</p>
</div>
<div class="col-md-3">
<p class="label text-uppercase">Documentation</p>
<p class="regular">
<a href="http://loopback.io/doc/en/lb4/">Docs</a>
</p>
<!--
<p class="regular">Resources</p>
-->
<p class="regular">
<a href="https://github.com/strongloop/loopback-next/blob/master/docs/CONTRIBUTING.md">Contribute</a>
</p>
</div>
<div class="col-md-3">
<p class="label text-uppercase">Support</p>
<p class="regular">
<a href="http://loopback.io/doc/en/lb4/">LoopBack 4 Documentation</a>
</p>
<p class="regular">
<a href="http://apidocs.loopback.io/@loopback%2fdocs/apidocs.html">API Docs</a>
</p>
<p class="regular">
<a href="https://strongloop.com/strongblog/">StrongLoop Blog</a>
</p>
<p class="regular">
<a href="https://www.ibm.com/marketplace/api-management">API Connect</a>
</p>
</div>
</div>
<hr class="hairline-footer">
<div class="row text-center">
<div class="col-md-6">
<p class="regular"> @ Copyright 2018 StrongLoop, an IBM company</p>
</div>
<div class="col-md-6">
<p style="float:right">
<a class="twitter-share-button"
href="https://twitter.com/intent/tweet?text=Creating APIs has never been easier using %23LoopBack 4 by %40StrongLoop. Check it out at v4.loopback.io.&url=v4.loopback.io">
Tweet</a>
<a href="https://twitter.com/intent/tweet?screen_name=StrongLoop&ref_src=twsrc%5Etfw" class="twitter-follow-button" data-show-count="true">Tweet to @StrongLoop</a>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</p>
</div>
</div>
</div>
</footer>

<script src="https://v4.loopback.io/dist/jquery/jquery-3.3.1.slim.min.js"></script>
<script src="https://v4.loopback.io/dist/popper/1.14.0/umd/popper.min.js"></script>
<!-- Bootstrap core JavaScript -->
<script src="https://v4.loopback.io/dist/bootstrap/js/bootstrap.min.js"></script>

<!-- GitHub button -->
<script async defer src="https://buttons.github.io/buttons.js"></script>
</body>

</html>
17 changes: 17 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
try {
module.exports.SwaggerUIBundle = require("./swagger-ui-bundle.js")
module.exports.SwaggerUIStandalonePreset = require("./swagger-ui-standalone-preset.js")
} catch(e) {
// swallow the error if there's a problem loading the assets.
// allows this module to support providing the assets for browserish contexts,
// without exploding in a Node context.
//
// see https://github.com/swagger-api/swagger-ui/issues/3291#issuecomment-311195388
// for more information.
}

// `absolutePath` and `getAbsoluteFSPath` are both here because at one point,
// we documented having one and actually implemented the other.
// They were both retained so we don't break anyone's code.
module.exports.absolutePath = require("./absolute-path.js")
module.exports.getAbsoluteFSPath = require("./absolute-path.js")
Loading