# heydarideveloper/swagger-typescript architecture

> Architecture diagram of the GitHub repository heydarideveloper/swagger-typescript, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/heydarideveloper/swagger-typescript
- Repository: https://github.com/heydarideveloper/swagger-typescript

## Overview

- How the Swagger JSON flows through the system
- Configuration input paths
- Output file generation paths

- Related components
- Optional feature relationships

##### Detailed Component Breakdown

Core Generator (Central component):
- src/
- generateApis.ts
- generateConstants.ts
- generateTypes.ts
- generator.ts

Mock System (Optional component):
- src/mock/
- compose.ts
- dataType.ts
- parse.ts
- response.ts

SignalR Support (Optional component):
- src/signalR/
- generator.ts

##### Specific elements

a. Configuration Flow:
- How swagger.config.json influences the generation process
- Where prettier configuration is applied
- How language selection (TypeScript/JavaScript) affects output

b. Processing Pipeline:
- Swagger/OpenAPI parsing
- Type generation
- API method generation
- Mock data generation (if enabled)
- Code formatting

c. Output Structure:
- Generated API methods
- Type definitions
- Configuration files
- Mock data files

##### Notes for Implementation
- Keep the main generation pipeline central
- Related components (e.g., mock generation system)
- Optional features
- Configuration points
- Error handling paths

Remember to maintain a balance between showing the high-level architecture and including important implementation details that affect the system's behavior, such as the methodName configuration and prefix handling.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        SW[Swagger/OpenAPI JSON]
        CF["swagger.config.json"]:::config
        PC[".prettierrc"]:::config
    end

    subgraph "Core Processing"
        JP["JSON Parser"]:::core
        CG["Core Generator"]:::core
        TG["Type Generator"]:::core
        AG["API Generator"]:::core
        CSG["Constants Generator"]:::core
    end

    subgraph "Optional Features"
        subgraph "Mock Generation"
            MC["Mock Composer"]:::optional
            MD["Mock Data Types"]:::optional
            MP["Mock Parser"]:::optional
            MR["Mock Response"]:::optional
        end
        
        SG["SignalR Generator"]:::optional
    end

    subgraph "Utilities"
        OC["OpenAPI Converter"]:::util
        GU["General Utilities"]:::util
        TD["Type Definitions"]:::util
        SC["String Constants"]:::util
    end

    subgraph "Templates"
        CT["Configuration Template"]:::template
        HT["HTTP Request Template"]:::template
    end

    subgraph Output
        GTF["Generated TypeScript Files"]
        GCF["Generated Config Files"]
        GMD["Generated Mock Data"]
    end

    SW --> JP
    CF --> CG
    PC --> CG
    JP --> CG
    CG --> TG
    CG --> AG
    CG --> CSG
    
    TG --> GTF
    AG --> GTF
    CSG --> GTF
    
    CG --> MC
    MC --> GMD
    MD --> MC
    MP --> MC
    MR --> MC
    
    CG --> SG
    SG --> GTF
    
    OC --> JP
    GU --> CG
    TD --> CG
    SC --> CG
    
    CT --> AG
    HT --> AG
    
    classDef core fill:#90EE90,stroke:#333,stroke-width:2px
    classDef optional fill:#D3D3D3,stroke:#333,stroke-width:2px
    classDef util fill:#ADD8E6,stroke:#333,stroke-width:2px
    classDef template fill:#FFE4B5,stroke:#333,stroke-width:2px
    classDef config fill:#FFA07A,stroke:#333,stroke-width:2px

    click CF "https://github.com/heydarideveloper/swagger-typescript/blob/master/swagger.config.json"
    click PC "https://github.com/heydarideveloper/swagger-typescript/blob/master/.prettierrc"
    click JP "https://github.com/heydarideveloper/swagger-typescript/blob/master/src/getJson.ts"
    click CG "https://github.com/heydarideveloper/swagger-typescript/blob/master/src/generator.ts"
    click TG "https://github.com/heydarideveloper/swagger-typescript/blob/master/src/generateTypes.ts"
    click AG "https://github.com/heydarideveloper/swagger-typescript/blob/master/src/generateApis.ts"
    click CSG "https://github.com/heydarideveloper/swagger-typescript/blob/master/src/generateConstants.ts"
    click MC "https://github.com/heydarideveloper/swagger-typescript/blob/master/src/mock/compose.ts"
    click MD "https://github.com/heydarideveloper/swagger-typescript/blob/master/src/mock/dataType.ts"
    click MP "https://github.com/heydarideveloper/swagger-typescript/blob/master/src/mock/parse.ts"
    click MR "https://github.com/heydarideveloper/swagger-typescript/blob/master/src/mock/response.ts"
    click SG "https://github.com/heydarideveloper/swagger-typescript/blob/master/src/signalR/generator.ts"
    click OC "https://github.com/heydarideveloper/swagger-typescript/blob/master/src/utilities/swaggerToOpenApi.ts"
    click GU "https://github.com/heydarideveloper/swagger-typescript/blob/master/src/utils.ts"
    click TD "https://github.com/heydarideveloper/swagger-typescript/blob/master/src/types.ts"
    click SC "https://github.com/heydarideveloper/swagger-typescript/blob/master/src/strings.ts"
    click CT "https://github.com/heydarideveloper/swagger-typescript/blob/master/files/config.tsf"
    click HT "https://github.com/heydarideveloper/swagger-typescript/blob/master/files/httpRequest.tsf"

    subgraph Legend
        L1[Core Components]:::core
        L2[Optional Features]:::optional
        L3[Utilities]:::util
        L4[Templates]:::template
        L5[Config Files]:::config
    end
```
