Skip to content

Commit

Permalink
allow attributes on other members
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasteles committed Mar 28, 2023
1 parent 6005ab5 commit edf32ae
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/JsonConverters/Attributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ public JsonEnumStringAttribute() : base(typeof(JsonStringEnumConverter))
/// <summary>
/// Sets enum to use description for json serialization
/// </summary>
[AttributeUsage(AttributeTargets.Enum)]
[AttributeUsage(
AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct |
AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field)]
public sealed class JsonEnumDescriptionAttribute : JsonConverterAttribute
{
/// <inheritdoc />
Expand All @@ -30,7 +32,9 @@ public sealed class JsonEnumDescriptionAttribute : JsonConverterAttribute
/// <summary>
/// Sets enum to use enum member value for json serialization
/// </summary>
[AttributeUsage(AttributeTargets.Enum)]
[AttributeUsage(
AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct |
AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field)]
public sealed class JsonEnumMemberValueAttribute : JsonConverterAttribute
{
/// <inheritdoc />
Expand All @@ -42,7 +46,9 @@ public JsonEnumMemberValueAttribute() : base(typeof(JsonEnumMemberValueConverter
/// <summary>
/// Sets enum to use string numeric values, for json serialization
/// </summary>
[AttributeUsage(AttributeTargets.Enum)]
[AttributeUsage(
AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct |
AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field)]
public sealed class JsonEnumNumericAsStringAttribute : JsonConverterAttribute
{
/// <inheritdoc />
Expand All @@ -54,7 +60,9 @@ public JsonEnumNumericAsStringAttribute() : base(typeof(JsonEnumNumericAsStringC
/// <summary>
/// Sets enum to use numeric values for json serialization
/// </summary>
[AttributeUsage(AttributeTargets.Enum)]
[AttributeUsage(
AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct |
AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field)]
public sealed class JsonEnumNumericAttribute : JsonConverterAttribute
{
/// <inheritdoc />
Expand Down

0 comments on commit edf32ae

Please sign in to comment.