You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.24
Plugin version
1.10
Node.js version
18.x
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
14.0
Description
@fastify/swagger-ui@1.10.0 broke the ability to set custom logo
It's because fastify/swagger-ui/lib/swagger-initializer.js has selector for image like '#swagger-ui > section > div.topbar > div > div > a > img', but new version of swagger-ui has svg logo, not img
Full code:
if(logoData&&resConfig.layout==='StandaloneLayout'){constimg=document.querySelector('#swagger-ui > section > div.topbar > div > div > a > img')img.src=logoData}
Fix code (example):
if(logoData&&resConfig.layout==='StandaloneLayout'){constlink=document.querySelector('#swagger-ui > section > div.topbar > div > div > a');constimg=document.createElement('img');img.height=40;img.src=logoData;link.innerHTML='';link.appendChild(img);}
Steps to Reproduce
// Default logo in @fastify/swagger-ui@1.9.0 is Fastify, but from v1.10.0 default logo is swagger
Prerequisites
Fastify version
4.24
Plugin version
1.10
Node.js version
18.x
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
14.0
Description
@fastify/swagger-ui@1.10.0
broke the ability to set custom logoIt's because
fastify/swagger-ui/lib/swagger-initializer.js
has selector for image like'#swagger-ui > section > div.topbar > div > div > a > img'
, but new version ofswagger-ui
has svg logo, not imgFull code:
Fix code (example):
Steps to Reproduce
// Default logo in
@fastify/swagger-ui@1.9.0
is Fastify, but from v1.10.0 default logo is swaggerExpected Behavior
See the custom logo from ui configuration on the swagger documentation page
The text was updated successfully, but these errors were encountered: