Kind: Service
Source: atloria-monorepo/apps/api-schema-parser/src/app.service.ts
AppService provides application-level metadata for the API schema parser service. It exposes a health summary for operational checks and a list of supported parser definitions for clients that need to discover available parsing capabilities.
Methods
| Method | Signature | Returns | Description |
|---|---|---|---|
getHealth | getHealth() | { status: string; parsers: string[]; version: string } | Get health status |
getSupportedParsers | getSupportedParsers() | `Array<{ |
name: string; version: string; patterns: string[];
}>` | Get list of supported parsers |
Diagram
mermaidsequenceDiagram participant Client participant Controller participant AppService Client->>Controller: GET /health Controller->>AppService: getHealth() AppService-->>Controller: status, parsers, version Controller-->>Client: Health response Client->>Controller: GET /parsers Controller->>AppService: getSupportedParsers() AppService-->>Controller: Parser metadata Controller-->>Client: Supported parsers response
Usage
tsimport { AppService } from './app.service';
const appService = new AppService();
const health = appService.getHealth();
console.log(health);
// {
// status: 'ok',
// parsers: ['...'],
// version: '...'
// }
const parsers = appService.getSupportedParsers();
for (const parser of parsers) {
console.log(`${parser.name}@${parser.version}`);
console.log(`Supported patterns: ${parser.patterns.join(', ')}`);
}
AI Coding Instructions
- Keep
getHealth()lightweight and deterministic; it should return status metadata without performing expensive parser initialization or external network calls. - Ensure parser names returned by
getHealth().parsersstay aligned with the parser definitions returned bygetSupportedParsers(). - When adding a parser, include its stable
name, semanticversion, and all supported file or schemapatterns. - Preserve the existing response shapes because health checks, controllers, and API consumers may depend on these fields.
- Add parser discovery changes through this service rather than duplicating parser metadata in controllers or route handlers.
Was this page helpful?