Merge pull request #7847 from deathbeam/swagger-static
Add Swagger static document generation
This commit is contained in:
@@ -180,6 +180,48 @@
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.github.kongchen</groupId>
|
||||
<artifactId>swagger-maven-plugin</artifactId>
|
||||
<version>3.1.8</version>
|
||||
<configuration>
|
||||
<apiSources>
|
||||
<apiSource>
|
||||
<springmvc>true</springmvc>
|
||||
<locations>
|
||||
<location>net.runelite</location>
|
||||
</locations>
|
||||
<schemes>
|
||||
<scheme>https</scheme>
|
||||
</schemes>
|
||||
<host>api.runelite.net</host>
|
||||
<basePath>/runelite-${project.version}</basePath>
|
||||
<info>
|
||||
<title>${project.parent.name} HTTP API</title>
|
||||
<version>${project.version}</version>
|
||||
<description>${project.description}</description>
|
||||
<license>
|
||||
<url>https://tldrlegal.com/license/bsd-2-clause-license-(freebsd)</url>
|
||||
<name>BSD 2-Clause "Simplified"</name>
|
||||
</license>
|
||||
</info>
|
||||
<templatePath>${basedir}/src/main/templates/template.html.hbs</templatePath>
|
||||
<swaggerDirectory>${project.build.directory}/swagger-ui</swaggerDirectory>
|
||||
<outputPath>${project.build.directory}/site/api.html</outputPath>
|
||||
<attachSwaggerArtifact>true</attachSwaggerArtifact>
|
||||
<outputFormats>json</outputFormats>
|
||||
</apiSource>
|
||||
</apiSources>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>generate</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -52,6 +52,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -135,7 +136,7 @@ public class AccountService
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("/login")
|
||||
@GetMapping("/login")
|
||||
public OAuthResponse login(@RequestParam UUID uuid)
|
||||
{
|
||||
State state = new State();
|
||||
@@ -162,7 +163,7 @@ public class AccountService
|
||||
return lr;
|
||||
}
|
||||
|
||||
@RequestMapping("/callback")
|
||||
@GetMapping("/callback")
|
||||
public Object callback(
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
@@ -250,7 +251,7 @@ public class AccountService
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("/logout")
|
||||
@GetMapping("/logout")
|
||||
public void logout(HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
SessionEntry session = auth.handle(request, response);
|
||||
@@ -268,7 +269,7 @@ public class AccountService
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("/session-check")
|
||||
@GetMapping("/session-check")
|
||||
public void sessionCheck(HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
auth.handle(request, response);
|
||||
|
||||
@@ -62,6 +62,7 @@ import net.runelite.http.service.cache.beans.IndexEntry;
|
||||
import net.runelite.http.service.util.exception.NotFoundException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -75,7 +76,7 @@ public class CacheController
|
||||
@Autowired
|
||||
private CacheService cacheService;
|
||||
|
||||
@RequestMapping("/")
|
||||
@GetMapping("/")
|
||||
public List<Cache> listCaches()
|
||||
{
|
||||
return cacheService.listCaches().stream()
|
||||
@@ -83,7 +84,7 @@ public class CacheController
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@RequestMapping("{cacheId}")
|
||||
@GetMapping("{cacheId}")
|
||||
public List<CacheIndex> listIndexes(@PathVariable int cacheId)
|
||||
{
|
||||
CacheEntry cache = cacheService.findCache(cacheId);
|
||||
@@ -99,7 +100,7 @@ public class CacheController
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@RequestMapping("{cacheId}/{indexId}")
|
||||
@GetMapping("{cacheId}/{indexId}")
|
||||
public List<CacheArchive> listArchives(@PathVariable int cacheId,
|
||||
@PathVariable int indexId)
|
||||
{
|
||||
@@ -122,7 +123,7 @@ public class CacheController
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@RequestMapping("{cacheId}/{indexId}/{archiveId}")
|
||||
@GetMapping("{cacheId}/{indexId}/{archiveId}")
|
||||
public CacheArchive getCacheArchive(@PathVariable int cacheId,
|
||||
@PathVariable int indexId,
|
||||
@PathVariable int archiveId)
|
||||
@@ -149,7 +150,7 @@ public class CacheController
|
||||
archiveEntry.getNameHash(), archiveEntry.getRevision());
|
||||
}
|
||||
|
||||
@RequestMapping("{cacheId}/{indexId}/{archiveId}/data")
|
||||
@GetMapping("{cacheId}/{indexId}/{archiveId}/data")
|
||||
public byte[] getArchiveData(
|
||||
@PathVariable int cacheId,
|
||||
@PathVariable int indexId,
|
||||
@@ -200,7 +201,7 @@ public class CacheController
|
||||
return archiveEntry;
|
||||
}
|
||||
|
||||
@RequestMapping("item/{itemId}")
|
||||
@GetMapping("item/{itemId}")
|
||||
public ItemDefinition getItem(@PathVariable int itemId) throws IOException
|
||||
{
|
||||
ArchiveEntry archiveEntry = findConfig(ConfigType.ITEM);
|
||||
@@ -221,7 +222,7 @@ public class CacheController
|
||||
return itemdef;
|
||||
}
|
||||
|
||||
@RequestMapping(path = "item/{itemId}/image", produces = "image/png")
|
||||
@GetMapping(path = "item/{itemId}/image", produces = "image/png")
|
||||
public ResponseEntity<byte[]> getItemImage(
|
||||
@PathVariable int itemId,
|
||||
@RequestParam(defaultValue = "1") int quantity,
|
||||
@@ -313,7 +314,7 @@ public class CacheController
|
||||
return ResponseEntity.ok(bao.toByteArray());
|
||||
}
|
||||
|
||||
@RequestMapping("object/{objectId}")
|
||||
@GetMapping("object/{objectId}")
|
||||
public ObjectDefinition getObject(
|
||||
@PathVariable int objectId
|
||||
) throws IOException
|
||||
@@ -336,7 +337,7 @@ public class CacheController
|
||||
return objectdef;
|
||||
}
|
||||
|
||||
@RequestMapping("npc/{npcId}")
|
||||
@GetMapping("npc/{npcId}")
|
||||
public NpcDefinition getNpc(
|
||||
@PathVariable int npcId
|
||||
) throws IOException
|
||||
|
||||
@@ -31,6 +31,7 @@ import net.runelite.http.api.config.Configuration;
|
||||
import net.runelite.http.service.account.AuthFilter;
|
||||
import net.runelite.http.service.account.beans.SessionEntry;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -52,7 +53,7 @@ public class ConfigController
|
||||
this.authFilter = authFilter;
|
||||
}
|
||||
|
||||
@RequestMapping
|
||||
@GetMapping
|
||||
public Configuration get(HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
SessionEntry session = authFilter.handle(request, response);
|
||||
|
||||
@@ -30,6 +30,7 @@ import static net.runelite.http.service.examine.ExamineType.OBJECT;
|
||||
import net.runelite.http.service.item.ItemEntry;
|
||||
import net.runelite.http.service.item.ItemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -50,19 +51,19 @@ public class ExamineController
|
||||
this.itemService = itemService;
|
||||
}
|
||||
|
||||
@RequestMapping("/npc/{id}")
|
||||
@GetMapping("/npc/{id}")
|
||||
public String getNpc(@PathVariable int id)
|
||||
{
|
||||
return examineService.get(NPC, id);
|
||||
}
|
||||
|
||||
@RequestMapping("/object/{id}")
|
||||
@GetMapping("/object/{id}")
|
||||
public String getObject(@PathVariable int id)
|
||||
{
|
||||
return examineService.get(OBJECT, id);
|
||||
}
|
||||
|
||||
@RequestMapping("/item/{id}")
|
||||
@GetMapping("/item/{id}")
|
||||
public String getItem(@PathVariable int id)
|
||||
{
|
||||
// Tradeable item examine info is available from the Jagex item API
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.CacheControl;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@@ -95,7 +96,7 @@ public class FeedController
|
||||
feedResult = new FeedResult(items);
|
||||
}
|
||||
|
||||
@RequestMapping
|
||||
@GetMapping
|
||||
public ResponseEntity<FeedResult> getFeed()
|
||||
{
|
||||
if (feedResult == null)
|
||||
|
||||
@@ -34,6 +34,7 @@ import net.runelite.http.service.util.HiscoreEndpointEditor;
|
||||
import net.runelite.http.service.xp.XpTrackerService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.WebDataBinder;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.InitBinder;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -50,7 +51,7 @@ public class HiscoreController
|
||||
@Autowired
|
||||
private XpTrackerService xpTrackerService;
|
||||
|
||||
@RequestMapping("/{endpoint}")
|
||||
@GetMapping("/{endpoint}")
|
||||
public HiscoreResult lookup(@PathVariable HiscoreEndpoint endpoint, @RequestParam String username) throws ExecutionException
|
||||
{
|
||||
HiscoreResult result = hiscoreService.lookupUsername(username, endpoint);
|
||||
@@ -68,7 +69,7 @@ public class HiscoreController
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping("/{endpoint}/{skillName}")
|
||||
@GetMapping("/{endpoint}/{skillName}")
|
||||
public SingleHiscoreSkillResult singleSkillLookup(@PathVariable HiscoreEndpoint endpoint, @PathVariable String skillName, @RequestParam String username) throws ExecutionException
|
||||
{
|
||||
HiscoreSkill skill = HiscoreSkill.valueOf(skillName.toUpperCase());
|
||||
|
||||
@@ -40,6 +40,7 @@ import net.runelite.http.api.item.SearchResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.CacheControl;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -78,7 +79,7 @@ public class ItemController
|
||||
.toArray(ItemPrice[]::new), 30, TimeUnit.MINUTES);
|
||||
}
|
||||
|
||||
@RequestMapping("/{itemId}")
|
||||
@GetMapping("/{itemId}")
|
||||
public Item getItem(HttpServletResponse response, @PathVariable int itemId)
|
||||
{
|
||||
ItemEntry item = itemService.getItem(itemId);
|
||||
@@ -91,7 +92,7 @@ public class ItemController
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/{itemId}/icon", produces = "image/gif")
|
||||
@GetMapping(path = "/{itemId}/icon", produces = "image/gif")
|
||||
public ResponseEntity<byte[]> getIcon(@PathVariable int itemId)
|
||||
{
|
||||
ItemEntry item = itemService.getItem(itemId);
|
||||
@@ -104,7 +105,7 @@ public class ItemController
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/{itemId}/icon/large", produces = "image/gif")
|
||||
@GetMapping(path = "/{itemId}/icon/large", produces = "image/gif")
|
||||
public ResponseEntity<byte[]> getIconLarge(HttpServletResponse response, @PathVariable int itemId)
|
||||
{
|
||||
ItemEntry item = itemService.getItem(itemId);
|
||||
@@ -117,7 +118,7 @@ public class ItemController
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
@RequestMapping("/{itemId}/price")
|
||||
@GetMapping("/{itemId}/price")
|
||||
public ResponseEntity<ItemPrice> itemPrice(
|
||||
@PathVariable int itemId,
|
||||
@RequestParam(required = false) Instant time
|
||||
@@ -179,7 +180,7 @@ public class ItemController
|
||||
.body(itemPrice);
|
||||
}
|
||||
|
||||
@RequestMapping("/search")
|
||||
@GetMapping("/search")
|
||||
public SearchResult search(@RequestParam String query)
|
||||
{
|
||||
List<ItemEntry> result = itemService.search(query);
|
||||
@@ -193,7 +194,7 @@ public class ItemController
|
||||
return searchResult;
|
||||
}
|
||||
|
||||
@RequestMapping("/price")
|
||||
@GetMapping("/price")
|
||||
public ItemPrice[] prices(@RequestParam("id") int[] itemIds)
|
||||
{
|
||||
if (itemIds.length > MAX_BATCH_LOOKUP)
|
||||
@@ -216,7 +217,7 @@ public class ItemController
|
||||
.toArray(ItemPrice[]::new);
|
||||
}
|
||||
|
||||
@RequestMapping("/prices")
|
||||
@GetMapping("/prices")
|
||||
public ResponseEntity<ItemPrice[]> prices()
|
||||
{
|
||||
return ResponseEntity.ok()
|
||||
|
||||
@@ -35,6 +35,7 @@ import net.runelite.http.service.account.AuthFilter;
|
||||
import net.runelite.http.service.account.beans.SessionEntry;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
@@ -65,7 +66,7 @@ public class LootTrackerController
|
||||
response.setStatus(HttpStatusCodes.STATUS_CODE_OK);
|
||||
}
|
||||
|
||||
@RequestMapping
|
||||
@GetMapping
|
||||
public Collection<LootRecord> getLootRecords(HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "count", defaultValue = "1024") int count, @RequestParam(value = "start", defaultValue = "0") int start) throws IOException
|
||||
{
|
||||
SessionEntry e = auth.handle(request, response);
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.util.concurrent.TimeUnit;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.CacheControl;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -45,7 +46,7 @@ public class OSBGrandExchangeController
|
||||
this.grandExchangeService = grandExchangeService;
|
||||
}
|
||||
|
||||
@RequestMapping
|
||||
@GetMapping
|
||||
public ResponseEntity<GrandExchangeEntry> get(@RequestParam("itemId") int itemId) throws ExecutionException
|
||||
{
|
||||
GrandExchangeEntry grandExchangeEntry = grandExchangeService.get(itemId);
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -55,7 +56,7 @@ public class SpriteController
|
||||
}
|
||||
});
|
||||
|
||||
@RequestMapping(produces = "image/png")
|
||||
@GetMapping(produces = "image/png")
|
||||
public ResponseEntity<byte[]> getSprite(
|
||||
@RequestParam int spriteId,
|
||||
@RequestParam(defaultValue = "0") int frameId
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.CacheControl;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@@ -45,7 +46,7 @@ public class WorldController
|
||||
|
||||
private WorldResult worldResult;
|
||||
|
||||
@RequestMapping
|
||||
@GetMapping
|
||||
public ResponseEntity<WorldResult> listWorlds() throws IOException
|
||||
{
|
||||
return ResponseEntity.ok()
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.time.Instant;
|
||||
import net.runelite.http.api.xp.XpData;
|
||||
import net.runelite.http.service.xp.beans.XpEntity;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -39,13 +40,13 @@ public class XpTrackerController
|
||||
@Autowired
|
||||
private XpTrackerService xpTrackerService;
|
||||
|
||||
@RequestMapping("/update")
|
||||
@GetMapping("/update")
|
||||
public void update(@RequestParam String username)
|
||||
{
|
||||
xpTrackerService.tryUpdate(username);
|
||||
}
|
||||
|
||||
@RequestMapping("/get")
|
||||
@GetMapping("/get")
|
||||
public XpData get(@RequestParam String username, @RequestParam(required = false) Instant time)
|
||||
{
|
||||
if (time == null)
|
||||
|
||||
@@ -30,6 +30,7 @@ import net.runelite.http.api.xtea.XteaKey;
|
||||
import net.runelite.http.api.xtea.XteaRequest;
|
||||
import net.runelite.http.service.util.exception.NotFoundException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -49,7 +50,7 @@ public class XteaController
|
||||
xteaService.submit(xteaRequest);
|
||||
}
|
||||
|
||||
@RequestMapping
|
||||
@GetMapping
|
||||
public List<XteaKey> get()
|
||||
{
|
||||
return xteaService.get().stream()
|
||||
@@ -57,7 +58,7 @@ public class XteaController
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@RequestMapping("/{region}")
|
||||
@GetMapping("/{region}")
|
||||
public XteaKey getRegion(@PathVariable int region)
|
||||
{
|
||||
XteaEntry xteaRegion = xteaService.getRegion(region);
|
||||
|
||||
110
http-service/src/main/templates/markdown.hbs
Normal file
110
http-service/src/main/templates/markdown.hbs
Normal file
@@ -0,0 +1,110 @@
|
||||
{{#info}}
|
||||
# {{title}}
|
||||
{{join schemes " | "}}://{{host}}{{basePath}}
|
||||
|
||||
{{description}}
|
||||
|
||||
{{#contact}}
|
||||
[**Contact the developer**](mailto:{{email}})
|
||||
{{/contact}}
|
||||
|
||||
**Version** {{version}}
|
||||
|
||||
{{#if termsOfService}}
|
||||
[**Terms of Service**]({{termsOfService}})
|
||||
{{/if}}
|
||||
|
||||
{{/info}}
|
||||
|
||||
{{#if consumes}}__Consumes:__ {{join consumes ", "}}{{/if}}
|
||||
|
||||
{{#if produces}}__Produces:__ {{join produces ", "}}{{/if}}
|
||||
|
||||
{{#if securityDefinitions}}
|
||||
# Security Definitions
|
||||
{{> security}}
|
||||
{{/if}}
|
||||
|
||||
<details>
|
||||
<summary><b>Table Of Contents</b></summary>
|
||||
[toc]
|
||||
</details>
|
||||
|
||||
# APIs
|
||||
|
||||
{{#each paths}}
|
||||
## {{@key}}
|
||||
{{#this}}
|
||||
{{#get}}
|
||||
### GET
|
||||
{{> operation}}
|
||||
{{/get}}
|
||||
|
||||
{{#put}}
|
||||
### PUT
|
||||
{{> operation}}
|
||||
{{/put}}
|
||||
|
||||
{{#post}}
|
||||
### POST
|
||||
|
||||
{{> operation}}
|
||||
|
||||
{{/post}}
|
||||
|
||||
{{#delete}}
|
||||
### DELETE
|
||||
{{> operation}}
|
||||
{{/delete}}
|
||||
|
||||
{{#option}}
|
||||
### OPTION
|
||||
{{> operation}}
|
||||
{{/option}}
|
||||
|
||||
{{#patch}}
|
||||
### PATCH
|
||||
{{> operation}}
|
||||
{{/patch}}
|
||||
|
||||
{{#head}}
|
||||
### HEAD
|
||||
{{> operation}}
|
||||
{{/head}}
|
||||
|
||||
{{/this}}
|
||||
{{/each}}
|
||||
|
||||
# Definitions
|
||||
{{#each definitions}}
|
||||
## <a name="/definitions/{{key}}">{{@key}}</a>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>name</th>
|
||||
<th>type</th>
|
||||
<th>required</th>
|
||||
<th>description</th>
|
||||
<th>example</th>
|
||||
</tr>
|
||||
{{#each this.properties}}
|
||||
<tr>
|
||||
<td>{{@key}}</td>
|
||||
<td>
|
||||
{{#ifeq type "array"}}
|
||||
{{#items.$ref}}
|
||||
{{type}}[<a href="{{items.$ref}}">{{basename items.$ref}}</a>]
|
||||
{{/items.$ref}}
|
||||
{{^items.$ref}}{{type}}[{{items.type}}]{{/items.$ref}}
|
||||
{{else}}
|
||||
{{#$ref}}<a href="{{$ref}}">{{basename $ref}}</a>{{/$ref}}
|
||||
{{^$ref}}{{type}}{{#format}} ({{format}}){{/format}}{{/$ref}}
|
||||
{{/ifeq}}
|
||||
</td>
|
||||
<td>{{#required}}required{{/required}}{{^required}}optional{{/required}}</td>
|
||||
<td>{{#description}}{{{description}}}{{/description}}{{^description}}-{{/description}}</td>
|
||||
<td>{{example}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</table>
|
||||
{{/each}}
|
||||
71
http-service/src/main/templates/operation.hbs
Normal file
71
http-service/src/main/templates/operation.hbs
Normal file
@@ -0,0 +1,71 @@
|
||||
{{#deprecated}}-deprecated-{{/deprecated}}
|
||||
<a id="{{operationId}}">{{summary}}</a>
|
||||
|
||||
{{description}}
|
||||
|
||||
{{#if externalDocs.url}}{{externalDocs.description}}. [See external documents for more details]({{externalDocs.url}})
|
||||
{{/if}}
|
||||
|
||||
{{#if security}}
|
||||
#### Security
|
||||
{{/if}}
|
||||
|
||||
{{#security}}
|
||||
{{#each this}}
|
||||
* {{@key}}
|
||||
{{#this}} * {{this}}
|
||||
{{/this}}
|
||||
{{/each}}
|
||||
{{/security}}
|
||||
|
||||
#### Request
|
||||
|
||||
{{#if consumes}}__Content-Type:__ {{join consumes ", "}}{{/if}}
|
||||
|
||||
##### Parameters
|
||||
{{#if parameters}}
|
||||
<table>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Located in</th>
|
||||
<th>Required</th>
|
||||
<th>Description</th>
|
||||
<th>Default</th>
|
||||
<th>Schema</th>
|
||||
</tr>
|
||||
{{/if}}
|
||||
|
||||
{{#parameters}}
|
||||
<tr>
|
||||
<th>{{name}}</th>
|
||||
<td>{{in}}</td>
|
||||
<td>{{#if required}}yes{{else}}no{{/if}}</td>
|
||||
<td>{{description}}{{#if pattern}} (**Pattern**: `{{pattern}}`){{/if}}</td>
|
||||
<td> - </td>
|
||||
{{#ifeq in "body"}}
|
||||
<td>
|
||||
{{#ifeq schema.type "array"}}Array[<a href="{{schema.items.$ref}}">{{basename schema.items.$ref}}</a>]{{/ifeq}}
|
||||
{{#schema.$ref}}<a href="{{schema.$ref}}">{{basename schema.$ref}}</a> {{/schema.$ref}}
|
||||
</td>
|
||||
{{else}}
|
||||
{{#ifeq type "array"}}
|
||||
<td>Array[{{items.type}}] ({{collectionFormat}})</td>
|
||||
{{else}}
|
||||
<td>{{type}} {{#format}}({{format}}){{/format}}</td>
|
||||
{{/ifeq}}
|
||||
{{/ifeq}}
|
||||
</tr>
|
||||
{{/parameters}}
|
||||
{{#if parameters}}
|
||||
</table>
|
||||
{{/if}}
|
||||
|
||||
|
||||
#### Response
|
||||
|
||||
{{#if produces}}__Content-Type:__ {{join produces ", "}}{{/if}}
|
||||
|
||||
| Status Code | Reason | Response Model |
|
||||
|-------------|-------------|----------------|
|
||||
{{#each responses}}| {{@key}} | {{description}} | {{#schema.$ref}}<a href="{{schema.$ref}}">{{basename schema.$ref}}</a>{{/schema.$ref}}{{#ifeq schema.type "array"}}Array[<a href="{{schema.items.$ref}}">{{basename schema.items.$ref}}</a>]{{/ifeq}}{{^schema}} - {{/schema}}|
|
||||
{{/each}}
|
||||
88
http-service/src/main/templates/security.hbs
Normal file
88
http-service/src/main/templates/security.hbs
Normal file
@@ -0,0 +1,88 @@
|
||||
{{#each securityDefinitions}}
|
||||
### {{@key}}
|
||||
{{#this}}
|
||||
{{#ifeq type "oauth2"}}
|
||||
<table>
|
||||
<tr>
|
||||
<th>type</th>
|
||||
<th colspan="2">{{type}}</th>
|
||||
</tr>
|
||||
{{#if description}}
|
||||
<tr>
|
||||
<th>description</th>
|
||||
<th colspan="2">{{description}}</th>
|
||||
</tr>
|
||||
{{/if}}
|
||||
{{#if authorizationUrl}}
|
||||
<tr>
|
||||
<th>authorizationUrl</th>
|
||||
<th colspan="2">{{authorizationUrl}}</th>
|
||||
</tr>
|
||||
{{/if}}
|
||||
{{#if flow}}
|
||||
<tr>
|
||||
<th>flow</th>
|
||||
<th colspan="2">{{flow}}</th>
|
||||
</tr>
|
||||
{{/if}}
|
||||
{{#if tokenUrl}}
|
||||
<tr>
|
||||
<th>tokenUrl</th>
|
||||
<th colspan="2">{{tokenUrl}}</th>
|
||||
</tr>
|
||||
{{/if}}
|
||||
{{#if scopes}}
|
||||
<tr>
|
||||
<td rowspan="3">scopes</td>
|
||||
{{#each scopes}}
|
||||
<td>{{@key}}</td>
|
||||
<td>{{this}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
{{/each}}
|
||||
</tr>
|
||||
{{/if}}
|
||||
</table>
|
||||
{{/ifeq}}
|
||||
{{#ifeq type "apiKey"}}
|
||||
<table>
|
||||
<tr>
|
||||
<th>type</th>
|
||||
<th colspan="2">{{type}}</th>
|
||||
</tr>
|
||||
{{#if description}}
|
||||
<tr>
|
||||
<th>description</th>
|
||||
<th colspan="2">{{description}}</th>
|
||||
</tr>
|
||||
{{/if}}
|
||||
{{#if name}}
|
||||
<tr>
|
||||
<th>name</th>
|
||||
<th colspan="2">{{name}}</th>
|
||||
</tr>
|
||||
{{/if}}
|
||||
{{#if in}}
|
||||
<tr>
|
||||
<th>in</th>
|
||||
<th colspan="2">{{in}}</th>
|
||||
</tr>
|
||||
{{/if}}
|
||||
</table>
|
||||
{{/ifeq}}
|
||||
{{#ifeq type "basic"}}
|
||||
<table>
|
||||
<tr>
|
||||
<th>type</th>
|
||||
<th colspan="2">{{type}}</th>
|
||||
</tr>
|
||||
{{#if description}}
|
||||
<tr>
|
||||
<th>description</th>
|
||||
<th colspan="2">{{description}}</th>
|
||||
</tr>
|
||||
{{/if}}
|
||||
</table>
|
||||
{{/ifeq}}
|
||||
{{/this}}
|
||||
{{/each}}
|
||||
49
http-service/src/main/templates/template.html.hbs
Normal file
49
http-service/src/main/templates/template.html.hbs
Normal file
@@ -0,0 +1,49 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!-- Required meta tags -->
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
|
||||
<!-- CSS -->
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/3.0.1/github-markdown.min.css"/>
|
||||
<style>
|
||||
.markdown-body {
|
||||
box-sizing: border-box;
|
||||
min-width: 200px;
|
||||
max-width: 980px;
|
||||
margin: 0 auto;
|
||||
padding: 45px;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.markdown-body {
|
||||
padding: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
.markdown-body table {
|
||||
display: table;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- JS -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.0/showdown.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/gh/JanLoebel/showdown-toc/src/showdown-toc.js"></script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
var markdown = document.querySelector('noscript').innerText
|
||||
var converter = new showdown.Converter({emoji: true, extensions: ['toc']})
|
||||
converter.setFlavor('github')
|
||||
var html = converter.makeHtml(markdown)
|
||||
|
||||
document.body.innerHTML = html
|
||||
})
|
||||
</script>
|
||||
|
||||
<title>{{info.title}} {{info.version}}</title>
|
||||
</head>
|
||||
<body class="markdown-body">
|
||||
<noscript>{{>markdown}}</noscript>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user