Using Honeybee-Schemas within Typescript?

Hi,

This may not be the right place to post this question, but I am wondering if someone might be able to provide some high-level guidance on how to use the Honeybee-Schema documentation within a new TypeScript application I am working on?

Currently, when fetching Honeybee model entities as json from my server, I am able to to sort them out in TypeScript by building up my own types. But I am wondering if I can use the existing OpenAPI schema to automatically setup these types for me somehow? That question is probably very silly, and shows exactly how much I understand about TypeScript :wink:

But, for instance, currently I have a ‘types’ folder in my application with a bunch of things like:

export type HoneybeeFace3D = {
    type: string,
    identifier: string,
    face_type: string,
    display_name: string,
    boundary_condition: HoneybeeBoundaryCondition,
    apertures: HoneybeeAperture[],
    . . . 
}

which I’ve just been building up myself as I go. But it strikes me that all this is already all sorted out in the HB-Schema docs - so maybe I don’t need to do it all again?

Is there some automatic method of building these TS types from the documentation? Or, alternatively, if I am also setting up the relevant Pydantic types as part of my FastAPI response model, can I use those to automatically setup the types in TS somehow?

I’m not sure if that’s the right way to ask that question, but trying to sort out how I should be working through something of this sort, and what the ‘normal’ method would be when working in TS with HB-entities?

any advice is appreciated as always!
thanks,
@edpmay

3 Likes