apple / apple/swift-openapi-generator

Create a different OpenAPI Handler for each "tag"

Open
#691 10 comments 0 reactions 0 assignees View on GitHub
kind/feature status/triage
Dominant language
Swift
Stars
2k
Forks
182
Avg merge
13h 28m
Merged PRs (30d)
5

Description

### Motivation

The generator currently only creates one big OpenAPI Handler protocol.
This makes it hard to organize the routes.

### Proposed solution

Create a different OpenAPI Handler for each "tag" so we have something close to Vapor "controllers".
These are quite useful for decluttering the code.

The generator _could_ also generate each tag's "controller protocol" in it's own file. There are known issues in the Swift compiler where it struggles to handle one big file, or makes builds potentially extremely slower.

### Alternatives considered

Manually handling this by different methods, including manually creating controllers and redirecting the routes in the main openapi handler to those controllers, or using multiple targets and filtering a shared openapi file based on tag in each controller.

### Additional information

_No response_

Contributor guide

Open the contributing guide

Research direction

The issue does not name specific files, tests, or generator entry points. Start by tracing how the current single OpenAPI Handler is generated and how tags are represented, then determine the expected per-tag protocols and file layout before defining completion checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
api, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.