Skip to content
Open
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
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ List of additional rules:
* `NoMissingCurrentRangeMetersInVehicleStatusForMotorizedVehicles`
* `NoMissingStoreUriInSystemInformation`

## API

`gbfs-validator-java-api` serves the validator over HTTP (`POST /validate`), from the spec in `gbfs-validator-java-api/src/main/resources/public/openapi.yaml`.

- API docs for MobilityData's hosted environments: https://mobilitydata.github.io/gbfs-validator-java/SwaggerUI/index.html (`docs/SwaggerUI/`).
- The API also serves Swagger UI at `/swagger-ui/index.html` and the spec at `/v3/api-docs`. To turn them off in your deployment, set `SPRINGDOC_SWAGGERUI_ENABLED=false` and `SPRINGDOC_APIDOCS_ENABLED=false`.

## Releasing

The recommended way to release is via the repository's [Releases](https://github.com/MobilityData/gbfs-validator-java/releases) page.
Expand Down
8 changes: 8 additions & 0 deletions docs/SwaggerUI/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# GBFS Validator API documentation

Static [Swagger UI](https://github.com/swagger-api/swagger-ui) for the GBFS Validator API, published with GitHub Pages from `master:/docs` at https://mobilitydata.github.io/gbfs-validator-java/SwaggerUI/index.html. Same setup as the [Mobility Database API docs](https://mobilitydata.github.io/mobility-feed-api/SwaggerUI/index.html).

- `index.html` and `dist/` are the Swagger UI static bundle, version in `swagger-ui.version`.
- `dist/swagger-initializer.js` loads `gbfs-validator-java-api/src/main/resources/public/openapi.yaml` from `master`, and adds MobilityData's hosted environments as servers for "Try it out".

The API itself still ships Swagger UI (springdoc) at `/swagger-ui/index.html` for anyone running it. MobilityData's deployment turns it off with the environment variables `SPRINGDOC_SWAGGERUI_ENABLED=false` and `SPRINGDOC_APIDOCS_ENABLED=false`.
Binary file added docs/SwaggerUI/dist/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 docs/SwaggerUI/dist/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.
16 changes: 16 additions & 0 deletions docs/SwaggerUI/dist/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
html {
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}

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

body {
margin: 0;
background: #fafafa;
}
34 changes: 34 additions & 0 deletions docs/SwaggerUI/dist/swagger-initializer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
window.onload = function() {
// The spec is the one the API is generated from, read from master so the docs follow the code.
// GitHub Pages serves only docs/, so it is loaded from raw.githubusercontent.com (CORS enabled).
const SPEC_URL = "https://raw.githubusercontent.com/MobilityData/gbfs-validator-java/master/gbfs-validator-java-api/src/main/resources/public/openapi.yaml";

// MobilityData's hosted environments, for "Try it out". They are added here rather than in
// openapi.yaml, so the spec stays neutral for anyone running the API on their own infrastructure.
const SERVERS = [
{ url: "https://gbfs.api.mobilitydatabase.org", description: "Production" },
{ url: "https://qa.gbfs.api.mobilitydatabase.org", description: "Pre-production" },
{ url: "https://dev.gbfs.api.mobilitydatabase.org", description: "Development" }
];

let serversAdded = false;
window.ui = SwaggerUIBundle({
url: SPEC_URL,
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout",
onComplete: function() {
if (serversAdded) return;
serversAdded = true;
const spec = window.ui.specSelectors.specJson().toJS();
window.ui.specActions.updateJsonSpec(Object.assign({}, spec, { servers: SERVERS }));
}
});
};
3 changes: 3 additions & 0 deletions docs/SwaggerUI/dist/swagger-ui-bundle.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions docs/SwaggerUI/dist/swagger-ui-standalone-preset.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions docs/SwaggerUI/dist/swagger-ui.css

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions docs/SwaggerUI/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<link rel="stylesheet" type="text/css" href="dist/swagger-ui.css" />
<link rel="stylesheet" type="text/css" href="dist/index.css" />
<link rel="icon" type="image/png" href="dist/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="dist/favicon-16x16.png" sizes="16x16" />
</head>

<body>
<div id="swagger-ui"></div>
<script src="dist/swagger-ui-bundle.js" charset="UTF-8"> </script>
<script src="dist/swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
<script src="dist/swagger-initializer.js" charset="UTF-8"> </script>
</body>
</html>
1 change: 1 addition & 0 deletions docs/SwaggerUI/swagger-ui.version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v4.19.0
Loading