docusaurus-theme-openapi-docs 0.0.0-1096 → 0.0.0-1097

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.
@@ -11,6 +11,11 @@ exports.getQualifierMessage = getQualifierMessage;
11
11
  const Translate_1 = require("@docusaurus/Translate");
12
12
  const translationIds_1 = require("../theme/translationIds");
13
13
  function prettyName(schema, circular) {
14
+ // Handle enum-only schemas (valid in JSON Schema)
15
+ // When enum is present without explicit type, treat as string
16
+ if (schema.enum && !schema.type) {
17
+ return "string";
18
+ }
14
19
  if (schema.format) {
15
20
  return schema.format;
16
21
  }
@@ -906,5 +906,10 @@ const PRIMITIVE_TYPES = {
906
906
  null: true,
907
907
  };
908
908
  const isPrimitive = (schema) => {
909
+ // Enum-only schemas (without explicit type) should be treated as primitives
910
+ // This is valid JSON Schema where enum values define the constraints
911
+ if (schema.enum && !schema.type) {
912
+ return true;
913
+ }
909
914
  return PRIMITIVE_TYPES[schema.type];
910
915
  };
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-1096",
4
+ "version": "0.0.0-1097",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -38,7 +38,7 @@
38
38
  "@types/postman-collection": "^3.5.11",
39
39
  "@types/react-modal": "^3.16.3",
40
40
  "concurrently": "^9.2.0",
41
- "docusaurus-plugin-openapi-docs": "0.0.0-1096",
41
+ "docusaurus-plugin-openapi-docs": "0.0.0-1097",
42
42
  "docusaurus-plugin-sass": "^0.2.6",
43
43
  "eslint-plugin-prettier": "^5.5.1"
44
44
  },
@@ -81,5 +81,5 @@
81
81
  "engines": {
82
82
  "node": ">=14"
83
83
  },
84
- "gitHead": "0582169799b8f32b85ee3bca3cc43250e68976a2"
84
+ "gitHead": "3746c00807a095e5501d59d57945498812aab1ba"
85
85
  }
@@ -11,6 +11,12 @@ import { OPENAPI_SCHEMA_ITEM } from "../theme/translationIds";
11
11
  import { SchemaObject } from "../types";
12
12
 
13
13
  function prettyName(schema: SchemaObject, circular?: boolean) {
14
+ // Handle enum-only schemas (valid in JSON Schema)
15
+ // When enum is present without explicit type, treat as string
16
+ if (schema.enum && !schema.type) {
17
+ return "string";
18
+ }
19
+
14
20
  if (schema.format) {
15
21
  return schema.format;
16
22
  }
@@ -999,5 +999,10 @@ const PRIMITIVE_TYPES: Record<PrimitiveSchemaType, true> = {
999
999
  } as const;
1000
1000
 
1001
1001
  const isPrimitive = (schema: SchemaObject) => {
1002
+ // Enum-only schemas (without explicit type) should be treated as primitives
1003
+ // This is valid JSON Schema where enum values define the constraints
1004
+ if (schema.enum && !schema.type) {
1005
+ return true;
1006
+ }
1002
1007
  return PRIMITIVE_TYPES[schema.type as PrimitiveSchemaType];
1003
1008
  };