Skip to content

gitter-badger/Yardarm

 
 

Repository files navigation

Build

Yardarm

Yardarm is an OpenAPI 3 SDK Generator for C#. It provides various tools that will generate an SDK for a valid OpenAPI specification.

Features

  • Works with valid OpenAPI 3 specs, in JSON or YAML format
  • Many generation options
    • Command Line Application
    • Docker Image
    • In-code via library
    • .NET Core Global Tool
    • Support C# 9 Source Generators???
  • Generates a SDK using modern C# patterns and practices as follows:
    • Asynchronous methods with cancellation tokens
    • Nullable reference types
    • Interfaces with concrete implementations
      • Should support mocking the implementations for consumers to write unit tests
    • XML documentation for IntelliSense
    • Portable PDB
    • Dependency injection support via Microsoft.Extensions.DependencyInjection.Abstractions
  • Fast SDK generation
    • Doesn't make C# files on disk and run MSBuild
    • Uses Roslyn to compile directly in memory
  • Built-in NuGet support
    • Generate valid .nupkg files directly, with correct dependencies
    • Automatically restore packages required for compilation
  • Highly extensible SDK generation
    • Built around plugable extensions that add additional features or modify the C# code used for compilation
    • Will include some out-of-the-box plugins for common scenarios
      • Newtonsoft.Json serialization/deserialization
      • NodaTime date/time properties
  • Highly extensible SDK
    • Will allow the SDK consumer to extend the behaviors on the client side
    • Pluggable configuration for things like TLS and base urls
    • Add HttpMessageHandler instances to the HttpClient stack

Using Yardarm

.NET Core Global Tool

dotnet tool install --global Yardarm.CommandLine --version 0.1.0-alpha003

yardarm help generate

Docker

docker run -it centeredge/yardarm:release-0.1.0-alpha003

yardarm help generate

Example Command

# Generate a DLL and related files, with Newtonsoft.Json support
yardarm generate -i my-spec.yaml -n MySpec -v 1.0.0 -o MySpec.dll --xml MySpec.xml --pdb MySpec.pdb -x Yardarm.NewtonsoftJson.dll

# Generate a NuGet package and symbols package, with Newtonsoft.Json support
yardarm generate -i my-spec.json -n MySpec -v 1.0.0 -nupkg MySpec.nupkg --snupkg MySpec.snupkg -x Yardarm.NewtonsoftJson.dll

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the Apache 2.0 License - see the LICENSE.md file for details

About

OpenAPI 3 SDK Generator for C#

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 99.7%
  • Dockerfile 0.3%