Repository navigation
Conversation
mackoj
marked this pull request as ready for review
October 8, 2026 07:24
czechboy0
self-requested a review
October 8, 2026 17:02
czechboy0
requested changes
Oct 12, 2026
- Rename the `match` key of rules to `filter`. - Omitting `filter` matches everything. - Add the `operations[].operation` target for the `Operations.<Op>` namespace.
mackoj
force-pushed
the
soar-0016-proposal
branch
from
October 14, 2026 23:21
56c6f2c to
321a66d
Compare
czechboy0
self-requested a review
October 15, 2026 07:17
czechboy0
self-requested a review
October 15, 2026 12:26
Contributor
czechboy0
reviewed
Oct 15, 2026
czechboy0
left a comment
Contributor
There was a problem hiding this comment.
Dismissing my review until the review concludes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
There's no way to put a macro on a generated declaration today, because generated code is rewritten on every build. Adopters either post-process the output or fork the generator.
Use cases from #383 include protocol conformances on every operation output, Combine variants of client methods, mocks generated from
APIProtocol(e.g. Mockable), and@DependencyClientwrappers from swift-dependencies.As discussed in #383, this proposal comes before the implementation.
Modifications
SOAR-0016.md, proposing anattachedMacrosconfiguration key.Proposals.md.The proposal follows the design agreed in #383:
components(schemas,parameters,requestBodies,responses,headers),operations(input,output,clientMethod),apiProtocol,client, andserver.servertargetsregisterHandlers.@.labelandvalueentries, wherevalueis Swift source emitted verbatim.One change from the thread: rules are a list (
- match: "^Pet$") instead of a mapping keyed by regex. Decoding a YAML mapping doesn't preserve key order, so the order of macros on a declaration wouldn't be deterministic otherwise. @czechboy0, happy to discuss.Result
Once implemented, adopters can attach macros to generated declarations from the config file, for example:
Without the key, the generated code is unchanged.
Test Plan
This PR only adds the proposal. A follow-up PR will add the implementation, with reference tests for each target.