Skip to content

Commit 27b679e

Browse files
authored
Merge pull request #49 from movabletype/use-redocly-cli
Use @redocly/cli MTC-29254
2 parents dca4f57 + a6415ba commit 27b679e

24 files changed

Lines changed: 134523 additions & 33279 deletions

docs/v1.html

Lines changed: 1237 additions & 2545 deletions
Large diffs are not rendered by default.

docs/v2.html

Lines changed: 6149 additions & 4232 deletions
Large diffs are not rendered by default.

docs/v3.html

Lines changed: 6556 additions & 4435 deletions
Large diffs are not rendered by default.

docs/v4.html

Lines changed: 8096 additions & 4941 deletions
Large diffs are not rendered by default.

docs/v5.html

Lines changed: 8086 additions & 4945 deletions
Large diffs are not rendered by default.

docs/v6.html

Lines changed: 8086 additions & 4945 deletions
Large diffs are not rendered by default.

download-openapi.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ for v in v1 v2 v3 v4 v5 v6; do \
44
curl -s http://192.168.58.25/cgi-bin/mt/mt-data-api.cgi/${v}/ \
55
| jq '.servers[0].url = "https://example.com/mt/mt-data-api.cgi/v1"' \
66
| jq -S . > src/openapi/${v}.json; \
7+
perl json2yaml.pl src/openapi/${v}.json > src/openapi/${v}.yaml; \
78
done

json2yaml.pl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/perl
2+
3+
use strict;
4+
use warnings;
5+
use feature qw/say/;
6+
use JSON;
7+
use YAML;
8+
use Data::Dumper; $Data::Dumper::Indent = 1;
9+
10+
my $filename = $ARGV[0];
11+
12+
exit 1 unless $filename;
13+
14+
open my $fh, '<', $filename;
15+
my $file = do { local $/; <$fh> };
16+
close $fh;
17+
18+
my $json = JSON::decode_json($file);
19+
local $YAML::Stringify = 1;
20+
my $yaml = Dump($json);
21+
say $yaml;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
},
2424
"homepage": "https://github.com/movabletype/mt-docs-data-api-reference#readme",
2525
"devDependencies": {
26+
"@redocly/cli": "^1.5.0",
2627
"child_process": "^1.0.2",
2728
"css-loader": "^6.7.1",
2829
"gulp": "^4.0.2",
2930
"gulp-connect": "^5.7.0",
3031
"marked": "^4.1.1",
31-
"redoc-cli": "^0.13.20",
3232
"style-loader": "^3.3.1",
3333
"webpack": "^5.94.0",
3434
"webpack-cli": "^4.10.0"

redoc-build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/bin/sh
22

33
for v in v1 v2 v3 v4 v5 v6; do \
4-
npx redoc-cli build src/openapi/${v}.json \
4+
npx @redocly/cli build-docs src/openapi/${v}.yaml \
55
--template src/openapi/data-api-redoc.hbs \
66
--disableGoogleFont \
77
--title "Movable Type Data API ${v}" \
88
--templateOptions.metaDescription "Movable Type Data API ${v}" \
9-
--options.sortTagsAlphabetically=true \
9+
--config redoc.config.yaml \
1010
--output docs/${v}.html; \
1111
done

0 commit comments

Comments
 (0)