@bentley/ecschema2ts

Command line tools that takes an ECSchema xml file and outputs a typescript module

Usage no npm install needed!

<script type="module">
  import bentleyEcschema2ts from 'https://cdn.skypack.dev/@bentley/ecschema2ts';
</script>

README

# ecschema2ts

ecschema2ts is a command-line tool that takes an EC3.1/EC3.2 BIS ECSchema xml file and outputs a valid Typescript module that uses iTwin.js.

Quick Overview

npm install -g @itwin/ecschema2ts

ecschema2ts -i C:\Path\To\Schema\Domain.ecschema.xml -o C:\Desired\Output\Path\

Getting Started

Installation

Install globally:

npm install -g @itwin/ecschema2ts

Creating a Typescript module

To create a Typescript file from the an ECSchema, run:

ecschema2ts -i C:\Path\To\Schema\Domain.ecschema.xml -o C:\Desired\Output\Path\

Updating to new version

Since the package is installed globally, updating has a different syntax than normal. To update the package globally, run:

npm update -g @itwin/ecschema2ts

Known Issues

  • The ordering of the Typescript classes may be out of order preventing compilation of the typescript file. A workaround is to reorder the classes by hand.

Troubleshooting

  • Are you have issues converting your ECSchema?
    • Check to make sure your ECSchema version is EC3.1
    • Check if the BIS ECSchema passes validation, check ECSchema status.