Hi,
Is there a way by which I can display my logo in redoc without modifying the redoc.html file?
I think it has to be configured as shown here, but how do I put it in settings.py is the question. https://github.com/Rebilly/ReDoc/blob/master/docs/redoc-vendor-extensions.md#x-logo
Thanks
You should provide a custom SchemaGenerator, overriding get_schema to set the x_logo field on the Swagger object.
@axnsan12 Thanks. It worked.
One more question. How do I change the spec-url format? The one which gives spec via Download OpenAPI specification: link. I do not want to override javascript file. Any help is much appreciated.
Thanks again.
I'm not sure what you mean. spec-url points redoc to the swagger YAML/JSON to render. You can't change it client-side without changing where it's served from the django side.
Lacking further clarification I'm going to close this. Feel free to reopen for any follow-up.
For anybody still curious about this: this is now possible without defining a custom schema generator. Just pass x_logo as an argument to the Info object.
schema_view = get_schema_view(
openapi.Info(
title="Pet store API",
default_version=API_VERSION,
description=description,
contact=openapi.Contact(email="[email protected]"),
license=openapi.License(name="MIT License"),
x_logo={
"url": "http://example.org/logo.png",
"backgroundColor": "#FFFFFF"
}
),
public=True,
permission_classes=(rest_framework.permissions.AllowAny,),
)
Most helpful comment
For anybody still curious about this: this is now possible without defining a custom schema generator. Just pass x_logo as an argument to the Info object.