Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE]: xml2typescript using quicktype ( doxygen XLST into typescript definitions) #2630

Open
studentutu opened this issue Jul 7, 2024 · 0 comments

Comments

@studentutu
Copy link

XML is widely used for documentation for projects ( doxygen or other auto-documented solutions)
They all rely on the same XML schema with different member types, etc.

It would be beneficial to extend the functionality of typescript and add support for the generation of typescript definitions from XML directory ( main index.xml and referenced XML files).

The exact issue and proposal is described here: opencv/opencv#15306

Context (Input, Language)

Doxygen generates XML using the following XML/XSLT, example of generated XML see here https://github.com/studentutu/opencv-wasm-node/tree/master/utils/doxygen_generated_docs .

Input Format: doxygen XML (XSLT)
Output Language: typescript definitions

Description

When generating opencv_wasm with specific libraries, we build cpp sources using main cmake, which output target cpp javascript project, built by emscripten with a specified flag.

Currently, each time we rebuild opencv_wasm with different flags, there is no types for typescript generated, all we can do is to look into generated doxygen documentation.
We need a strong type for Opencv based on the build target and flags.
This will massively benefit OpenCV community and not only, as Doxygen is a very popular tool to generate docs for cpp\older and newer projects.

Current Behaviour / Output

There is an obsolete repo with npm from contributors of DefinitelyTyped for manual type definitions (types/opencvts).
But it is obsolete and not suitable for wasm configuration ( or any different configuration), as we need to rebuild opencv from cpp sources directly, which limits opencv_wasm API severely, which is expected and Doxygen provides all the generated API.
It is a global issue of missing types for opencv, but thankfully we can always build Doxygen docs.

Currently, we have an alternative - to just see which API available by using the Object.Keys - see here https://github.com/studentutu/opencv-wasm-node/blob/master/utils/generateCvProps.js
This however is almost useless, as we always need to pass arguments, which are unknown and we still need to look them up in Doxygen docs.

Proposed Behaviour / Output

Using quicktype we can generate folder of typescript definition from generated doxygen XML folder.
Doxygen XML folder contains all of the Doxygen XML schema, which is always consists of compound.xsd, index.xsd and index.xml which have links to all other components ( types).

Solution

Add support to reading Doxygen XML and generating typescript definition folder

Context

The exact issue and proposal is described here: opencv/opencv#15306

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

No branches or pull requests

1 participant