Closed doerfli closed 1 year ago
Hi, the branch should work with express and koa. But the schemas are not automatically consumed, and this will never be possible. My plan is to add some helper function(s), to generate the docs property from the schemas.
I have working examples (with custom-methods-v5
branch) with json schemas (not typebox yet) in my tests repository:
But be aware that I plan to add breaking changes, to support the Typebox schemas in a more convenient way. It will be something like that in the final version for dove:
import { ServiceSwaggerOptions, createSwaggerServiceOptions } from 'feathers-swagger';
import { userSchema, userDataSchema, userQuerySchema } from './users.schema';
export class UserService extends KnexService<User, UserData, UserParams> {
docs: ServiceSwaggerOptions = createSwaggerServiceOptions({
schemas: { userDataSchema, userQuerySchema, userSchema },
docs: {
securities: ['find', 'get', 'update', 'patch', 'remove'],
}
});
}
I can confirm the branch works as you said. 👍 But i then stumbled upon the typebox schema issue. Would be great to be able to configure this in a more convenient way.
Could we add schema (and other OpenApi) information with the new service options and auto generate things from that?
Sounds like a logical place to put it to me, but then i don't know the inner working of feathersjs at all. 🤷♂️
Could we add schema (and other OpenApi) information with the new service options and auto generate things from that?
Sure the swagger service options could also be loaded from the service options, but it would not change the general approach. It would be possible to set them from both, the service object property and the service options.
Or would you prefer to not have to call that function for the service options? (I think that would make typing more difficult)
Pre release has been published as 3.0.0-pre.0
@Mairu Hi, I just created a new app followed the steps defined here. I need Swagger UI so added docsPath: "/docs" but I see
{"name":"NotFound","message":"Path /docs/ not found","code":404,"className":"not-found"}
I see only branches right now in project. I'm using FeathersJS v5. Can you please help
@nickdex There is a pre-release for feathers 5, so if you install npm install feathers-swagger@pre
it should work. Documentation for the pre-release is available at https://feathersjs-ecosystem.github.io/feathers-swagger/#/
Version 3.0.0 with dove support was released.
I might be building a new feathers app soon and since dove (v5) is around the corner, i've tried using the current pre-31 version of it. So far all almost all our requirements are fulfilled, except for swagger/openapi integration which is not yet v5 compatible.
Is there a timeline for supporting it? I have tried the
custom-methods-v5
branch and could get it to work by installing thekoa-mount
dependency. But it does not automatically generate the exposed services in the swagger.json. Manually settingsdocs
on properties also fails.Do you know how to get it working or is this something you have not looked into yet? If there is a (manual) way, i would be interested. Thanks.