Skip to content

Conversation

@HofmeisterAn
Copy link
Collaborator

According to the Docker Engine API documentation, an empty string is a valid value for the RestartPolicyKind enum: "", "no", "always", "unless-stopped", and "on-failure". The System.Test.Json library, version 9 or higher, throws an exception when this value is empty.

System.InvalidOperationException
Enum type 'RestartPolicyKind' uses unsupported identifier ''. It must not be null, empty, or containing leading or trailing whitespace. Flags enums must additionally not contain commas.

The PR adds a custom JSON converter to allow converting empty string values.

@HofmeisterAn HofmeisterAn changed the title fix: Support empty string enum serialization / deserialization fix: Support empty string enum serialization and deserialization Nov 30, 2024
@HofmeisterAn HofmeisterAn merged commit c8d5bd4 into main Nov 30, 2024
2 checks passed
@HofmeisterAn HofmeisterAn deleted the bugfix/support-empty-enum-string-json-convert branch November 30, 2024 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

InvalidOperationException serializing CreateContainerParameters instance

2 participants