-
Notifications
You must be signed in to change notification settings - Fork 9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(oas31): add support for OpenAPI 3.1.0 badge
Refs #8501
- Loading branch information
Showing
6 changed files
with
69 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
/** | ||
* @prettier | ||
*/ | ||
import React from "react" | ||
import { OAS3ComponentWrapFactory } from "../helpers" | ||
|
||
export default OAS3ComponentWrapFactory((props) => { | ||
import { OAS30ComponentWrapFactory } from "../helpers" | ||
|
||
export default OAS30ComponentWrapFactory((props) => { | ||
const { Ori } = props | ||
|
||
return <span> | ||
<Ori {...props} /> | ||
<small className="version-stamp"> | ||
<pre className="version">OAS3</pre> | ||
</small> | ||
</span> | ||
return ( | ||
<span> | ||
<Ori {...props} /> | ||
<small className="version-stamp"> | ||
<pre className="version">OAS 3.0</pre> | ||
</small> | ||
</span> | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* @prettier | ||
*/ | ||
import React from "react" | ||
|
||
const VersionStampWrapper = (Original, system) => (props) => { | ||
if (system.specSelectors.isOAS31()) { | ||
return ( | ||
<span> | ||
<Original {...props} /> | ||
<small className="version-stamp"> | ||
<pre className="version">OAS 3.1</pre> | ||
</small> | ||
</span> | ||
) | ||
} | ||
|
||
return <Original {...props} /> | ||
} | ||
|
||
export default VersionStampWrapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
describe("OpenAPI 3.x.y Badge", () => { | ||
it("should display light green badge with version indicator for OpenAPI 3.0.x", () => { | ||
cy.visit("/?url=/documents/petstore-expanded.openapi.yaml") | ||
.get("#swagger-ui") | ||
.get("pre.version") | ||
.contains("OAS 3.0") | ||
}) | ||
|
||
it("should display light green badge with version indicator for OpenAPI 3.1.0", () => { | ||
cy.visit("/?url=/documents/features/info-openAPI31.yaml") | ||
.get("#swagger-ui") | ||
.get("pre.version") | ||
.contains("OAS 3.1") | ||
}) | ||
}) |