enzonotario / vitepress-openapi

Generate VitePress API Docs from OpenAPI specifications
https://vitepress-openapi.vercel.app
MIT License
54 stars 9 forks source link

prefixItems and oneOf does not seems to be supported #111

Open wighawag opened 3 weeks ago

wighawag commented 3 weeks ago

Current behavior

My openapi spec contains oneOf and prefixItems

for oneOf, it seems vitepress-openapi only show the first possible type

for prefixItems it just do not shows it

Desired behavior

No response

Reproduction

No response

Steps to reproduce

git clone https://github.com/wighawag/fuzd.git
cd fuzd
git checkout feat/vitepress-openapi
pnpm i
pnpm docs:dev
# for oneOf, see http://localhost:5173/api-all-in-one/#get-api-paymentAccountBroadcaster
# it shows null, while null is only one of the possible type

# for prefixItems I had an earlier example here : https://github.com/wighawag/fuzd/commit/d47b3452280a13aeb6d38c6c7301e51b8be7f2fc
# where error (click 500) where not showing properly because I was using prefixItems

Logs and Error Messages

No response

Other Information

No response

enzonotario commented 3 days ago

Hi @wighawag , I'm also working on oneOf properties in #122 .

Regarding prefixItems, how would you expect to see it reflected in the UI? I don't see anything special for these properties in Scalar for example. So far, vitepress-openapi and Scalar display your Schema almost identically:

image

image

I'd appreciate your feedback. Thanks!

wighawag commented 2 days ago

prefixItems are the required item in an array

So input is only valid if it contains them. Ie empty array is invalid.

What you got so far is acceptable in my opinion as a first step.

Displaying such item might indeed be complicated, especially since you would need to support any kind of such items, even if each prefixItem is of different types

Actually, this common for json rpc params array

Maybe you could support it by showing the list of each required item?