Skip to content
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

Support for feathers v5 (Dove) #240

Closed
doerfli opened this issue Oct 14, 2022 · 9 comments
Closed

Support for feathers v5 (Dove) #240

doerfli opened this issue Oct 14, 2022 · 9 comments
Labels

Comments

@doerfli
Copy link

doerfli commented Oct 14, 2022

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 the koa-mount dependency. But it does not automatically generate the exposed services in the swagger.json. Manually settings docs 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.

@Mairu
Copy link
Collaborator

Mairu commented Oct 15, 2022

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'],
    }
  });
}

@doerfli
Copy link
Author

doerfli commented Oct 15, 2022

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.

@daffl
Copy link
Member

daffl commented Oct 15, 2022

Could we add schema (and other OpenApi) information with the new service options and auto generate things from that?

@doerfli
Copy link
Author

doerfli commented Oct 15, 2022

Sounds like a logical place to put it to me, but then i don't know the inner working of feathersjs at all. 🤷‍♂️

@Mairu
Copy link
Collaborator

Mairu commented Oct 15, 2022

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)

@Mairu
Copy link
Collaborator

Mairu commented Oct 23, 2022

Pre release has been published as 3.0.0-pre.0

@nickdex
Copy link

nickdex commented Jan 21, 2023

@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

@Mairu
Copy link
Collaborator

Mairu commented Jan 21, 2023

@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/#/

@Mairu
Copy link
Collaborator

Mairu commented Mar 18, 2023

Version 3.0.0 with dove support was released.

@Mairu Mairu closed this as completed Mar 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants