1 package info.mikethomas.fahservices.config;
2
3 /*
4 * #%L
5 * This file is part of FAHServices.
6 * %%
7 * Copyright (C) 2014 - 2024 Mike Thomas <mikepthomas@outlook.com>
8 * %%
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation, either version 3 of the
12 * License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this program. If not, see
21 * <http://www.gnu.org/licenses/gpl-3.0.html>.
22 * #L%
23 */
24
25 import io.swagger.v3.oas.models.OpenAPI;
26 import io.swagger.v3.oas.models.info.Contact;
27 import io.swagger.v3.oas.models.info.Info;
28 import io.swagger.v3.oas.models.info.License;
29 import io.swagger.v3.oas.models.servers.Server;
30
31 import org.springframework.context.annotation.Bean;
32 import org.springframework.context.annotation.Configuration;
33
34 import java.util.List;
35
36 /**
37 * <p>
38 * SwaggerInitConfig class.</p>
39 *
40 * @author Michael Thomas (mikepthomas@outlook.com)
41 * @version $Id: $Id
42 */
43 @Configuration
44 public class SwaggerInitConfig {
45
46 /**
47 * <p>apiInfo.</p>
48 *
49 * @return a {@link io.swagger.v3.oas.models.OpenAPI} object
50 */
51 @Bean
52 public OpenAPI apiInfo() {
53 var devServer = new Server()
54 .url("http://localhost:8080")
55 .description("Development Server URL");
56
57 var contact = new Contact()
58 .name("Mike Thomas")
59 .url("http://mikethomas.info")
60 .email("mikepthomas@outlook.com");
61
62 var license = new License()
63 .name("The GNU General Public License, Version 3")
64 .url("http://www.gnu.org/copyleft/gpl.html");
65
66 var info = new Info()
67 .title("FAHServices")
68 .description("Web services to connect to a folding@home v7 client")
69 .version("1.2")
70 .contact(contact)
71 .license(license);
72
73 return new OpenAPI().info(info).servers(List.of(devServer));
74 }
75 }