Skip to content

cse-labs/typespec-workflow-samples

Repository files navigation

TypeSpec Workflow Samples

This repository provides samples for using Microsoft TypeSpec with GitHub Actions, Workflows, Pipelines, and CI/CD to accelerate adoption of TypeSpec in GitHub. TypeSpec is a tool for generating OpenAPI.json specifications from the CADL format.

Getting Started

Directory structure

Workflows

API Contract Verification

It provides a sample workflow that checks an API implementation (in this case ASP.NET core) against the API spec in the design folder. If there are any breaking changes the workflow will fail. It also stores the differences between the implementation and the design in GitHub artifacts. To check the breaking changes uses Oasdiff.

The way it retrieves the generated API implementation is by starting the API server and retrieving the swagger.json generated by Swashbuckle. Other alternatives would be to generate the OpenApi spec using Nswag either with the same approach (starting the webserver) or with a commandline util (like the AspNetCoreToOpenApi command).

API OpenApi Update

It provides a sample workflow about how to compile and push the generated openapi.json spec. A useful scenario for this workflow is when we are serving static api specs in the API implementation, or when we want to trigger other utilities to generate SDKs, publish specs, etc.

Contributing

Contributions are welcome! Please see our Contributing Guidelines for more information.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

TypeSpec Workflow Samples

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages