Skip to content

swagger-ui URL problem #346

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

Closed
xMandrake opened this issue Jan 15, 2020 · 2 comments
Closed

swagger-ui URL problem #346

xMandrake opened this issue Jan 15, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@xMandrake
Copy link

Hi, first I want to thank the authors of the project. We start moved from springfox and the process went quite simple.

But we faced with one point in the maven assembly. In our case, there is a need to build jar without dependencies. All dependencies should be moved to a separate folder. This is necessary for caching docker layers to reduce disk space in our docker image repository.

In this case, files related to the swagger-ui become unavailable, for example URL
GET http://127.0.0.1:8080/swagger-ui/favicon-32x32.png 404

In the same time json spec URL is OK
GET http://127.0.0.1:8080/v3/api-docs 200

spring-boot version: 2.2.2.RELEASE
springdoc version: 1.2.26
maven build setup:

    <build>
        <plugins>
            <!-- Build JAR file WITHOUT dependencies (copy in 'libs' folder) -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <outputDirectory>${project.build.directory}/libs</outputDirectory>
                    <overWriteReleases>false</overWriteReleases>
                    <overWriteSnapshots>false</overWriteSnapshots>
                    <overWriteIfNewer>true</overWriteIfNewer>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>libs</classpathPrefix>
                            <mainClass>com.example.Application</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>

example project to reproduce issue:
https://github.com/xMandrake/spring-boot-swagger-example

It should be noted that there are no problems with the standard assembly

    <build>
        <plugins>
            <!-- Build JAR file WITH dependencies -->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

I tried add webjars dependencies directly

        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>webjars-locator</artifactId>
            <version>0.38</version>
        </dependency>
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>swagger-ui</artifactId>
            <version>3.24.0</version>
        </dependency>

and run this assembly without jar dependencies. In this case swagger-ui files URLs available, but in webjars subfolder:
http://127.0.0.1:8080/webjars/swagger-ui/favicon-32x32.png

I would be grateful for the help or advice on how to properly configure such an assembly using springdoc

@bnasslahsen
Copy link
Collaborator

Hi @xMandrake,

Thank you for providing all the elements to reproduce this issue.
I confirm that serving the swagger-ui from outside the spring-boot application jar was not handled.
This support will be available for the next release: v1.2.27

@xMandrake
Copy link
Author

Hi @bnasslahsen, just want to thank you and confirm that issue was fixed

@bnasslahsen bnasslahsen added the enhancement New feature or request label Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants