Skip to content

Commit 17e02f4

Browse files
committed
fixed tag id not generated properly and validated hex-color codes
1 parent 5b12639 commit 17e02f4

16 files changed

+132
-38
lines changed

dist/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
<rapi-doc
2424
id="thedoc"
25-
spec-url="./specs/petstore_extended.yaml"
25+
spec-url="./specs/additional-props.yaml"
2626
theme="dark"
2727
render-style = "read"
2828
regular-font = 'Open Sans'

dist/index.html.gz

13 Bytes
Binary file not shown.

dist/rapidoc-min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rapidoc-min.js.gz

73 Bytes
Binary file not shown.

dist/report.html

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

docs/examples/demo.html

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,30 +64,38 @@
6464
window.addEventListener('DOMContentLoaded', (event) => {
6565
const urlParams = new URLSearchParams(window.location.search);
6666

67-
const specUrl = urlParams.get('spec');
67+
let specUrl = urlParams.get('spec');
6868
const baseTheme = urlParams.get('theme');
6969
const renderStyle = urlParams.get('render-style');
7070
const bgColor = urlParams.get('bg-color');
7171
const textColor = urlParams.get('text-color');
7272
const navBg = urlParams.get('nav-bg');
7373
const primaryColor = urlParams.get('primary-color');
7474
const goto = urlParams.get('goto');
75-
7675
const rapidocEl = getRapiDoc();
76+
77+
if(!specUrl) {
78+
specUrl = '../specs/petstore.json'
79+
}
80+
rapidocEl.setAttribute('render-style', 'read');
81+
console.log('render-style must be read , actually value is %s', rapidocEl.getAttribute('render-style'));
82+
rapidocEl.setAttribute('render-style', 'view');
83+
console.log('render-style must be view , actually value is %s', rapidocEl.getAttribute('render-style'));
84+
7785
if (baseTheme) {
7886
rapidocEl.setAttribute('theme', baseTheme);
7987
}
8088
if (renderStyle) {
8189
rapidocEl.setAttribute('render-style', renderStyle);
8290
}
8391
if (bgColor) {
84-
rapidocEl.setAttribute('bg-color', bgColor);
92+
rapidocEl.setAttribute('bg-color', `#${bgColor}`);
8593
}
8694
if (textColor) {
87-
rapidocEl.setAttribute('text-color', textColor);
95+
rapidocEl.setAttribute('text-color', `#${textColor}`);
8896
}
8997
if (navBg) {
90-
rapidocEl.setAttribute('nav-bg-color', navBg);
98+
rapidocEl.setAttribute('nav-bg-color', `#${navBg}`);
9199
}
92100
if (goto) {
93101
rapidocEl.setAttribute('goto-path', goto);

docs/rapidoc-min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/specs/additional-props.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
openapi: 3.0.2
2+
info:
3+
title: Test
4+
version: "0.0.1"
5+
paths:
6+
/example:
7+
get:
8+
summary: Example operation
9+
responses:
10+
'200':
11+
description: ok
12+
content:
13+
application/json:
14+
schema:
15+
allOf:
16+
- type: object
17+
description: dynamic fields, expect to see `prop1` and `prop2` as required field names here
18+
additionalProperties:
19+
type: string
20+
- required:
21+
- prop1
22+
- prop2
23+
example:
24+
prop1: required prop
25+
prop2: required prop
26+
prop3: optional prop

docs/specs/partial-main.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
openapi: 3.0.2
2+
info:
3+
version: '1.0'
4+
title: My OpenAPI
5+
description: OpenAPI with examples
6+
servers:
7+
- url: /api
8+
paths:
9+
/tags:
10+
get:
11+
description: Tags API
12+
summary: List tags
13+
tags:
14+
- tags
15+
responses:
16+
'200':
17+
description: 'The list with all tags'
18+
content:
19+
application/json:
20+
schema:
21+
type: array
22+
items:
23+
properties:
24+
$ref: ../../../specs/partial-spec/tag-schema.yml
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
id:
2+
type: integer
3+
example: 1
4+
title:
5+
type: string
6+
example: Backend
7+
createdAt:
8+
type: string
9+
format: date-time
10+
updatedAt:
11+
type: string
12+
format: date-time

0 commit comments

Comments
 (0)