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

unresolved imports rocket_okapi::rapidoc, rocket_okapi::swagger_ui could not find swagger_ui in rocket_okapirustc #96

Closed
jiangxiaoqiang opened this issue Jun 7, 2022 · 1 comment

Comments

@jiangxiaoqiang
Copy link

I am import the dependencies like this:

rocket = { version = "=0.5.0-rc.2", features = ["json"] }
okapi = { git = "https://github.com/GREsau/okapi.git"}
schemars = "0.7"
rocket_okapi = { git = "https://github.com/GREsau/okapi.git" }

when I added this imports:

use rocket_okapi::{openapi, openapi_get_routes, rapidoc::*, swagger_ui::*};

show error:

unresolved imports `rocket_okapi::rapidoc`, `rocket_okapi::swagger_ui`
could not find `rapidoc` in `rocket_okapi`rustc

what should I do to fix it?

@ralpha
Copy link
Collaborator

ralpha commented Jun 7, 2022

Both Swagger and Rapidocs are available under feature flags.
https://github.com/GREsau/okapi#feature-flags

So try something like this:

rocket_okapi = { git = "https://github.com/GREsau/okapi.git", features = ["swagger", "rapidoc"] }

That should fix it.

@ralpha ralpha closed this as completed Jun 7, 2022
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

2 participants