RA.Utilities.Core.Constants
Version 10.1.1
This release adds HTTP 402 Payment Required to the shared response vocabulary, so paid resources can use a dedicated status code, message, and semantic response type instead of overloading Forbidden or Error. The release is additive: no existing field, type, or value changed.
✨ New Features
BaseResponseCode.PaymentRequired:402for resources that require payment before access is granted.BaseResponseMessages.PaymentRequired:"Payment is required to access this resource."as the default message.ResponseType.PaymentRequired: A new enum member (value18) that labels 402 responses in the JSON body. The member is appended, so the numeric values of existing members are unchanged.
📝 Notes
ResponseType.PaymentRequiredserializes as18with defaultSystem.Text.Jsonoptions, or"PaymentRequired"whenJsonStringEnumConverteris registered.RA.Utilities.Core.Exceptions10.2.0 addsPaymentRequiredException, andRA.Utilities.Apimaps it to HTTP 402 with aPaymentRequiredResponse.- Existing code is unaffected; the new fields and member are additive.
Version 10.1.0
This release adds IBAN validation codes and messages to BaseErrorCode and BaseErrorMessage, completing the field-level error vocabulary used by the new IBAN value object. The release is additive: no existing field, type, or value changed.
ResponseType has been converted from an extensible record back to a plain C# enum, and every constant field has moved from const to static readonly. The values themselves are unchanged.
✨ New Features
BaseErrorCodeIBAN codes:IbanRequired(REQUIRED_IBAN),IbanLength(IBAN_LENGTH),IbanNotValid(NOT_VALID_IBAN), andIbanCheckDigits(IBAN_CHECK_DIGITS). API consumers can distinguish a missing IBAN, an IBAN whose length does not match its country, a structurally invalid IBAN, and a failed ISO 7064 mod-97 check digit.BaseErrorMessageIBAN messages: The matching human-readable messages, e.g.The 'IBAN' field is required.and'IBAN' check digits are invalid.IBANvalue object integration: The newIBANvalue object inRA.Utilities.Core.ValueObjectsthrows structuredValidationErrorentries using these constants:IbanRequiredfor missing input,IbanNotValidfor structural failures (13–34 characters, country code and check-digit shape), andIbanCheckDigitswhen the mod-97 test fails.
⚠️ Breaking Changes
ResponseTypeis now anenum, not arecord: The type-safe enumrecordintroduced in v10.0.2 is replaced by a standard C#enumwith the same built-in values (Success,Created,Updated,Deleted,NoContent,Accepted,Validation,Problem,NotFound,Conflict,Unauthorized,Error,BadRequest,Unprocessable,Forbidden,TooManyRequests,ServiceUnavailable,GatewayTimeout). TheValueproperty, the implicitstringconversion, and inheritance-based extensibility are removed. The built-inResponseTypeJsonConverteris gone: with defaultSystem.Text.Jsonoptions the enum is written as a number (NotFound→8); registerJsonStringEnumConverterto keep string output. Migration: ReplaceresponseType.ValuewithresponseType.ToString(); replace custom types derived fromResponseTypewith the closest built-in member; switch expressions now support constant patterns (ResponseType.NotFound =>); decide whether clients receive numbers (default) or names (converter). See the Migration Guide for detailed before/after examples.- Constant fields are now
static readonly: Every field inBaseResponseCode,BaseResponseMessages,BaseErrorCode,BaseErrorMessage, andHeaderParametersispublic static readonlyinstead ofpublic const, and the holders arepartial classdeclarations instead ofstatic class. Ordinary reads are unchanged, but the fields can no longer be used where C# requires a constant expression — attribute arguments, default parameter values,caselabels, orconstdeclarations. Migration: Usestatic readonlyfor locals/fields that reference these values, a nullable default plus??for optional parameters, andifor a localconstwhere the compiler requires a constant. See the Migration Guide for before/after examples.
📝 Notes
ResponseTypeusesSystem.Text.Jsondefaults: numeric wire values unlessJsonStringEnumConverteris registered. With the converter, names are matched case-insensitively and unknown names (ornullfor a non-nullable enum) throwJsonException.default(ResponseType)isResponseType.Success(value0).- Because the fields are
static readonly, correcting a value no longer requires recompiling consumers. BaseErrorCode.IbanLengthis available for consumers that validate a country-specific length. The built-inIBANvalue object validates the structural range (13–34 characters) rather than a per-country length table, so it reportsIbanNotValidfor values outside that range.- The release is backward compatible; existing code compiles and behaves unchanged. See the Migration Guide for the new values.
Version 10.0.3
This release introduces a shared vocabulary for field-level validation failures: BaseErrorCode for machine-readable error codes and BaseErrorMessage for the matching human-readable messages.
✨ New Features
BaseErrorCode: New constants class providing stable, machine-readable error codes for validation failures around email (REQUIRED_EMAIL,EMAIL_MAX_LENGTH,INVALID_EMAIL), currency (REQUIRED_CURRENCY,CURRENCY_LENGTH,CURRENCY_MISMATCH), money (POSITIVE_MONEY), and SSN (REQUIRED_SSN,SSN_LENGTH,NOT_VALID_SSN). API consumers can branch on these codes programmatically without parsing message text.BaseErrorMessage: New constants class with the matching human-readable messages (e.g.,The 'Email address' field is required.), ensuring consistent wording for validation failures across all services.- Value object integration: These constants back the structured
ValidationErrorentries thrown by the value objects inRA.Utilities.Core.ValueObjects(Email,Currency,SSN,Money) and are translated into standardized HTTP 400 responses by theRA.Utilities.Apimiddleware.
📝 Notes
BaseErrorCode.EmailMaxLengthintentionally has noBaseErrorMessagecounterpart — the maximum-length message is built dynamically by theEmailvalue object because it interpolates the configured limit into the text.
Version 10.0.2
This release delivers a significant architectural improvement to ResponseType while expanding the constant catalog with gateway timeout support.
⚠️ Breaking Changes
ResponseTypeis now arecord, not anenum: TheResponseTypetype has been converted from a traditional C#enumto a type-safe enum pattern using arecord. This enables consuming projects to extendResponseTypewith custom values via inheritance. The built-in values (Success,Validation,Problem,NotFound,Conflict,Unauthorized,Error,BadRequest,Unprocessable,Forbidden,GatewayTimeout) remain available aspublic static readonlyfields. A customResponseTypeJsonConverterhandles JSON serialization to/from plain strings. Migration: Replace anyResponseType.SomeValueusage in switch expressions or enum-specific APIs with the equivalent record field access; serialization behavior is unchanged. See the Migration Guide for detailed before/after examples.
✨ New Features
BaseResponseCode.GatewayTimeout: AddedGatewayTimeout = 504constant for HTTP 504 Gateway Timeout responses.BaseResponseMessages.GatewayTimeout: Added a default message for gateway timeout scenarios.ResponseType.GatewayTimeout: Added a new built-in response type field for gateway timeout outcomes.
📝 Improvements
- XML Documentation: All XML doc comments in
BaseResponseCode,BaseResponseMessages, andResponseTypehave been revised for consistency and clarity, explicitly referencing the HTTP status code each constant represents.
Version 10.0.1
This release focuses on maintaining consistency within the RA.Utilities ecosystem and refining documentation for core constant values.
✨ Improvements
- Alignment: Version alignment with
RA.Utilities.Core.Exceptionsto support a coordinated release of core building blocks. - Documentation: Updated the constants documentation to ensure clear mapping for the newly introduced semantic exceptions (Conflict/Forbidden).
Version 10.0.0
Change the project version from 10.0.100-rc.2 to 10.0.0 to indicate the transition from release candidate to a stable version.
This marks the readiness of the RA Core Constants package for general availability in the RA Utilities ecosystem.
Version 10.0.0-rc.2
This release focuses on enhancing the clarity, consistency, and completeness of the constants provided by the package. The changes make the constants more intuitive to use and align the code with the documentation.
✨ Key Features
- Expanded
BaseResponseMessages:- Added new constants for
Created,Updated,Deleted,Forbidden, andConflictto provide a more comprehensive set of standard messages. - Improved the wording of existing messages for better clarity (e.g.,
Success,BadRequest,NotFound).
- Added new constants for
- Refined
ResponseTypeEnum:- Removed the
Databasemember to abstract away implementation details from the API contract, promoting a cleaner separation of concerns. - Removed the redundant
Unknownmember, asErrorserves as a better general-purpose error type.
- Removed the
- Improved Documentation:
- The
README.mdhas been significantly updated to accurately reflect all available constants inBaseResponseCode,BaseResponseMessages,HeaderParameters, and theResponseTypeenum. - Added clear tables and usage examples to improve the developer experience.
- The
📝 Notes
The goal of this update is to make the RA.Utilities.Core.Constants package a more robust and self-documenting source of truth for your application's core values. These changes ensure that developers have a consistent and predictable set of constants for building API responses and handling HTTP headers.
Thank you for using RA.Utilities!