Overview

Glue is a unified toolchain for data models and interfaces.
It is an IDT (Interface Definition Tool) and tools built around it (code generation, IDE extensions, etc.) which allow for a single source of truth for the data and interfaces in your system.

How does it look?

// file: example_api.glue
endpoint "GET /users" -> User[] or Response

@endpoint("GET /users/{id}")
endpoint GetUserById {
    request: {
        id: int
    }

    headers: {
        "X-Request-ID": string
    }

    @response(mime="application/json")
    responses: {
        /// A successful response containing the user details.
        200: Response200
        /// Client error response.
        4XX: ResponseError
        /// Server error response.
        5XX: ResponseError
    }
}

model ResponseError {
    code?: string
    message: string
}

model User {
    id: int
    name: string
}

// file: example_nested_models.glue
// Example of defining models and nested IDTs.

/// This acts a documentation comment for the Building model which is used in code generation.
model Building {
    number: int
    residents: Person[]
    state: BuildingState?
    // Internal enum defined in the `Building` model.
    enum BuildingState: "OPEN" | "CLOSED" | "RENOVATION"
}

model Person {
    id: string | int
    age: int
    // Define an alias for the field `full_name` to be used in generated code.
    @alias("fullName")
    full_name: string
}