• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ShipEngine / shipengine-dotnet / 9670357484

25 Jun 2024 10:18PM UTC coverage: 84.271% (-1.1%) from 85.36%
9670357484

Pull #92

github

joshuaflanagan
Demonstrate backward-compatible deprecation of enums

I would like to get rid of using C# enums in the SDK. They unnecessarily constrain the
values that a user can send to the ShipEngine API. The API expects a string, the SDK
should allow the user to specify a string. An enum requires converting values to an integer,
which has no value for our purposes. It also leads to awkwardness when the default is `0`,
which will correspond to an enum value we don't necessarily want. It requires the user
to update their SDK any time there is a new possible value accepted by the API.
We can still provide guidance for valid values via classes that expose static strings.

However, there is likely code in the wild where users are setting properties to an enum value.
This is an experiment to demonstrate using implicit conversion operators, and a custom JsonConverter,
to allow a user to set a "string enum" value using a string or an enum.
Pull Request #92: Demonstrate backward-compatible deprecation of enums

44 of 78 branches covered (56.41%)

Branch coverage included in aggregate %.

46 of 58 new or added lines in 2 files covered. (79.31%)

690 of 793 relevant lines covered (87.01%)

14.79 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

70.77
/ShipEngine/Models/Dto/CreateLabelFromShipmentDetails/StringEnum.cs


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc