Skip to content

Commit

Permalink
OpenAPI docs (#633)
Browse files Browse the repository at this point in the history
* explored

* Add swagger docs at /api/docs, standardize on /api instead of some /API

* Review openapi doc and improvements

* Update package-lock.json
  • Loading branch information
tariqksoliman authored Mar 4, 2025
1 parent e3da8a3 commit f4a9db9
Show file tree
Hide file tree
Showing 39 changed files with 4,557 additions and 4,130 deletions.
1,067 changes: 0 additions & 1,067 deletions API/Backend/APIs/routes/apis.js

This file was deleted.

10 changes: 0 additions & 10 deletions API/Backend/APIs/setup.js

This file was deleted.

2 changes: 1 addition & 1 deletion API/Backend/Config/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ let setup = {
}

s.app.use(
s.ROOT_PATH + "/API/configure",
s.ROOT_PATH + "/api/configure",
s.ensureAdmin(),
s.checkHeadersCodeInjection,
s.setContentType,
Expand Down
2 changes: 1 addition & 1 deletion API/Backend/Datasets/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ let setup = {
//Once the app initializes
onceInit: (s) => {
s.app.use(
s.ROOT_PATH + "/API/datasets",
s.ROOT_PATH + "/api/datasets",
s.ensureAdmin(),
s.checkHeadersCodeInjection,
s.setContentType,
Expand Down
4 changes: 2 additions & 2 deletions API/Backend/Draw/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let setup = {
//Once the app initializes
onceInit: (s) => {
s.app.use(
s.ROOT_PATH + "/API/files",
s.ROOT_PATH + "/api/files",
s.ensureUser(),
s.checkHeadersCodeInjection,
s.setContentType,
Expand All @@ -17,7 +17,7 @@ let setup = {
);

s.app.use(
s.ROOT_PATH + "/API/draw",
s.ROOT_PATH + "/api/draw",
s.ensureUser(),
s.checkHeadersCodeInjection,
s.setContentType,
Expand Down
2 changes: 1 addition & 1 deletion API/Backend/Geodatasets/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let setup = {
//Once the app initializes
onceInit: (s) => {
s.app.use(
s.ROOT_PATH + "/API/geodatasets",
s.ROOT_PATH + "/api/geodatasets",
s.ensureAdmin(),
s.checkHeadersCodeInjection,
s.setContentType,
Expand Down
2 changes: 1 addition & 1 deletion API/Backend/LongTermToken/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ let setup = {
//Once the app initializes
onceInit: (s) => {
s.app.use(
s.ROOT_PATH + "/API/longtermtoken",
s.ROOT_PATH + "/api/longtermtoken",
s.ensureAdmin(false, true),
s.checkHeadersCodeInjection,
s.setContentType,
Expand Down
2 changes: 1 addition & 1 deletion API/Backend/Shortener/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ let setup = {
//Once the app initializes
onceInit: (s) => {
s.app.use(
s.ROOT_PATH + "/API/shortener",
s.ROOT_PATH + "/api/shortener",
s.ensureUser(),
s.checkHeadersCodeInjection,
s.setContentType,
Expand Down
2 changes: 1 addition & 1 deletion API/Backend/Stac/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ let setup = {
//Once the app initializes
onceInit: (s) => {
s.app.use(
s.ROOT_PATH + "/API/stac",
s.ROOT_PATH + "/api/stac",
s.ensureAdmin(),
s.checkHeadersCodeInjection,
s.setContentType,
Expand Down
2 changes: 1 addition & 1 deletion API/Backend/Users/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const router = require("./routes/users");
let setup = {
//Once the app initializes
onceInit: (s) => {
s.app.use(s.ROOT_PATH + "/API/users", s.checkHeadersCodeInjection, router);
s.app.use(s.ROOT_PATH + "/api/users", s.checkHeadersCodeInjection, router);
},
//Once the server starts
onceStarted: (s) => {},
Expand Down
2 changes: 1 addition & 1 deletion API/Backend/Utils/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ let setup = {
//Once the app initializes
onceInit: (s) => {
s.app.use(
s.ROOT_PATH + "/API/utils",
s.ROOT_PATH + "/api/utils",
s.ensureUser(),
s.setContentType,
router
Expand Down
4 changes: 2 additions & 2 deletions API/Backend/Webhooks/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ let setup = {
//Once the app initializes
onceInit: (s) => {
s.app.use(
s.ROOT_PATH + "/API/webhooks",
s.ROOT_PATH + "/api/webhooks",
s.checkHeadersCodeInjection,
routerWebhooks
);
if (process.env.NODE_ENV === "development") {
s.app.use(
s.ROOT_PATH + "/API/testwebhooks",
s.ROOT_PATH + "/api/testwebhooks",
s.checkHeadersCodeInjection,
routerTestWebhooks
);
Expand Down
4 changes: 2 additions & 2 deletions config/login/adminlogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function login() {

$.ajax({
type: "POST",
url: "API/users/login",
url: "api/users/login",
data: {
username: document.getElementById("username").value,
password: document.getElementById("pwd").value,
Expand Down Expand Up @@ -72,7 +72,7 @@ function setupLogin() {

$.ajax({
type: "POST",
url: "API/users/first_signup",
url: "api/users/first_signup",
data: {
username: document.getElementById("username").value,
password: document.getElementById("pwd").value,
Expand Down
28 changes: 8 additions & 20 deletions configure/src/pages/APIs/APIs.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ import ApiIcon from "@mui/icons-material/Api";
import OpenInNewIcon from "@mui/icons-material/OpenInNew";

const apiCards = {
"MMGIS Backend API": {
title: "MMGIS Backend API",
subtitle: "An incomplete list of supported backend endpoints.",
"MMGIS API": {
title: "MMGIS API",
subtitle:
"The Core MMGIS API provides a series of robust endpoints for managing mission configurations, datasets, geodatasets, drawing functionalities, file operations, user management and geospatial operations.",
description: "",
link: `https://nasa-ammos.github.io/MMGIS/apis/backend`,
link: `${window.location.pathname
.replace(`/configure-beta`, "")
.replace(/^\//g, "")}/api/docs`,
active: true,
},
"MMGIS JavaScript API": {
Expand All @@ -26,21 +29,6 @@ const apiCards = {
link: `https://nasa-ammos.github.io/MMGIS/apis/javascript`,
active: true,
},
"MMGIS Configure API": {
title: "MMGIS Configure API",
subtitle: "Enables programmatic control over configuration endpoints.",
description: "",
link: `https://nasa-ammos.github.io/MMGIS/apis/configure`,
active: true,
},
"MMGIS GeoDatasets API": {
title: "MMGIS GeoDatasets API",
subtitle:
"Enables programmatic control over GeoDataset layers. GeoDatasets are GeoJSON files uploaded and managed by MMGIS and stored in MMGIS’ Postgres/PostGIS database.",
description: "",
link: `https://nasa-ammos.github.io/MMGIS/apis/geodatasets`,
active: true,
},
STAC: {
title: "STAC",
subtitle: "FastAPI implementation of the STAC API spec.",
Expand Down Expand Up @@ -118,7 +106,7 @@ const useStyles = makeStyles((theme) => ({
"rgba(0, 0, 0, 0.2) 0px 2px 1px -1px, rgba(0, 0, 0, 0.14) 0px 1px 1px 0px, rgba(0, 0, 0, 0.12) 0px 1px 3px 0px",
transition: "background 0.2s ease-in-out",
"&:hover": {
background: theme.palette.swatches.grey[850],
background: theme.palette.swatches.grey[800],
cursor: "pointer",
},
},
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ services:
"curl",
"-XGET",
"-k",
"http://mmgis:8888/API/utils/healthcheck",
"http://mmgis:8888/api/utils/healthcheck",
]
interval: 20s
retries: 5
Expand Down
Loading

0 comments on commit f4a9db9

Please sign in to comment.