Skip to content

Commit 19e09c2

Browse files
authored
Merge branch 'master' into bug/3500-missing-name-for-primitives
2 parents c2a1fa9 + bc62c1c commit 19e09c2

File tree

15 files changed

+118
-28
lines changed

15 files changed

+118
-28
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ urls.primaryName | When using `urls`, you can use this subparameter. If the valu
138138
spec | A JSON object describing the OpenAPI Specification. When used, the `url` parameter will not be parsed. This is useful for testing manually-generated specifications without hosting them.
139139
validatorUrl | By default, Swagger-UI attempts to validate specs against swagger.io's online validator. You can use this parameter to set a different validator URL, for example for locally deployed validators ([Validator Badge](https://github.com/swagger-api/validator-badge)). Setting it to `null` will disable validation.
140140
dom_id | The id of a dom element inside which SwaggerUi will put the user interface for swagger.
141+
domNode | The HTML DOM element inside which SwaggerUi will put the user interface for swagger. Overrides `dom_id`.
141142
oauth2RedirectUrl | OAuth redirect URL
142143
tagsSorter | Apply a sort to the tag list of each API. It can be 'alpha' (sort by paths alphanumerically) or a function (see [Array.prototype.sort()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) to learn how to write a sort function). Two tag name strings are passed to the sorter for each pass. Default is the order determined by Swagger-UI.
143144
operationsSorter | Apply a sort to the operation list of each API. It can be 'alpha' (sort by paths alphanumerically), 'method' (sort by HTTP method) or a function (see Array.prototype.sort() to know how sort function works). Default is the order returned by the server unchanged.

dist/swagger-ui-bundle.js

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

dist/swagger-ui-bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/swagger-ui-standalone-preset.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/swagger-ui.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/swagger-ui.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
"ieee754": "^1.1.8",
4444
"immutable": "^3.x.x",
4545
"js-yaml": "^3.5.5",
46-
"less": "2.7.1",
4746
"lodash": "4.17.2",
4847
"matcher": "^0.1.2",
4948
"memoizee": "0.4.1",

src/core/components/object-model.jsx

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ export default class ObjectModel extends Component {
1717
}
1818

1919
render(){
20-
let { schema, name, isRef, getComponent, depth, expandDepth, ...props } = this.props
20+
let { schema, name, isRef, getComponent, depth, expandDepth, specSelectors, ...props } = this.props
21+
let { isOAS3 } = specSelectors
22+
2123
let description = schema.get("description")
2224
let properties = schema.get("properties")
2325
let additionalProperties = schema.get("additionalProperties")
@@ -29,14 +31,21 @@ export default class ObjectModel extends Component {
2931
const Model = getComponent("Model")
3032
const ModelCollapse = getComponent("ModelCollapse")
3133

32-
const JumpToPathSection = ({ name }) => <span className="model-jump-to-path"><JumpToPath path={`definitions.${name}`} /></span>
34+
const JumpToPathSection = ({ name }) => {
35+
const path = isOAS3 && isOAS3() ? `components.schemas.${name}` : `definitions.${name}`
36+
return <span className="model-jump-to-path"><JumpToPath path={path} /></span>
37+
}
3338
const collapsedContent = (<span>
3439
<span>{ braceOpen }</span>...<span>{ braceClose }</span>
3540
{
3641
isRef ? <JumpToPathSection name={ name }/> : ""
3742
}
3843
</span>)
39-
44+
45+
const anyOf = specSelectors.isOAS3() ? schema.get("anyOf") : null
46+
const oneOf = specSelectors.isOAS3() ? schema.get("oneOf") : null
47+
const not = specSelectors.isOAS3() ? schema.get("not") : null
48+
4049
const titleEl = title && <span className="model-title">
4150
{ isRef && schema.get("$$ref") && <span className="model-hint">{ schema.get("$$ref") }</span> }
4251
<span className="model-title__text">{ title }</span>
@@ -94,11 +103,53 @@ export default class ObjectModel extends Component {
94103
</td>
95104
</tr>
96105
}
106+
{
107+
!anyOf ? null
108+
: <tr>
109+
<td>{ "anyOf ->" }</td>
110+
<td>
111+
{anyOf.map((schema, k) => {
112+
return <div key={k}><Model { ...props } required={ false }
113+
getComponent={ getComponent }
114+
schema={ schema }
115+
depth={ depth + 1 } /></div>
116+
})}
117+
</td>
118+
</tr>
119+
}
120+
{
121+
!oneOf ? null
122+
: <tr>
123+
<td>{ "oneOf ->" }</td>
124+
<td>
125+
{oneOf.map((schema, k) => {
126+
return <div key={k}><Model { ...props } required={ false }
127+
getComponent={ getComponent }
128+
schema={ schema }
129+
depth={ depth + 1 } /></div>
130+
})}
131+
</td>
132+
</tr>
133+
}
134+
{
135+
!not ? null
136+
: <tr>
137+
<td>{ "not ->" }</td>
138+
<td>
139+
{not.map((schema, k) => {
140+
return <div key={k}><Model { ...props } required={ false }
141+
getComponent={ getComponent }
142+
schema={ schema }
143+
depth={ depth + 1 } /></div>
144+
})}
145+
</td>
146+
</tr>
147+
}
97148
</tbody></table>
98149
}
99150
</span>
100151
<span className="brace-close">{ braceClose }</span>
101152
</ModelCollapse>
102153
</span>
103154
}
104-
}
155+
}

src/core/components/operation.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export default class Operation extends PureComponent {
186186
}
187187
</div>
188188

189-
<Collapse isOpened={shown} animated>
189+
<Collapse isOpened={shown}>
190190
<div className="opblock-body">
191191
{ deprecated && <h4 className="opblock-title_normal"> Warning: Deprecated</h4>}
192192
{ description &&

src/core/components/operations.jsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ export default class Operations extends React.Component {
6666
taggedOps.map( (tagObj, tag) => {
6767
let operations = tagObj.get("operations")
6868
let tagDescription = tagObj.getIn(["tagDetails", "description"], null)
69+
let tagExternalDocsDescription = tagObj.getIn(["tagDetails", "externalDocs", "description"])
70+
let tagExternalDocsUrl = tagObj.getIn(["tagDetails", "externalDocs", "url"])
6971

7072
let isShownKey = ["operations-tag", tag]
7173
let showTag = layoutSelectors.isShown(isShownKey, docExpansion === "full" || docExpansion === "list")
@@ -89,6 +91,22 @@ export default class Operations extends React.Component {
8991
</small>
9092
}
9193

94+
<div>
95+
{ !tagExternalDocsDescription ? null :
96+
<small>
97+
{ tagExternalDocsDescription }
98+
{ tagExternalDocsUrl ? ": " : null }
99+
{ tagExternalDocsUrl ?
100+
<a
101+
href={tagExternalDocsUrl}
102+
onClick={(e) => e.stopPropagation()}
103+
target={"_blank"}
104+
>{tagExternalDocsUrl}</a> : null
105+
}
106+
</small>
107+
}
108+
</div>
109+
92110
<button className="expand-operation" title="Expand operation" onClick={() => layoutActions.show(isShownKey, !showTag)}>
93111
<svg className="arrow" width="20" height="20">
94112
<use xlinkHref={showTag ? "#large-arrow-down" : "#large-arrow"} />

0 commit comments

Comments
 (0)