This repository contains OpenAPI specifications and JSON schema definitions for the Terra API, built using TypeSpec.
data_models/
- TypeSpec source files and build configurationspecs/
- TypeSpec data model definitionstsp-output/
- Generated schemas and OpenAPI specs
schemas/
- Promoted JSON schemas (ready for use)v5.yaml
- Main OpenAPI v5 specificationv6.yaml
- OpenAPI v6 specificationv5-bundled.yaml
- Bundled version of v5 spec
Install dependencies:
cd data_models
npm install
Generate JSON schemas from TypeSpec definitions:
cd data_models
tsp compile . --emit=@typespec/json-schema
./promote.sh
This process:
- Compiles TypeSpec files to JSON schemas
- Promotes generated schemas to the root
schemas/
directory
Bundle the OpenAPI specification:
redocly bundle v5.yaml -o v5-bundled.yaml
Run linting and formatting:
cd data_models
npm run lint # Check for linting issues
npm run lint:fix # Auto-fix linting issues
npm run format # Format code with Prettier
npm run test # Run tests
The schemas are automatically validated during the build process. All generated schemas follow JSON Schema standards and are compatible with OpenAPI 3.1.0.
This repository includes automated workflows for:
- Schema Generation: Automatically builds and validates schemas on pull requests
- Release: Creates bundled releases when changes are merged to master
The generated schemas can be used for:
- API validation and documentation
- Code generation in various languages
- Integration testing
- Client SDK development
- Make changes to TypeSpec files in
data_models/specs/
- Run the build process to generate updated schemas
- Test your changes with
npm test
- Ensure code quality with
npm run lint
andnpm run format