eropple / fastify-openapi3

Developer-friendly OpenAPI3 tooling for Fastify that's easy to use.
23 stars 2 forks source link

How about concentrate only on rapidoc ui support? #3

Closed SleepWalker closed 1 year ago

SleepWalker commented 1 year ago

fastify-swagger was split onto @fastify/swagger and @fastify/swagger-ui. @fastify/swagger concentrates only on providing swagger/oas3 schema without any ui.

This means that in theory fastify-openapi3 could also be based on schema provided by @fastify/swagger and concentrate only on providing the RapiDoc ui integration. @eropple what do you think about it?

eropple commented 1 year ago

As near as I can tell, @fastify/swagger still requires you to pre-define the universe at the top of your document; if you have model definitions, they need to be pre-loaded. The primary value of @eropple/fastify-openapi3 to me, tbh, is a simple way to handle your models as they relate to your operations (and using them ergonomically via Typebox), not just that "it uses Rapidoc".

If I'm missing something, please let me know.

SleepWalker commented 1 year ago

@fastify/swagger allows you to use typebox as well (and I actually using it). You need just to specify the schema prop without hacky oas and schemaType. However you also need to specify "header" of open api schema via plugin options. E.g. auth, app name and version.

simple way to handle your models as they relate to your operations

I haven't understood this. Do you mean that you can share the same model for multiple operations using $ref (btw. the readme does not highlight this feature)? I haven't tested this with raw fastify because for me it's easier just to share types using nodejs modules. So instead of using $ref, I just import the same type definition everywhere where I need it.


Anyway that was my mistake. This lib does not suit my needs. I just simply need a way to use rapidoc. So I'd better create a separate plugin for that :sweat_smile: