springdoc / springdoc-openapi

Library for OpenAPI 3 with spring-boot
https://springdoc.org
Apache License 2.0
3.3k stars 501 forks source link

springdoc.swagger-ui.layout #2680

Closed dalucasP closed 2 months ago

dalucasP commented 3 months ago

Describe the bug Using this property seems to only work with default layouts provided by swagger such as BaseLayout/StandaloneLayout. Providing a custom layout documented here https://swagger.io/docs/open-source-tools/swagger-ui/customization/custom-layout/ and placing not only in the java/resources directory of the springboot service application but also /resources/META-INF/resources/webjars/swagger-ui/ returns the following error (as a .jsx file)

No layout defined for "MyCustomLayout"

To Reproduce Steps to reproduce the behavior:

Expected behavior The layout of the swagger-ui page would show the custom layout provided MyCustomLayout.jsx

`import React from "react" // Create the layout component class MyCustomLayout extends React.Component { render() { const { getComponent } = this.props const BaseLayout = getComponent("BaseLayout", true) return (

Systems Online
Systems Online
)

} } // Create the plugin that provides our layout component const MyCustomLayoutPlugin = () => { return { components: { MyCustomLayout: MyCustomLayout } } }`

bnasslahsen commented 2 months ago

@dalucasP,

Make sure your Layout is correctly declared. For this follow the swagger-ui instructions.

If you are still having the issue, you need to provide a Minimal, Reproducible Example - with HelloController that reproduces the problem.

This ticket will be closed, but can be reopened if your provide the reproducible sample.