rohit-gohri / redocusaurus

OpenAPI for Docusaurus with Redoc
https://redocusaurus.vercel.app/
MIT License
629 stars 114 forks source link

[ERROR] TypeError: Cannot set properties of undefined (setting 'minItems') #304

Closed blacktop closed 1 year ago

blacktop commented 1 year ago
npm run build

> documentation@0.0.0 build
> docusaurus build

[INFO] [en] Creating an optimized production build...
[ReDoc Compatibility mode]: Converting OpenAPI 2.0 to OpenAPI 3.0
TypeError: Cannot set properties of undefined (setting 'minItems')
    at C (/Users/blacktop/Developer/Github/blacktop/ipsw/www/node_modules/redoc/bundles/redoc.lib.js:2:33595)
    at T (/Users/blacktop/Developer/Github/blacktop/ipsw/www/node_modules/redoc/bundles/redoc.lib.js:2:43282)
    at /Users/blacktop/Developer/Github/blacktop/ipsw/www/node_modules/redoc/bundles/redoc.lib.js:2:52463
    at /Users/blacktop/Developer/Github/blacktop/ipsw/www/node_modules/redoc/bundles/redoc.lib.js:2:54330
[ERROR] Unable to build website for locale en.
[ERROR] TypeError: Cannot set properties of undefined (setting 'minItems')
    at C (/Users/blacktop/Developer/Github/blacktop/ipsw/www/node_modules/redoc/bundles/redoc.lib.js:2:33595)
    at T (/Users/blacktop/Developer/Github/blacktop/ipsw/www/node_modules/redoc/bundles/redoc.lib.js:2:43282)
    at /Users/blacktop/Developer/Github/blacktop/ipsw/www/node_modules/redoc/bundles/redoc.lib.js:2:52463
    at /Users/blacktop/Developer/Github/blacktop/ipsw/www/node_modules/redoc/bundles/redoc.lib.js:2:54330
[INFO] Docusaurus version: 2.4.1
Node version: v20.5.1
blacktop commented 1 year ago

https://github.com/facebook/docusaurus/issues/9271

blacktop commented 1 year ago

I tried reverting the commit and it still fails and I tried forcing version 1.6.1 and it still fails :(

rohit-gohri commented 1 year ago

Can you share you repo where it's failing? If I can reproduce it then I might be able to fix it

blacktop commented 1 year ago

@rohit-gohri https://github.com/blacktop/ipsw/tree/master/www

blacktop commented 1 year ago

here is the commit that seemed to break it - https://github.com/blacktop/ipsw/commit/59eac04013d5f490e41fa58f28cb1ce263faf8e8

However, I tried to revert back to the older version but it still errors in the same way :(

rohit-gohri commented 1 year ago

i feel like since the action doesn't run when the swagger.json is updated it actually broke because of some change in the swagger file b/w the last successful build - this commit and the first failure

You can check the diff b/w the 2 commits and see that swagger has changed in b/w - https://github.com/blacktop/ipsw/compare/d8641ab9d653f16b365ccf3b550d9b4c6e8a5c81...59eac04013d5f490e41fa58f28cb1ce263faf8e8

So maybe the issue is not the package upgrade that's why revert doesn't work

blacktop commented 1 year ago

many thanks! I have swagger.json in my root api/ folder AND in the www/static folder. I had removed the minItems from one but not both. This has fixed the issue. This is something introduced by the latest version of https://github.com/go-swagger/go-swagger it seems :(

rohit-gohri commented 1 year ago

We use the redocly cli to parse the file (https://github.com/Redocly/redocly-cli) if you want to debug exactly what property is causing the crash

blacktop commented 1 year ago

thanks @rohit-gohri !