Skip to content

Commit b5698a4

Browse files
authored
Merge branch 'main' into fix-crash-in-createExample
2 parents a604750 + d34664d commit b5698a4

File tree

56 files changed

+8963
-7135
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+8963
-7135
lines changed

CHANGELOG.md

Lines changed: 61 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,58 @@
1+
## 0.7.5 (Apr 29, 2024)
2+
3+
Enhancements and bug fixes
4+
5+
- Remove axios dependency ([#288](https://github.com/cloud-annotations/docusaurus-openapi/pull/288))
6+
7+
## 0.7.4 (Apr 1, 2024)
8+
9+
Bug Fixes for Docusaurus 3.2.0 upgrade ([#283](https://github.com/cloud-annotations/docusaurus-openapi/pull/283))
10+
11+
- `addLeadingSlash` and `addTrailingSlash` are now imported from `@docusaurus/utils-common`
12+
- Omit `showLastUpdateAuthor` and `showLastUpdateTime` from PluginOptions
13+
- Updated `toNav` function to handle `nav.menu` items that now have a role of `button` instead of `link`
14+
- Updated Docusaurus version to 3.2.0
15+
16+
## 0.7.3 (Jan 15, 2024)
17+
18+
Enhancements and bug fixes
19+
20+
- Use parseMarkdownFile instead of parseMarkdownString ([#277](https://github.com/cloud-annotations/docusaurus-openapi/pull/277))
21+
22+
## 0.7.2 (Dec 21, 2023)
23+
24+
Enhancements and bug fixes
25+
26+
- Fix bash syntax highlighting ([#274](https://github.com/cloud-annotations/docusaurus-openapi/pull/274))
27+
28+
## 0.7.1 (Dec 18, 2023)
29+
30+
High-level enhancements
31+
32+
- Bug fixes related to Docusaurus v3 migration
33+
34+
Other enhancements and bug fixes
35+
36+
- Fix admonitions support in Docusaurus v3 ([#271](https://github.com/cloud-annotations/docusaurus-openapi/pull/271))
37+
- Fix some MDXv3 migration bugs ([#270](https://github.com/cloud-annotations/docusaurus-openapi/pull/270))
38+
39+
## 0.7.0 (Dec 13, 2023)
40+
41+
High-level enhancements
42+
43+
- Docusaurus v3 support ([#266](https://github.com/cloud-annotations/docusaurus-openapi/pull/266))
44+
- Allow pressing enter to perform the 'Execute' action ([#255](https://github.com/cloud-annotations/docusaurus-openapi/pull/255))
45+
- Render examples in a `<code>` block ([#256](https://github.com/cloud-annotations/docusaurus-openapi/pull/256))
46+
47+
Other enhancements and bug fixes
48+
49+
- Wrap code examples tabs in narrow browser windows ([#250](https://github.com/cloud-annotations/docusaurus-openapi/pull/250))
50+
- Add border to form inputs when using light theme ([#252](https://github.com/cloud-annotations/docusaurus-openapi/pull/252))
51+
- Fix: Page crash on half surrogate pair ([#261](https://github.com/cloud-annotations/docusaurus-openapi/pull/261))
52+
153
## 0.6.4 (Mar 15, 2023)
254

3-
High level enhancements
55+
High-level enhancements
456

557
- Fixes and enhancements for array query param handling ([#241](https://github.com/cloud-annotations/docusaurus-openapi/pull/241))
658
- Respect the `maxItems` property for array query params
@@ -18,7 +70,7 @@ Other enhancements and bug fixes
1870

1971
## 0.6.3 (Nov 7, 2022)
2072

21-
High level enhancements
73+
High-level enhancements
2274

2375
- Compatibility with Docusaurus 2.2.0 ([#223](https://github.com/cloud-annotations/docusaurus-openapi/pull/223))
2476
- Support for loading custom Markdown Files: ([#193](https://github.com/cloud-annotations/docusaurus-openapi/pull/193))
@@ -30,7 +82,7 @@ Other enhancements and bug fixes
3082

3183
## 0.6.2 (Aug 11, 2022)
3284

33-
High level enhancements
85+
High-level enhancements
3486

3587
- Authorize with api keys in header
3688

@@ -54,7 +106,7 @@ Other enhancements and bug fixes
54106

55107
## 0.6.0 (Jun 23, 2022)
56108

57-
High level enhancements
109+
High-level enhancements
58110

59111
- Compatibility with Docusaurus 2.0.0-beta.21
60112

@@ -68,7 +120,7 @@ Other enhancements and bug fixes
68120

69121
## 0.5.0 (Jan 9, 2022)
70122

71-
High level enhancements
123+
High-level enhancements
72124

73125
- All theme components are now TypeScript 🎉
74126

@@ -97,7 +149,7 @@ Enhancements and bug fixes
97149

98150
## 0.4.0 (Dec 23, 2021)
99151

100-
High level enhancements
152+
High-level enhancements
101153

102154
- Docusaurus beta.14 support
103155

@@ -156,7 +208,7 @@ Other enhancements and bug fixes
156208

157209
## 0.3.1 (Dec 21, 2021)
158210

159-
High level enhancements
211+
High-level enhancements
160212

161213
- Added support for more schema qualifiers:
162214

@@ -203,7 +255,7 @@ Other enhancements and bug fixes
203255

204256
## 0.3.0 (Dec 16, 2021)
205257

206-
High level enhancements
258+
High-level enhancements
207259

208260
- Docusaurus beta.13 support (Thanks @Josh-Cena!)
209261

@@ -281,7 +333,7 @@ Fix broken package
281333

282334
## 0.2.1 (Dec 5, 2021)
283335

284-
High level enhancements
336+
High-level enhancements
285337

286338
- The demo panel now allows you to choose the security scheme from a dropdown that is populated by the OpenAPI definition (only showing the dropdown if more than one is listed)
287339
- Adds support for using multiple auth modes simultaneously (Eg: `(BearerAuth) OR (ApiKeyAuth AND BasicAuth)`)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<h1 align="center">Docusaurus OpenAPI (beta)</h1>
1+
<h1 align="center">Docusaurus OpenAPI</h1>
22

33
<div align="center">
44

5-
OpenAPI plugin for generating API reference docs in Docusaurus v2.
5+
OpenAPI plugin for generating API reference docs in Docusaurus.
66

77
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/cloud-annotations/docusaurus-plugin-openapi/blob/HEAD/LICENSE)
88
[![npm latest package](https://img.shields.io/npm/v/docusaurus-preset-openapi/latest.svg)](https://www.npmjs.com/package/docusaurus-preset-openapi)

cypress/integration/test.spec.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,19 @@ function navTo(links: RegExp[], heading: RegExp) {
4747
return false;
4848
});
4949

50-
for (let link of links) {
51-
cy.get("nav.menu")
52-
.findByRole("link", { name: link })
53-
.click({ force: true }); // sometimes the sidebar items get covered by the navbar in CI.
54-
}
50+
links.forEach((linkRegex) => {
51+
cy.get("nav.menu").then(($menu) => {
52+
const navElement = $menu
53+
.find("a")
54+
.toArray()
55+
.find((el) => linkRegex.test(el.innerText));
56+
if (navElement) {
57+
cy.wrap(navElement).click({ force: true });
58+
} else {
59+
cy.log(`No link or button found matching regex: ${linkRegex}`);
60+
}
61+
});
62+
});
5563

5664
cy.findByRole("heading", { name: heading, level: 1 }).should("exist");
5765
}

demo/docusaurus.config.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
// @ts-check
2-
// Note: type annotations allow type checking and IDEs autocompletion
2+
// `@type` JSDoc annotations allow editor autocompletion and type checking
3+
// (when paired with `@ts-check`).
4+
// There are various equivalent ways to declare your Docusaurus config.
5+
// See: https://docusaurus.io/docs/api/docusaurus-config
36

4-
const lightCodeTheme = require("prism-react-renderer/themes/github");
5-
const darkCodeTheme = require("prism-react-renderer/themes/dracula");
7+
import { themes as prismThemes } from "prism-react-renderer";
68

79
/** @type {import('@docusaurus/types').Config} */
810
const config = {
@@ -16,6 +18,18 @@ const config = {
1618
organizationName: "cloud-annotations", // Usually your GitHub org/user name.
1719
projectName: "docusaurus-openapi", // Usually your repo name.
1820

21+
markdown: {
22+
mdx1Compat: {
23+
comments: false,
24+
admonitions: false,
25+
headingIds: false,
26+
},
27+
},
28+
29+
future: {
30+
experimental_faster: true,
31+
},
32+
1933
presets: [
2034
[
2135
"docusaurus-preset-openapi",
@@ -113,8 +127,8 @@ const config = {
113127
copyright: `Copyright © ${new Date().getFullYear()} Cloud Annotations. Built with Docusaurus.`,
114128
},
115129
prism: {
116-
theme: lightCodeTheme,
117-
darkTheme: darkCodeTheme,
130+
theme: prismThemes.github,
131+
darkTheme: prismThemes.dracula,
118132
},
119133
api: {
120134
authPersistance: "localStorage",
@@ -123,4 +137,4 @@ const config = {
123137
}),
124138
};
125139

126-
module.exports = config;
140+
export default config;

demo/examples/openapi-cos.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"put": {
8080
"tags": ["Bucket operations"],
8181
"summary": "Create a bucket",
82-
"description": "A `PUT` request sent to the endpoint root followed by a string will create a bucket.\nFor more information about endpoints, see [Endpoints and storage locations](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-endpoints#endpoints).\nBucket names must be globally unique and DNS-compliant; names between 3 and 63 characters long must be made of lowercase letters, numbers, and dashes.\nBucket names must begin and end with a lowercase letter or number.\nBucket names resembling IP addresses are not allowed.\nThis operation doesn't make use of operation specific query parameters.\n\n:::info important\nBucket names must be unique because all buckets in the public cloud share a global namespace.\nThis allows for access to a bucket without needing to provide any service instance or account information.\nIt is also not possible to create a bucket with a name beginning with `cosv1-` or `account-` as these prefixes are reserved by the system.\n:::\n\n:::note\nPersonally Identifiable Information (PII): When creating buckets or adding objects, please ensure to not use any information that can identify any user (natural person) by name, location or any other means in the name of the bucket or object.\n:::\n\n## Create a bucket with a different storage class\n\nTo create a bucket with a different storage class, send an XML block specifying a bucket configuration with a `LocationConstraint` of `{provisioning code}` in the body of a `PUT` request to a bucket endpoint.\nFor more information about endpoints, see [Endpoints and storage locations](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-endpoints#endpoints).\nNote that standard bucket [naming rules](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-compatibility-api-bucket-operations#compatibility-api-new-bucket) apply.\nThis operation does not make use of operation specific query parameters.\n\nThe body of the request must contain an XML block with the following schema:\n\n```xml\n<CreateBucketConfiguration>\n <LocationConstraint>us-vault</LocationConstraint>\n</CreateBucketConfiguration>\n```\n\nA list of valid provisioning codes for `LocationConstraint` can be referenced in [the Storage Classes guide](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-classes#classes-locationconstraint).\n\n## Create a new bucket with Key Protect or Hyper Protect Crypto Services managed encryption keys (SSE-KP)\n\nTo create a bucket where the encryption keys are managed by Key Protect or Hyper Protect Crypto Services, it is necessary to have access to an active Key Protect or Hyper Protect Crypto Services service instance located in the same location as the new bucket.\nThis operation does not make use of operation specific query parameters.\n\nFor more information on using Key Protect to manage your encryption keys, [see the documentation for Key Protect](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial).\n\nFor more information on Hyper Protect Crypto Services, [see the documentation](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started).\n\n:::note\nNote that managed encryption is **not** available in a Cross Region configuration and any SSE-KP buckets must be Regional.\n:::",
82+
"description": "A `PUT` request sent to the endpoint root followed by a string will create a bucket.\nFor more information about endpoints, see [Endpoints and storage locations](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-endpoints#endpoints).\nBucket names must be globally unique and DNS-compliant; names between 3 and 63 characters long must be made of lowercase letters, numbers, and dashes.\nBucket names must begin and end with a lowercase letter or number.\nBucket names resembling IP addresses are not allowed.\nThis operation doesn't make use of operation specific query parameters.\n\n:::info[important]\nBucket names must be unique because all buckets in the public cloud share a global namespace.\nThis allows for access to a bucket without needing to provide any service instance or account information.\nIt is also not possible to create a bucket with a name beginning with `cosv1-` or `account-` as these prefixes are reserved by the system.\n:::\n\n:::note\nPersonally Identifiable Information (PII): When creating buckets or adding objects, please ensure to not use any information that can identify any user (natural person) by name, location or any other means in the name of the bucket or object.\n:::\n\n## Create a bucket with a different storage class\n\nTo create a bucket with a different storage class, send an XML block specifying a bucket configuration with a `LocationConstraint` of `{provisioning code}` in the body of a `PUT` request to a bucket endpoint.\nFor more information about endpoints, see [Endpoints and storage locations](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-endpoints#endpoints).\nNote that standard bucket [naming rules](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-compatibility-api-bucket-operations#compatibility-api-new-bucket) apply.\nThis operation does not make use of operation specific query parameters.\n\nThe body of the request must contain an XML block with the following schema:\n\n```xml\n<CreateBucketConfiguration>\n <LocationConstraint>us-vault</LocationConstraint>\n</CreateBucketConfiguration>\n```\n\nA list of valid provisioning codes for `LocationConstraint` can be referenced in [the Storage Classes guide](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-classes#classes-locationconstraint).\n\n## Create a new bucket with Key Protect or Hyper Protect Crypto Services managed encryption keys (SSE-KP)\n\nTo create a bucket where the encryption keys are managed by Key Protect or Hyper Protect Crypto Services, it is necessary to have access to an active Key Protect or Hyper Protect Crypto Services service instance located in the same location as the new bucket.\nThis operation does not make use of operation specific query parameters.\n\nFor more information on using Key Protect to manage your encryption keys, [see the documentation for Key Protect](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial).\n\nFor more information on Hyper Protect Crypto Services, [see the documentation](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started).\n\n:::note\nNote that managed encryption is **not** available in a Cross Region configuration and any SSE-KP buckets must be Regional.\n:::",
8383
"parameters": [
8484
{
8585
"name": "bucketName",

demo/examples/petstore.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ info:
3838
OAuth2 - an open protocol to allow secure authorization in a simple
3939
and standard method from web, mobile and desktop applications.
4040
41-
<SecurityDefinitions />
42-
4341
version: 1.0.0
4442
title: Swagger Petstore YAML
4543
termsOfService: "http://swagger.io/terms/"
@@ -302,6 +300,9 @@ paths:
302300
schema:
303301
type: string
304302
format: binary
303+
description: |
304+
This description contains <a href="https://www.w3.org/html/">HTML</a><br />
305+
Cat pics plz
305306
/pet/findByStatus:
306307
get:
307308
tags:
@@ -442,7 +443,7 @@ paths:
442443
- store
443444
summary: Find purchase order by ID
444445
description: >-
445-
For valid response try integer IDs with value <= 5 or > 10. Other values
446+
For valid response try integer IDs with value \<= 5 or > 10. Other values
446447
will generated exceptions
447448
operationId: getOrderById
448449
parameters:
@@ -840,13 +841,15 @@ paths:
840841
parameters:
841842
- name: username
842843
in: query
843-
description: The user name for login
844+
description: |
845+
This description contains <a href="https://www.w3.org/html/">HTML</a><br />The user name for login
844846
required: true
845847
schema:
846848
type: string
847849
- name: password
848850
in: query
849-
description: The password for login in clear text
851+
description: |
852+
This description contains [markdown](https://www.markdownguide.org/)<br />The password for login in clear text
850853
required: true
851854
schema:
852855
type: string

demo/examples/petstore/_spec_.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ info:
3838
OAuth2 - an open protocol to allow secure authorization in a simple
3939
and standard method from web, mobile and desktop applications.
4040
41-
<SecurityDefinitions />
42-
4341
version: 1.0.0
4442
title: Swagger Petstore YAML
4543
termsOfService: "http://swagger.io/terms/"
@@ -442,7 +440,7 @@ paths:
442440
- store
443441
summary: Find purchase order by ID
444442
description: >-
445-
For valid response try integer IDs with value <= 5 or > 10. Other values
443+
For valid response try integer IDs with value \<= 5 or > 10. Other values
446444
will generated exceptions
447445
operationId: getOrderById
448446
parameters:

demo/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "demo",
3-
"version": "0.6.4",
3+
"version": "0.7.5",
44
"private": true,
55
"scripts": {
66
"docusaurus": "docusaurus",
@@ -14,15 +14,15 @@
1414
"write-heading-ids": "docusaurus write-heading-ids"
1515
},
1616
"dependencies": {
17-
"@docusaurus/core": "^2.0.0",
18-
"@mdx-js/react": "^1.6.22",
17+
"@docusaurus/core": "^3.6.0",
18+
"@docusaurus/faster": "^3.6.0",
1919
"@svgr/webpack": "^5.5.0",
20-
"clsx": "^1.1.1",
21-
"docusaurus-preset-openapi": "^0.6.4",
20+
"clsx": "^1.2.1",
21+
"docusaurus-preset-openapi": "^0.7.5",
2222
"file-loader": "^6.2.0",
23-
"prism-react-renderer": "^1.2.1",
24-
"react": "^17.0.2",
25-
"react-dom": "^17.0.2",
23+
"prism-react-renderer": "^2.1.0",
24+
"react": "^18.0.0",
25+
"react-dom": "^18.0.0",
2626
"url-loader": "^4.1.1"
2727
},
2828
"browserslist": {

demo/sidebars.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ const sidebars = {
2828
*/
2929
};
3030

31-
module.exports = sidebars;
31+
export default sidebars;

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "0.6.4",
2+
"version": "0.7.5",
33
"npmClient": "yarn",
44
"useWorkspaces": true
55
}

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
"@babel/preset-typescript": "^7.16.0",
3939
"@testing-library/cypress": "^8.0.1",
4040
"@types/jest": "^27.0.2",
41-
"@types/node": "^17.0.2",
42-
"@typescript-eslint/eslint-plugin": "^4.0.0",
43-
"@typescript-eslint/parser": "^4.0.0",
41+
"@types/node": "^18.0.0",
42+
"@typescript-eslint/eslint-plugin": "^6.0.0",
43+
"@typescript-eslint/parser": "^6.0.0",
4444
"babel-eslint": "^10.0.0",
4545
"cross-env": "^7.0.3",
4646
"cypress": "^8.7.0",
@@ -66,7 +66,7 @@
6666
"start-server-and-test": "^1.14.0",
6767
"ts-jest": "^27.0.6",
6868
"ts-node": "^10.9.1",
69-
"typescript": "^4.7.4"
69+
"typescript": "^5.2.2"
7070
},
7171
"lint-staged": {
7272
"**/*": "prettier --write --ignore-unknown"

packages/create-docusaurus-openapi/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-docusaurus-openapi",
3-
"version": "0.6.4",
3+
"version": "0.7.5",
44
"description": "Create Docusaurus apps easily.",
55
"repository": {
66
"type": "git",
@@ -23,9 +23,9 @@
2323
},
2424
"license": "MIT",
2525
"dependencies": {
26-
"@docusaurus/logger": "^2.0.0",
26+
"@docusaurus/logger": "^3.6.0",
2727
"commander": "^5.1.0",
28-
"fs-extra": "^10.0.0",
28+
"fs-extra": "^11.0.0",
2929
"lodash": "^4.17.20",
3030
"prompts": "^2.4.1",
3131
"semver": "^7.3.4",
@@ -34,9 +34,10 @@
3434
"tslib": "^2.3.1"
3535
},
3636
"engines": {
37-
"node": ">=14"
37+
"node": ">=18"
3838
},
3939
"devDependencies": {
40+
"@types/fs-extra": "^11.0.0",
4041
"@types/prompts": "^2.0.9",
4142
"@types/shelljs": "^0.8.6",
4243
"@types/supports-color": "^8.1.1"

0 commit comments

Comments
 (0)