Skip to content

Consider FlagsEnum for types like JobsListRequestExpand #26

@robfe

Description

@robfe

The idiomatic way to represent an enum where multiple values can be selected at once would be with the FlagsEnum attribute, as documented at https://learn.microsoft.com/en-us/dotnet/fundamentals/runtime-libraries/system-flagsattribute

This would simplify something like https://github.com/merge-api/merge-csharp-client/blob/main/src/Merge.Client/Ats/Jobs/Types/JobsListRequestExpand.cs to just

[JsonConverter(typeof(StringEnumFlagsSerializer<JobsListRequestExpand>))]
[FlagsEnum]
public enum JobsListRequestExpand
{
    Departments,
    HiringManagers,
    JobPostings,
    Recruiters,
    Offices,
}

Of course, you'd have to write StringEnumFlagsSerializer yourself as it's not built in. I'd be happy to help if it's a direction you want to take the library!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions