Skip to content

Commit ecc56ab

Browse files
committed
fix: removes empty strings resulting from snakifying non-word character strings in tags ('/' for legacy paths).
1 parent 34dc8a6 commit ecc56ab

File tree

3 files changed

+17
-19
lines changed

3 files changed

+17
-19
lines changed

api-docs/scripts/openapi-docs/index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,11 @@ function openapiPaths(openapi, prefix, outPath) {
2424
.forEach((p) => {
2525
const delimiter = '/';
2626
let key = p.split(delimiter);
27-
2827
let isItemPath = openapiUtils.isPlaceholderFragment(key[key.length - 1]);
2928
if(isItemPath) {
3029
key = key.slice(0, -1);
3130
}
3231
key = (key.slice(0, 4))
33-
3432
isItemPath = openapiUtils.isPlaceholderFragment(key[key.length - 1]);
3533
if(isItemPath) {
3634
key = key.slice(0, -1);
@@ -78,9 +76,10 @@ function createArticleDataForPathGroup(openapi) {
7876
article.fields.title = openapi.info && openapi.info.title;
7977
article.fields.description = openapi.description;
8078
const pathGroupFrags = path.parse(openapi['x-pathGroup']);
81-
article.fields.tags = ([pathGroupFrags?.dir, pathGroupFrags?.name]).map(
82-
t => snakifyPath(t)
83-
)
79+
console.log(pathGroupFrags)
80+
article.fields.tags = ([pathGroupFrags?.dir, pathGroupFrags?.name])
81+
.map( t => snakifyPath(t))
82+
.filter(t => t.length > 0);
8483
return article;
8584
}
8685

@@ -132,5 +131,4 @@ module.exports = {
132131
openapiToData,
133132
openapiPaths,
134133
openapiMetadata
135-
136134
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"@evilmartians/lefthook": "^1.7.1",
99
"@vvago/vale": "^3.4.2",
1010
"autoprefixer": ">=10.2.5",
11-
"hugo-extended": ">=0.101.0",
1211
"postcss": ">=8.4.31",
1312
"postcss-cli": ">=9.1.0",
1413
"prettier": "^3.2.5",
@@ -17,6 +16,7 @@
1716
"dependencies": {
1817
"axios": "^1.7.4",
1918
"hugo-data-to-pages": "https://github.com/jstirnaman/hugo-data-to-pages",
19+
"hugo-extended": "^0.134.2",
2020
"js-yaml": "^4.1.0"
2121
},
2222
"scripts": {

yarn.lock

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -454,11 +454,11 @@ crypto-random-string@^4.0.0:
454454
type-fest "^1.0.1"
455455

456456
debug@^4.3.4:
457-
version "4.3.6"
458-
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.6.tgz#2ab2c38fbaffebf8aa95fdfe6d88438c7a13c52b"
459-
integrity sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==
457+
version "4.3.7"
458+
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52"
459+
integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==
460460
dependencies:
461-
ms "2.1.2"
461+
ms "^2.1.3"
462462

463463
decamelize@^1.2.0:
464464
version "1.2.0"
@@ -885,10 +885,10 @@ http2-wrapper@^2.1.10:
885885
toml "^3.0.0"
886886
yargs "^13.3.2"
887887

888-
hugo-extended@>=0.101.0:
889-
version "0.133.0"
890-
resolved "https://registry.yarnpkg.com/hugo-extended/-/hugo-extended-0.133.0.tgz#77ad49e1e394634337b7ce198053e670969fe836"
891-
integrity sha512-+C3I/0uUww04mcdkRdcdsfqHlCXMRQrvi7dUqlyPQViDqIMszPzKQorKEB3YddYEJLomLKoUtAoxs2JVqTXT8A==
888+
hugo-extended@^0.134.2:
889+
version "0.134.2"
890+
resolved "https://registry.yarnpkg.com/hugo-extended/-/hugo-extended-0.134.2.tgz#306a37f34ea57722a355b2ad1136935bd0dc3c48"
891+
integrity sha512-rCt3hrgYAUoGOfOnv1s4p2mID/TDHdad+FSgPtB7wVKeDOZZe0UJtlTkCzQZ4bVNHUCQb6YMDV7Dh/p3IjR3mQ==
892892
dependencies:
893893
careful-downloader "^3.0.0"
894894
log-symbols "^5.1.0"
@@ -1220,10 +1220,10 @@ moo@^0.5.0:
12201220
resolved "https://registry.yarnpkg.com/moo/-/moo-0.5.2.tgz#f9fe82473bc7c184b0d32e2215d3f6e67278733c"
12211221
integrity sha512-iSAJLHYKnX41mKcJKjqvnAN9sf0LMDTXDEvFv+ffuRR9a1MIuXLjMNL6EsnDHSkKLTWNqQQ5uo61P4EbU4NU+Q==
12221222

1223-
ms@2.1.2:
1224-
version "2.1.2"
1225-
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
1226-
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
1223+
ms@^2.1.3:
1224+
version "2.1.3"
1225+
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
1226+
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
12271227

12281228
nanoid@^3.3.7:
12291229
version "3.3.7"

0 commit comments

Comments
 (0)