From 96ba9671cd61c50af7fd7034f574f4223125b7f1 Mon Sep 17 00:00:00 2001 From: Akshay Date: Mon, 16 Aug 2021 11:19:09 +0200 Subject: [PATCH] Show correct Aquarius rest enpoints (#699) --- src/templates/Swagger/Paths.jsx | 5 ++-- src/templates/Swagger/Toc.jsx | 48 ++++++++++++++++++++++----------- src/templates/Swagger/utils.js | 5 ---- 3 files changed, 35 insertions(+), 23 deletions(-) diff --git a/src/templates/Swagger/Paths.jsx b/src/templates/Swagger/Paths.jsx index c92db2cd..45badfd4 100644 --- a/src/templates/Swagger/Paths.jsx +++ b/src/templates/Swagger/Paths.jsx @@ -1,7 +1,6 @@ import React from 'react' import PropTypes from 'prop-types' import slugify from 'slugify' -import { cleanPathKey } from './utils' import styles from './Paths.module.scss' import stylesDoc from '../Doc.module.scss' @@ -142,9 +141,9 @@ Method.propTypes = { const Paths = ({ paths }) => Object.entries(paths).map(([key, value]) => ( -
+

- {cleanPathKey(key)} + {key}

{Object.entries(value).map(([key, value]) => ( diff --git a/src/templates/Swagger/Toc.jsx b/src/templates/Swagger/Toc.jsx index 7bc2e8b0..31d62322 100644 --- a/src/templates/Swagger/Toc.jsx +++ b/src/templates/Swagger/Toc.jsx @@ -9,29 +9,47 @@ import stylesSidebar from '../../components/Sidebar.module.scss' const Toc = ({ data }) => { const Ids = [] - const items = Object.keys(data.paths).map((key) => { - Ids.push(slugify(cleanPathKey(key))) + const itemsV1 = Object.keys(data.paths) + .filter((key) => key.startsWith('/api/v1/aquarius')) + .map((key) => { + Ids.push(slugify(key)) - return ( -
  • - - {cleanPathKey(key)} - -
  • - ) - }) + return ( +
  • + + {cleanPathKey(key)} + +
  • + ) + }) + const itemsOther = Object.keys(data.paths) + .filter((key) => !key.startsWith('/api/v1/aquarius')) + .map((key) => { + Ids.push(slugify(key)) + + return ( +
  • + + {key} + +
  • + ) + }) return ( - {items} + /api/v1/aquarius +
      {itemsV1}
    + {itemsOther.length ? ( + <> + Other REST endpoints +
      {itemsOther}
    + + ) : null}
    ) } diff --git a/src/templates/Swagger/utils.js b/src/templates/Swagger/utils.js index 7db3edaf..cee1a678 100644 --- a/src/templates/Swagger/utils.js +++ b/src/templates/Swagger/utils.js @@ -4,10 +4,5 @@ export const cleanPathKey = (key) => { if (key.includes('aquarius')) { keyCleaned = key.replace(/\/api\/v1\/aquarius/gi, '') } - - if (key.includes('brizo')) { - keyCleaned = key.replace(/\/api\/v1\/brizo/gi, '') - } - return keyCleaned }