lbovet / typson

Converts TypeScript to JSON-schema

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support modules

Bartvds opened this issue · comments

I have most code in modules (like a namespace)

module git {
    export interface TreeElem {
        sha:string;
        path:string;
        // ..
    }
}

// other file
var elem:git.TreeElem  = ....

I believe TypeScript does it too.

module TypeScript {
    export class LanguageWidget {
        // ..
    }
}

// other file
var instance = new TypeScript.LanguageWidget();

I would like to export these somehow. They can even be levels deeper nested (like packages in Java or AS3), sometimes they are used with export keyword.

// Export simply as dot seperated name (like in the code)?
{
   "$ref" = "#/definitions/TypeScript.LanguageWidget"
}
// Or maybe forward slashes (unsafe maybe)?
{
   "$ref" = "#/definitions/TypeScript/LanguageWidget"
}

Nice, looks very promising.

I see a few issues: I left a disabled unit test with my PR #12

If you enable it and run grunt you'll see the id's are not absolute, this could create collisions if you'd have difference modules with same members.

Core types should be simplified I guess (number).

I fixed both issues, all tests are uncommented (included the class-single one, to support class declarations). We've had a productive week-end!