[X] 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') {
const img = document.querySelector('#swagger-ui > section > div.topbar > div > div > a > img')
img.src = logoData
}
Fix code (example):
if (logoData && resConfig.layout === 'StandaloneLayout') {
const link = document.querySelector('#swagger-ui > section > div.topbar > div > div > a');
const img = 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 logo It's becausefastify/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 img Full 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