docusaurus-theme-openapi-docs 0.0.0-418 → 0.0.0-419

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,10 +28,6 @@ function create(tag, props) {
28
28
  }
29
29
 
30
30
  function guard(value, cb) {
31
- if (typeof value === "boolean") {
32
- value = value.toString();
33
- }
34
-
35
31
  if (value) {
36
32
  const children = cb(value);
37
33
  return render(children);
@@ -23,9 +23,10 @@ function SchemaItem({
23
23
  schemaName,
24
24
  defaultValue,
25
25
  }) {
26
- const renderRequired = guard(required, () => (
27
- <strong className={styles.required}> required</strong>
28
- ));
26
+ const renderRequired = guard(
27
+ Array.isArray(required) ? required.includes(name) : required,
28
+ () => <strong className={styles.required}> required</strong>
29
+ );
29
30
 
30
31
  const renderSchemaDescription = guard(schemaDescription, (description) => (
31
32
  <div className={styles.schemaDescription}>
@@ -39,11 +40,14 @@ function SchemaItem({
39
40
  </div>
40
41
  ));
41
42
 
42
- const renderDefaultValue = guard(defaultValue, (value) => (
43
- <div className={styles.schemaQualifierMessage}>
44
- <ReactMarkdown children={`**Default value:** \`${value}\``} />
45
- </div>
46
- ));
43
+ const renderDefaultValue = guard(
44
+ typeof defaultValue === "boolean" ? defaultValue.toString() : defaultValue,
45
+ (value) => (
46
+ <div className={styles.schemaQualifierMessage}>
47
+ <ReactMarkdown children={`**Default value:** \`${value}\``} />
48
+ </div>
49
+ )
50
+ );
47
51
 
48
52
  const schemaContent = (
49
53
  <div>
@@ -15,10 +15,6 @@ export function create(tag, props) {
15
15
  return `<${tag}${propString}>${render(children)}</${tag}>`;
16
16
  }
17
17
  export function guard(value, cb) {
18
- if (typeof value === "boolean") {
19
- value = value.toString();
20
- }
21
-
22
18
  if (value) {
23
19
  const children = cb(value);
24
20
  return render(children);
@@ -23,9 +23,10 @@ function SchemaItem({
23
23
  schemaName,
24
24
  defaultValue,
25
25
  }) {
26
- const renderRequired = guard(required, () => (
27
- <strong className={styles.required}> required</strong>
28
- ));
26
+ const renderRequired = guard(
27
+ Array.isArray(required) ? required.includes(name) : required,
28
+ () => <strong className={styles.required}> required</strong>
29
+ );
29
30
 
30
31
  const renderSchemaDescription = guard(schemaDescription, (description) => (
31
32
  <div className={styles.schemaDescription}>
@@ -39,11 +40,14 @@ function SchemaItem({
39
40
  </div>
40
41
  ));
41
42
 
42
- const renderDefaultValue = guard(defaultValue, (value) => (
43
- <div className={styles.schemaQualifierMessage}>
44
- <ReactMarkdown children={`**Default value:** \`${value}\``} />
45
- </div>
46
- ));
43
+ const renderDefaultValue = guard(
44
+ typeof defaultValue === "boolean" ? defaultValue.toString() : defaultValue,
45
+ (value) => (
46
+ <div className={styles.schemaQualifierMessage}>
47
+ <ReactMarkdown children={`**Default value:** \`${value}\``} />
48
+ </div>
49
+ )
50
+ );
47
51
 
48
52
  const schemaContent = (
49
53
  <div>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "docusaurus-theme-openapi-docs",
3
3
  "description": "OpenAPI theme for Docusaurus.",
4
- "version": "0.0.0-418",
4
+ "version": "0.0.0-419",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -50,7 +50,7 @@
50
50
  "buffer": "^6.0.3",
51
51
  "clsx": "^1.1.1",
52
52
  "crypto-js": "^4.1.1",
53
- "docusaurus-plugin-openapi-docs": "0.0.0-418",
53
+ "docusaurus-plugin-openapi-docs": "0.0.0-419",
54
54
  "immer": "^9.0.7",
55
55
  "lodash": "^4.17.20",
56
56
  "process": "^0.11.10",
@@ -68,5 +68,5 @@
68
68
  "engines": {
69
69
  "node": ">=14"
70
70
  },
71
- "gitHead": "67e537ef8240524a94e5cdb38220b2fd499c61e0"
71
+ "gitHead": "c5df2d9c69e2d3881b329ba3586cbc3853ba553b"
72
72
  }
@@ -24,9 +24,6 @@ export function guard<T>(
24
24
  value: T | undefined | string,
25
25
  cb: (value: T) => Children
26
26
  ): string {
27
- if (typeof value === "boolean") {
28
- value = value.toString();
29
- }
30
27
  if (value) {
31
28
  const children = cb(value as T);
32
29
  return render(children);
@@ -23,9 +23,10 @@ function SchemaItem({
23
23
  schemaName,
24
24
  defaultValue,
25
25
  }) {
26
- const renderRequired = guard(required, () => (
27
- <strong className={styles.required}> required</strong>
28
- ));
26
+ const renderRequired = guard(
27
+ Array.isArray(required) ? required.includes(name) : required,
28
+ () => <strong className={styles.required}> required</strong>
29
+ );
29
30
 
30
31
  const renderSchemaDescription = guard(schemaDescription, (description) => (
31
32
  <div className={styles.schemaDescription}>
@@ -39,11 +40,14 @@ function SchemaItem({
39
40
  </div>
40
41
  ));
41
42
 
42
- const renderDefaultValue = guard(defaultValue, (value) => (
43
- <div className={styles.schemaQualifierMessage}>
44
- <ReactMarkdown children={`**Default value:** \`${value}\``} />
45
- </div>
46
- ));
43
+ const renderDefaultValue = guard(
44
+ typeof defaultValue === "boolean" ? defaultValue.toString() : defaultValue,
45
+ (value) => (
46
+ <div className={styles.schemaQualifierMessage}>
47
+ <ReactMarkdown children={`**Default value:** \`${value}\``} />
48
+ </div>
49
+ )
50
+ );
47
51
 
48
52
  const schemaContent = (
49
53
  <div>