Skip to content

Conversation

@javagl
Copy link
Contributor

@javagl javagl commented Dec 2, 2025

A draft of what auto-generated TypeScript "structure" classes for glTF could look like.
(Not necessarily supposed to be merged - let's see...)

This was largely generated with wetzel, based on CesiumGS/wetzel#87, with minor tweaks and cleanups of the result.

Sparked by #194 (review)

@weegeekps
Copy link

Intriguing. It would be nice if it included extensions, or a way for us to define extensions ourselves, that could then be used by these interfaces.

@javagl
Copy link
Contributor Author

javagl commented Dec 2, 2025

The infrastructure should largely be prepared for that. The wetzel version has been extended accordingly, and it should mainly be a matter of adding the desired extension schema files as "top-level inputs". There are many extensions, though, and I'd have to check whether they all use the same JSON schema version, or have other caveats.

It might require some minor tweaks and hacks in any case. For example, the glTF extension definitions refer to glTFRootProperty.schema.json with an invalid $ref path, "as-if" they could be found in the same directory. But I'd say that "everything goes" here: Just copying ~"everything" into one directory to get that running is OK from my perspective. Yeah, it's very pragmatic, and "more powerful wetzel magic" could be nicer, but generating these files should be a one-shot operation (as they require minor manual cleanups) anyhow.

And an aside that may be important: I mainly wanted to try out that wetzel branch for this. Quick websearches reveal https://github.com/bcherny/json-schema-to-typescript and others, which might be "better" in a bazillion ways. But... I'd assume that they'd also choke on these ~"invalid $refs" and such.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants