You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Although I was thinking more along the lines of having all the operationId string values being consolidated in an enum, not necessarily the operations themselves. My use case would be for permissions checking:
// Given a state where operationId is enum based
// Somewhere generated:
enumOperationId:String,RawRepresentable,Codable,Sendable,CaseIterable{
case .userCreate = Operations.UserCreate.idcase.userUpdate=Operations.UserUpdate.idcase.userDelete=Operations.UserDelete.id}staticletrestrictedRoutes:[OperationId]{[.userDelete]}
Then in middleware, server, even a SwiftUI project you could check it a little easier. It's possible now through manually entering the raw values into [String] for restrictedRoutes (which I think I'm gonna end up doing) but either what you had written before or something like this feels like it'd be a bit more fun to use.
EDIT: my apologies I think this isn't necessarily the right issue for what I was thinking of.
I appreciate the new issue. I'm still down for the above in some form. Do you have ideas on where the OperationId enum would live or a different view of the types written above?
it seems like a bit of a pattern change, rather since the current Operations.OperationName.id is the reference string type atm. It'd shift it to the OperationId enum.
If could be opt-in to generate in addition to the outputted types.
Or since this is a generator, if you're OK with having duplicates. I assume there's overhead that's not negligible doing duplicates though.
Activity
mheh commentedon Sep 28, 2026
I appreciate the new issue. I'm still down for the above in some form. Do you have ideas on where the OperationId enum would live or a different view of the types written above?
czechboy0 commentedon Sep 28, 2026
My initial instinct is a top-level
OperationIDsenum. But I haven't given it much thought yet. Open to other ideas.mheh commentedon Sep 29, 2026
Considering:
isn't possible due
Raw value for enum case must be a literalerror. How do you feel about the inverse?it seems like a bit of a pattern change, rather since the current Operations.OperationName.id is the reference string type atm. It'd shift it to the OperationId enum.
If could be opt-in to generate in addition to the outputted types.
Or since this is a generator, if you're OK with having duplicates. I assume there's overhead that's not negligible doing duplicates though.
czechboy0 commentedon Sep 29, 2026
I'm not concerned about the duplication, but I like the id property simply referencing the value from the new enum.