mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	feat(docs): remove old json api docs
This commit is contained in:
		
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -3,22 +3,14 @@ import swaggerUi from "swagger-ui-express";
 | 
				
			|||||||
import { join } from "path";
 | 
					import { join } from "path";
 | 
				
			||||||
import yaml from "js-yaml";
 | 
					import yaml from "js-yaml";
 | 
				
			||||||
import type { JsonObject } from "swagger-ui-express";
 | 
					import type { JsonObject } from "swagger-ui-express";
 | 
				
			||||||
import { readFileSync, existsSync } from "fs";
 | 
					import { readFileSync } from "fs";
 | 
				
			||||||
import { RESOURCE_DIR } from "../services/resource_dir";
 | 
					import { RESOURCE_DIR } from "../services/resource_dir";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default function register(app: Application) {
 | 
					export default function register(app: Application) {
 | 
				
			||||||
    const etapiDocument = yaml.load(readFileSync(join(RESOURCE_DIR, "etapi.openapi.yaml"), "utf8")) as JsonObject;
 | 
					    const etapiDocument = yaml.load(readFileSync(join(RESOURCE_DIR, "etapi.openapi.yaml"), "utf8")) as JsonObject;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    // Load the comprehensive API documentation (YAML) if available, otherwise fall back to JSON
 | 
					    // Load the comprehensive API documentation from YAML
 | 
				
			||||||
    const apiYamlPath = join(RESOURCE_DIR, "api-openapi.yaml");
 | 
					    const apiDocument = yaml.load(readFileSync(join(RESOURCE_DIR, "api-openapi.yaml"), "utf8")) as JsonObject;
 | 
				
			||||||
    const apiJsonPath = join(RESOURCE_DIR, "openapi.json");
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    let apiDocument: JsonObject;
 | 
					 | 
				
			||||||
    if (existsSync(apiYamlPath)) {
 | 
					 | 
				
			||||||
        apiDocument = yaml.load(readFileSync(apiYamlPath, "utf8")) as JsonObject;
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
        apiDocument = JSON.parse(readFileSync(apiJsonPath, "utf-8"));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    app.use(
 | 
					    app.use(
 | 
				
			||||||
        "/etapi/docs/",
 | 
					        "/etapi/docs/",
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user