-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate @frozen enums for operation outputs and request/response bodies #109
Conversation
Signed-off-by: Si Beaumont <[email protected]>
Signed-off-by: Si Beaumont <[email protected]>
Signed-off-by: Si Beaumont <[email protected]>
Signed-off-by: Si Beaumont <[email protected]>
I'm going to move this to draft and mark as blocked for now because there's some more discussion that maybe this is the wrong direction to be moving in for the generated code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm on the implementation, but as you say, this is still being discussed elsewhere.
@swift-server-bot test this please |
Updated from semver/minor to semver/patch, as this isn't a breaking change. |
Motivation
The generated code contains several enum types. A lot of these are just namespaces (i.e. the enum has no cases), but some are "proper" enums that we expect adopters to switch over. For example the operation output, and the request and response bodies.
To make using these types more ergonomic, we can annotate them as
@frozen
. This is something we already do for other generated enum types (e.g. OneOf and enum types declared in the OpenAPI document).Modifications
@frozen
attributes to reference code@frozen
enum for request bodies@frozen
enum for response bodies@frozen
enum for operation outputsResult
Switching over operation outputs and request/response bodies is simpler.
Resolves
Test Plan
Reference test updated.