Skip to content

Commit 2505d81

Browse files
committed
Merge commit 'd7a0a4da17241dd9c089202dba76a8312248616e'
2 parents db84939 + d7a0a4d commit 2505d81

17 files changed

+7409
-6481
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: node_js
22
node_js:
3-
- '10'
3+
- '12'
44
cache:
55
directories:
66
- "~/.cache"

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# [2.0.0-rc.51](https://github.com/Redocly/redoc/compare/v2.0.0-rc.50...v2.0.0-rc.51) (2021-04-08)
2+
3+
### Bug Fixes
4+
5+
* use openapi-core to bundle definition instead of json-schema-ref-parser ([5033946](https://github.com/Redocly/redoc/commit/503394655da2aac544e278796098cba93d9194b9)),
6+
closes: [#1506](https://github.com/Redocly/redoc/issues/1506), [#1478](https://github.com/Redocly/redoc/issues/1478)
7+
* add disable-google-font parameter to serve command in cli ([c7bbef5](https://github.com/Redocly/redoc/commit/c7bbef515524095e957729eac35a5b7a97619b55)), closes [#1501](https://github.com/Redocly/redoc/issues/1501)
8+
9+
10+
111
# [2.0.0-rc.50](https://github.com/Redocly/redoc/compare/v2.0.0-rc.49...v2.0.0-rc.50) (2021-02-15)
212

313

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Also you can pass options:
162162

163163
```js
164164
<RedocStandalone
165-
specUrl="http://rebilly.github.io/RebillyAPI/openapi.json"
165+
specUrl="https://api.redoc.ly/registry/rebilly/core-api/core/bundle/master/openapi.yaml"
166166
options={{
167167
nativeScrollbars: true,
168168
theme: { colors: { primary: { main: '#dd5522' } } },
@@ -176,7 +176,7 @@ You can also specify `onLoaded` callback which will be called each time Redoc ha
176176

177177
```js
178178
<RedocStandalone
179-
specUrl="http://rebilly.github.io/RebillyAPI/openapi.json"
179+
specUrl="https://api.redoc.ly/registry/rebilly/core-api/core/bundle/master/openapi.yaml"
180180
onLoaded={error => {
181181
if (!error) {
182182
console.log('Yay!');
@@ -325,7 +325,7 @@ Redoc.init(specOrSpecUrl, options, element, callback?)
325325
- `specOrSpecUrl` is either JSON object with specification or an URL to the spec in `JSON` or `YAML` format
326326
- `options` [options object](#redoc-options-object)
327327
- `element` DOM element to put ReDoc into
328-
- `callback` (optional) - callback to be called after Redoc has been fully rendered. It is also called also on errors with error as the first argument
328+
- `callback` (optional) - callback to be called after Redoc has been fully rendered. It is also called on errors with error as the first argument
329329
330330
```js
331331
Redoc.init('http://petstore.swagger.io/v2/swagger.json', {

cli/index.ts

+10-4
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ YargsParser.command(
7272
type: 'boolean',
7373
});
7474

75+
yargs.options('disable-google-font', {
76+
describe: 'Disable Google Font',
77+
type: 'boolean',
78+
default: false,
79+
});
80+
7581
yargs.demandOption('spec');
7682
return yargs;
7783
},
@@ -80,6 +86,7 @@ YargsParser.command(
8086
ssr: argv.ssr as boolean,
8187
title: argv.title as string,
8288
watch: argv.watch as boolean,
89+
disableGoogleFont: argv.disableGoogleFont as boolean,
8390
templateFileName: argv.template as string,
8491
templateOptions: argv.templateOptions || {},
8592
redocOptions: getObjectOrJSON(argv.options),
@@ -163,9 +170,8 @@ YargsParser.command(
163170
}).argv;
164171

165172
async function serve(port: number, pathToSpec: string, options: Options = {}) {
166-
let spec = await loadAndBundleSpec(pathToSpec);
173+
let spec = await loadAndBundleSpec(isURL(pathToSpec) ? pathToSpec : resolve(pathToSpec));
167174
let pageHTML = await getPageHTML(spec, pathToSpec, options);
168-
169175
const server = createServer((request, response) => {
170176
console.time('GET ' + request.url);
171177
if (request.url === '/redoc.standalone.js') {
@@ -211,7 +217,7 @@ async function serve(port: number, pathToSpec: string, options: Options = {}) {
211217

212218
const handlePath = async _path => {
213219
try {
214-
spec = await loadAndBundleSpec(pathToSpec);
220+
spec = await loadAndBundleSpec(resolve(pathToSpec));
215221
pageHTML = await getPageHTML(spec, pathToSpec, options);
216222
log('Updated successfully');
217223
} catch (e) {
@@ -238,7 +244,7 @@ async function serve(port: number, pathToSpec: string, options: Options = {}) {
238244

239245
async function bundle(pathToSpec, options: Options = {}) {
240246
const start = Date.now();
241-
const spec = await loadAndBundleSpec(pathToSpec);
247+
const spec = await loadAndBundleSpec(isURL(pathToSpec) ? pathToSpec : resolve(pathToSpec));
242248
const pageHTML = await getPageHTML(spec, pathToSpec, { ...options, ssr: true });
243249

244250
mkdirp.sync(dirname(options.output!));

0 commit comments

Comments
 (0)