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

Add extra options to SwaggerUIConfig #24

Merged
merged 4 commits into from
May 24, 2020
Merged

Conversation

ThouCheese
Copy link
Contributor

@ThouCheese ThouCheese commented May 17, 2020

This pull request adds all documented items from the display category to the fields of the struct SwaggerUIConfig. There are a couple of issues still, namely:

  • turning on any of the parameters filter, show_extensions, show_common_extensions does nothing. I don't know if this is me misinterpreting the documentation, if the version of the front end doesn't like these options or if it is something else.
  • turning on the parameter max_displayed_tags seems to only alter the spacing of the models (???)

I have also changed the two original fields in SwaggerUIConfig from Option<T> to T, and configured the Default to be the same as the default in the swagger documentation. This means that

let conf = SwaggerUIConfig {
    urls: Some(vec![myroute]),
    url: Some("openapi.json".to_string()),
    ..Default::default()
}

can be replaced by

let conf = SwaggerUIConfig {
    urls: vec![myroute],
    url: "openapi.json".to_string(),
    ..Default::default()
}

which feels like a more convenient public interface. I hope this is a welcome change!

@ThouCheese ThouCheese changed the title Add extra options to SwaggerUIConfig Add extra options to SwaggerUIConfig May 17, 2020
@GREsau
Copy link
Owner

GREsau commented May 24, 2020

Thanks for the PR, this looks good!

I believe the filter not working is caused byswagger-api/swagger-ui#4267 - I'm not sure about the others, but as long as they're being set in the config correctly then I'm going to assume everything is working on Okapi's end...

@GREsau GREsau merged commit d4838c2 into GREsau:master May 24, 2020
@GREsau
Copy link
Owner

GREsau commented May 24, 2020

This is now published to crates.io in rocket_okapi v0.5.0 🙂

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

Successfully merging this pull request may close these issues.

2 participants