Skip to content

Invalid use of the examples OpenAPI field found in the elysia-swagger examples #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
MatthewAry opened this issue Feb 20, 2025 · 0 comments

Comments

@MatthewAry
Copy link

When I try to create examples for parameters like shown in the file below, scalar and swagger docs both end up failing to render the docs for the API because it's an invalid format.

This line and those like it:
https://github.com/elysiajs/elysia-swagger/blob/4f51a403fbcbb7ca13b929bb9526f4ddade524bc/example/plugin.ts#L61C23-L61C48

Show an invalid way to present an example for a property.
Please see the following types:
ParameterBaseObject https://github.com/kogosoftwarellc/open-api/blob/1b48b2556221a57c6b739b5a6c1648f49bc465ec/packages/openapi-types/index.ts#L376-L387
Which uses ExampleObject
https://github.com/kogosoftwarellc/open-api/blob/1b48b2556221a57c6b739b5a6c1648f49bc465ec/packages/openapi-types/index.ts#L465-L470

While I note there are other types defined for ExampleObject where the type is any this is what my TS server is resolving.

Please update the examples to be correct and also, if possible, change the types returned by TypeBox so that it's clear what the object shape needs to be for OpenAPI to work.

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

No branches or pull requests

1 participant