Skip to content

Latest commit

 

History

History

osch

The osch tool

The osch tool takes the schema definition and converts it to a defined target. It is a command line tool written in Go:

# cd olca-schema/osch

# build the tool, you need to have Go installed
go build

# prints the help of the tool
./osch help

# validates the schema definition
# prints warnings and errors, we are not perfect yet...
# ./osch check

Generating the schema documentation

The following command generates the mdBook sources from the schema definition in the build/docs folder:

./osch doc

With the mdbook command, the documentation can be then generated in the docs folder (relative to the book sources) via the following command:

mdbook build -d ../../docs ../build/docs

This folder is then served as our online documentation via Github pages: https://greendelta.github.io/olca-schema/

We also host the JSON-LD context and the schema in Turtle format via Github pages. These resources are generated with the rdf command which should be executed after the mdbook was generated (because it will clean the docs folder):

./osch rdf

Protocol Buffers

The proto command will generate a olca.proto file in the build folder:

./osch proto

The build contains then the Protocol Buffers schema. This schema is used in the olca-proto project and is used for data exchange with openLCA via Protocol Buffers and gRPC.

Python

The class defintions of the Python package can be generated via the py command:

./osch py

TypeScript

The ts command will generate type declarations and many utility methods for working with the schema in TypeScript. The olca-ipc.ts API is built around that generated schema. The script below will update this schema assuming the olca-ipc.ts project is located next to the olca-schema project and a current version of Deno is installed:

./osch ts -o "../../olca-ipc.ts/src/schema.ts"

# run the Deno formatter
cd ../../olca-ipc.ts
deno fmt