Skip to content

Mark operation output and request/response body enums as @frozen  #105

@PadraigK

Description

@PadraigK

Since it's not expected that the generated code should support library evolution, we could add @Frozen to all of the generated enums. This would greatly improve the ergonomics of switching over enums in the generated code.

Borrowing an example from another issue:

switch result {
case let .ok(reponse):
    case let .json(payload):
        print(payload.body, payload.headers)
    @unknown default:
        break
    }
@unknown default:
    break
} 

would become

switch result {
case let .ok(reponse):
    case let .json(payload):
        print(payload.body, payload.headers)
    }
} 

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/generatorAffects: plugin, CLI, config file.kind/enhancementImprovements to existing feature.size/SSmall task. (A couple of hours of work.)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions