mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	feat(docs): implement swagger ui endpoint for internal api (#6719)
This commit is contained in:
		
							
								
								
									
										4667
									
								
								apps/server/src/assets/api-openapi.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4667
									
								
								apps/server/src/assets/api-openapi.yaml
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -8,7 +8,9 @@ import { RESOURCE_DIR } from "../services/resource_dir";
 | 
			
		||||
 | 
			
		||||
export default function register(app: Application) {
 | 
			
		||||
    const etapiDocument = yaml.load(readFileSync(join(RESOURCE_DIR, "etapi.openapi.yaml"), "utf8")) as JsonObject;
 | 
			
		||||
    const apiDocument = JSON.parse(readFileSync(join(RESOURCE_DIR, "openapi.json"), "utf-8"));
 | 
			
		||||
    
 | 
			
		||||
    // Load the comprehensive API documentation from YAML
 | 
			
		||||
    const apiDocument = yaml.load(readFileSync(join(RESOURCE_DIR, "api-openapi.yaml"), "utf8")) as JsonObject;
 | 
			
		||||
 | 
			
		||||
    app.use(
 | 
			
		||||
        "/etapi/docs/",
 | 
			
		||||
@@ -24,7 +26,8 @@ export default function register(app: Application) {
 | 
			
		||||
        swaggerUi.serveFiles(apiDocument),
 | 
			
		||||
        swaggerUi.setup(apiDocument, {
 | 
			
		||||
            explorer: true,
 | 
			
		||||
            customSiteTitle: "TriliumNext Internal API Documentation"
 | 
			
		||||
            customSiteTitle: "TriliumNext Internal API Documentation",
 | 
			
		||||
            customCss: '.swagger-ui .topbar { display: none }'
 | 
			
		||||
        })
 | 
			
		||||
    );
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user