forked from MinecraftUtilities/Backend
fix wrong url being used for swagger
This commit is contained in:
parent
67ada952ca
commit
708ccc294d
@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.OpenAPIDefinition;
|
|||||||
import io.swagger.v3.oas.annotations.info.Contact;
|
import io.swagger.v3.oas.annotations.info.Contact;
|
||||||
import io.swagger.v3.oas.annotations.info.Info;
|
import io.swagger.v3.oas.annotations.info.Info;
|
||||||
import io.swagger.v3.oas.annotations.info.License;
|
import io.swagger.v3.oas.annotations.info.License;
|
||||||
|
import io.swagger.v3.oas.annotations.servers.Server;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.log4j.Log4j2;
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
@ -18,13 +19,6 @@ import java.util.Objects;
|
|||||||
|
|
||||||
@Log4j2
|
@Log4j2
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@OpenAPIDefinition(info = @Info(
|
|
||||||
title = "Minecraft Utilities API",
|
|
||||||
version = "1.0",
|
|
||||||
description = "Wrapper for the Minecraft APIs to make them easier to use.",
|
|
||||||
contact = @Contact(name = "Liam", email = "liam@fascinated.cc", url = "https://fascinated.cc"),
|
|
||||||
license = @License(name = "MIT License", url = "https://opensource.org/licenses/MIT")
|
|
||||||
))
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
public static final Gson GSON = new Gson();
|
public static final Gson GSON = new Gson();
|
||||||
|
35
src/main/java/cc.fascinated/config/OpenAPIConfiguration.java
Normal file
35
src/main/java/cc.fascinated/config/OpenAPIConfiguration.java
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package cc.fascinated.config;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.models.OpenAPI;
|
||||||
|
import io.swagger.v3.oas.models.info.Contact;
|
||||||
|
import io.swagger.v3.oas.models.info.Info;
|
||||||
|
import io.swagger.v3.oas.models.info.License;
|
||||||
|
import io.swagger.v3.oas.models.servers.Server;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class OpenAPIConfiguration {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public OpenAPI defineOpenAPI() {
|
||||||
|
Server server = new Server();
|
||||||
|
server.setUrl(Config.INSTANCE.getWebPublicUrl());
|
||||||
|
|
||||||
|
Contact contact = new Contact();
|
||||||
|
contact.setName("Liam");
|
||||||
|
contact.setEmail("liam@fascinated.cc");
|
||||||
|
contact.setUrl("https://fascinated.cc");
|
||||||
|
|
||||||
|
Info info = new Info();
|
||||||
|
info.setTitle("Minecraft Utilities API");
|
||||||
|
info.setVersion("1.0");
|
||||||
|
info.setDescription("Wrapper for the Minecraft APIs to make them easier to use.");
|
||||||
|
info.setContact(contact);
|
||||||
|
info.setLicense(new License().name("MIT License").url("https://opensource.org/licenses/MIT"));
|
||||||
|
|
||||||
|
return new OpenAPI().servers(List.of(server)).info(info);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user