Skip to content

Derive access level of generate CodingKeys from @Codable model #49

Description

@andriyslyusar

Right now @Codable macro will generate CodingKeys with internal access level.

@Codable
@CodingKeys(.PascalCase)
public struct MessageReceiver {
    public let userId: UUID
    public let status: OData.Enum<Int>
}

extension MessageThread.Response.MessageReceiver {
    enum CodingKeys: String, CodingKey {
        case userId = "UserId"
        case status = "Status"
    }
}

It would great to generate CodingKeys with the same access level (public) as MessageReceiver. This would allow access to CodingKeys in multi package application. As of my particular use case I would like to build OData requests using CodingKeys instead of String from the domain layer of application.

Really appreciate effort in open sourcing the project, unfortunately internal macros plugin implementation is quite complicated to be able to make a quick PR with solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions