Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Support empty string enum serialization and deserialization #8

Merged
merged 5 commits into from
Nov 30, 2024

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
1 participant