Swagger to Vapor 3 Code Generator

Hi, If you would like to ease API development and like to use Swagger, I have created a swagger-codegen language plugin called SwiftVapor3 located here: GitHub - thecheatah/vapor-server-codegen: Generates a Vapor server interface given a OpenAPI or Swagger spec. Can be used to quickly start a new API project.

This project will intake a swagger spec and produce a swift package that your vapor project can create a dependency on. The built project will have a routes.swift with a function configure a router to conform to the swagger's API specifications, APIs directory with swift protocols that need to be implemented in your project and a Models directory with models from the swagger.

The project includes test projects with tests that validate the codegen's behavior. The test projects can also be used to learn how to consume the generated package.

9 Likes