fumadocs-openapi 2.0.0 → 2.0.2

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.
Files changed (2) hide show
  1. package/dist/index.js +6 -4
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/generate.ts
2
- import Parser from "@apidevtools/swagger-parser";
2
+ import Parser from "@apidevtools/json-schema-ref-parser";
3
3
 
4
4
  // src/render/element.ts
5
5
  function createElement(name, props, ...child) {
@@ -298,7 +298,9 @@ function getSchemaType(schema) {
298
298
  async function renderOperation(path, method, baseUrl) {
299
299
  const info = [];
300
300
  const example = [];
301
- info.push(`## ${method.summary ?? method.operationId}`);
301
+ const title = method.summary ?? method.operationId;
302
+ if (title)
303
+ info.push(`## ${title}`);
302
304
  if (method.description)
303
305
  info.push(p(method.description));
304
306
  const body = noRef(method.requestBody);
@@ -330,7 +332,7 @@ async function renderOperation(path, method, baseUrl) {
330
332
  {
331
333
  ...schema,
332
334
  description: param.description ?? schema.description,
333
- deprecated: param.deprecated || schema.deprecated
335
+ deprecated: (param.deprecated ?? false) || (schema.deprecated ?? false)
334
336
  },
335
337
  {
336
338
  parseObject: false,
@@ -416,7 +418,7 @@ async function generate(pathOrDocument, options = {}) {
416
418
  ([key, value]) => {
417
419
  if (!value)
418
420
  throw new Error("Invalid schema");
419
- const methodKeys = ["get", "post", "patch", "delete", "head"];
421
+ const methodKeys = ["get", "post", "patch", "delete", "head", "put"];
420
422
  const methods = [];
421
423
  for (const methodKey of methodKeys) {
422
424
  const operation = value[methodKey];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-openapi",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "Generate MDX docs for your OpenAPI spec",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -17,10 +17,10 @@
17
17
  "dist"
18
18
  ],
19
19
  "dependencies": {
20
- "@apidevtools/swagger-parser": "^10.1.0",
20
+ "@apidevtools/json-schema-ref-parser": "^11.6.2",
21
21
  "fast-glob": "^3.3.1",
22
- "json-schema-to-typescript": "^13.1.1",
23
- "openapi-sampler": "^1.4.0"
22
+ "json-schema-to-typescript": "^14.0.4",
23
+ "openapi-sampler": "^1.5.1"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "18.17.5",