GithubProxyMonorepo is a modular Swift library designed to interact with various aspects of GitHub's API. Each module is tightly coupled to its respective OpenAPI specification and provides a clean, type-safe interface for managing workflows, branches, commits, issues, labels, milestones, and repository configuration.
This project leverages the Swift OpenAPI Generator to produce server and type definitions directly from OpenAPI specifications.
- Modular Structure:
- Each module (e.g.,
Actions,Branches, etc.) focuses on a specific aspect of GitHub's API.
- Each module (e.g.,
- Type-Safe Code:
- Code is generated directly from OpenAPI specs to ensure compliance and reliability.
- Easily Testable:
- Includes unit tests for all modules to verify placeholder content and basic functionality.
Sources/:- Contains library modules for:
- Actions
- Branches
- Commits
- Issues
- Labels
- Milestones
- RepoCM
- Each module includes:
Server.swift: Handlers for API operations.Types.swift: Types and protocol definitions.*.yaml: The OpenAPI specification for the module.
- Contains library modules for:
Tests/:- Contains unit tests for each module.
- Swift 5.7 or later
- macOS 12.0 or later
Add the following line to the dependencies section of your Package.swift:
.package(url: "https://github.com/Contexter/GithubProxyMonorepo.git", from: "1.0.0")Then, add the desired modules to your targets:
.target(
name: "MyApp",
dependencies: [
.product(name: "Actions", package: "GithubProxyMonorepo"),
.product(name: "Branches", package: "GithubProxyMonorepo")
]
)-
Register API operation handlers in
Server.swift:let server = UniversalServer() let transport = ServerTransport<ServerRequest, ServerResponse>() server.registerHandlers(with: transport)
-
Implement custom logic in
Types.swiftby conforming toAPIProtocol.
Contributions are welcome! To contribute:
- Fork the repository.
- Create a feature branch:
git checkout -b feature/my-feature
- Commit your changes:
git commit -m "Add my feature" - Push your branch and create a pull request.
This project is licensed under the MIT License.