From b4a276d44f616360a83c18445a403fdc37ccdf1f Mon Sep 17 00:00:00 2001 From: Xiphoseer Date: Sun, 24 Oct 2021 14:42:12 +0200 Subject: [PATCH] Add skill_ids to openapi docs; improve error messages --- res/api.yaml | 51 +++++++++++++++++++++++++++++++++++++++------ src/template/mod.rs | 4 +++- 2 files changed, 48 insertions(+), 7 deletions(-) diff --git a/res/api.yaml b/res/api.yaml index b4944a8..8d1a7b7 100644 --- a/res/api.yaml +++ b/res/api.yaml @@ -46,17 +46,14 @@ components: TableDef: type: object properties: - name: - type: string + name: { type: string } columns: type: array items: type: object properties: - name: - type: string - data_type: - type: string + name: { type: string } + data_type: { type: string } LocaleNode: type: object properties: @@ -73,6 +70,33 @@ components: id: { type: number } MissionDrop: { type: boolean } sortPriority: { type: number } + MissionTasks: + type: object + additionalProprties: + type: object + properties: + id: { type: integer } + locStatus: { type: integer } + taskType: { type: integer } + target: { type: integer } + targetGroup: { type: string } + targetValue: { type: integer } + taskParam1: { type: string } + largeTaskIcon: { type: string } + IconID: { type: integer } + uid: { type: integer } + largeTaskIconID: { type: integer } + localize: { type: boolean } + gate_version: { type: string } + SkillRev: + type: object + properties: + mission_tasks: { $ref: "#/components/schemas/NumArray" } + objects: { $ref: "#/components/schemas/NumArray" } + item_sets: { $ref: "#/components/schemas/NumArray" } + _embedded: + type: object + MissionTasks: { $ref: "#/components/schemas/MissionTasks" } ErrorModel: type: number paths: @@ -185,6 +209,21 @@ paths: required: true name: id schema: { type: number } + "/v0/rev/skill_ids/{id}": + get: + tags: [rev] + description: Get data associated with an `SkillID` + responses: + "200": + description: The request was successfull + content: + application/json: + schema: { $ref: "#/components/schemas/SkillRev" } + parameters: + - in: path + required: true + name: id + schema: { type: number } "/v0/rev/behaviors/{id}": get: tags: [rev] diff --git a/src/template/mod.rs b/src/template/mod.rs index 758c938..8892e92 100644 --- a/src/template/mod.rs +++ b/src/template/mod.rs @@ -1,3 +1,4 @@ +use color_eyre::eyre::Context; use notify::event::{AccessKind, AccessMode, EventKind, RemoveKind}; use pin_project::pin_project; use std::{ @@ -111,7 +112,8 @@ pub fn load_meta_template( path: &Path, ) -> Result<(), color_eyre::Report> { info!("(re-)loading template.html"); - let index_text = std::fs::read_to_string(&path)?; + let index_text = std::fs::read_to_string(&path) + .with_context(|| format!("Failed to load '{}'", path.display()))?; let tpl_str = make_meta_template(&index_text); let mut hb = reg .write()