Skip to content

Conversation

blindaa121
Copy link
Collaborator

@blindaa121 blindaa121 commented Feb 21, 2025

Description

This PR addresses an issue in the event that an OpenAPI spec provides an empty request body, which causes the following error when running the yarn gen-api command:

Loading of api failed for "/Users/blinda/Desktop/projects/docusaurus-openapi-docs/demo/examples/odinconnector.json"

[ERROR] TypeError: Cannot read properties of undefined (reading 'endsWith')
    at createItems (/Users/blinda/Desktop/projects/docusaurus-openapi-docs/packages/docusaurus-plugin-openapi-docs/lib/openapi/openapi.js:155:41)
    at processOpenapiFile (/Users/blinda/Desktop/projects/docusaurus-openapi-docs/packages/docusaurus-plugin-openapi-docs/lib/openapi/openapi.js:514:19)
    at async /Users/blinda/Desktop/projects/docusaurus-openapi-docs/packages/docusaurus-plugin-openapi-docs/lib/openapi/openapi.js:468:35
    at async Promise.all (index 0)
    at async processOpenapiFiles (/Users/blinda/Desktop/projects/docusaurus-openapi-docs/packages/docusaurus-plugin-openapi-docs/lib/openapi/openapi.js:479:22)
    at async generateApiDocs (/Users/blinda/Desktop/projects/docusaurus-openapi-docs/packages/docusaurus-plugin-openapi-docs/lib/index.js:95:44)
    at async /Users/blinda/Desktop/projects/docusaurus-openapi-docs/packages/docusaurus-plugin-openapi-docs/lib/index.js:500:15

Motivation and Context

See #1085 for context.

How Has This Been Tested?

Tested locally with spec provided in #1085

Screenshots (if appropriate)

image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes if appropriate.
  • All new and existing tests passed.

@github-actions
Copy link

Size Change: 0 B

Total Size: 2.06 MB

ℹ️ View Unchanged
Filename Size
demo/.docusaurus/codeTranslations.json 2 B
demo/.docusaurus/docusaurus.config.mjs 13.9 kB
demo/.docusaurus/globalData.json 40.7 kB
demo/.docusaurus/i18n.json 267 B
demo/.docusaurus/registry.js 59.9 kB
demo/.docusaurus/routes.js 55.4 kB
demo/.docusaurus/routesChunkNames.json 23 kB
demo/.docusaurus/site-metadata.json 1.35 kB
demo/build/assets/css/styles.********.css 146 kB
demo/build/assets/js/main.********.js 720 kB
demo/build/assets/js/runtime~main.********.js 15.8 kB
demo/build/index.html 91.1 kB
demo/build/petstore/add-pet/index.html 27.5 kB
demo/build/petstore/create-user/index.html 21.6 kB
demo/build/petstore/create-users-with-array-input/index.html 21.6 kB
demo/build/petstore/create-users-with-list-input/index.html 21.6 kB
demo/build/petstore/delete-order/index.html 21.6 kB
demo/build/petstore/delete-pet/index.html 21.7 kB
demo/build/petstore/delete-user/index.html 21.9 kB
demo/build/petstore/find-pets-by-status/index.html 22.3 kB
demo/build/petstore/find-pets-by-tags/index.html 23 kB
demo/build/petstore/get-inventory/index.html 20.9 kB
demo/build/petstore/get-order-by-id/index.html 21.9 kB
demo/build/petstore/get-pet-by-id/index.html 22.5 kB
demo/build/petstore/get-user-by-name/index.html 22 kB
demo/build/petstore/login-user/index.html 22.5 kB
demo/build/petstore/logout-user/index.html 21.3 kB
demo/build/petstore/new-pet/index.html 21.9 kB
demo/build/petstore/pet/index.html 23.6 kB
demo/build/petstore/place-order/index.html 21.1 kB
demo/build/petstore/schemas/apiresponse/index.html 22.9 kB
demo/build/petstore/schemas/cat/index.html 36.8 kB
demo/build/petstore/schemas/category/index.html 24 kB
demo/build/petstore/schemas/dog/index.html 37.2 kB
demo/build/petstore/schemas/honeybee/index.html 37.3 kB
demo/build/petstore/schemas/id/index.html 21 kB
demo/build/petstore/schemas/order/index.html 25.1 kB
demo/build/petstore/schemas/pet/index.html 36.7 kB
demo/build/petstore/schemas/tag/index.html 22.4 kB
demo/build/petstore/schemas/user/index.html 44.9 kB
demo/build/petstore/store/index.html 21.6 kB
demo/build/petstore/subscribe-to-the-store-events/index.html 27.9 kB
demo/build/petstore/swagger-petstore-yaml/index.html 28 kB
demo/build/petstore/update-pet-with-form/index.html 21.8 kB
demo/build/petstore/update-pet/index.html 22.3 kB
demo/build/petstore/update-user/index.html 21.9 kB
demo/build/petstore/upload-file/index.html 21.7 kB
demo/build/petstore/user/index.html 22.5 kB

compressed-size-action

@github-actions
Copy link

Visit the preview URL for this PR (updated for commit e4a1a4d):

https://docusaurus-openapi-36b86--pr1091-d1grm38p.web.app

(expires Sun, 23 Mar 2025 00:34:10 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: bf293780ee827f578864d92193b8c2866acd459f

@sserrata sserrata merged commit 500ca3d into main Feb 26, 2025
10 checks passed
@sserrata sserrata deleted the frontend/body-content-fix branch February 26, 2025 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants