2

I am working a asp .net core 6.0 project. I am doing a Opayo payment API. https://developer-eu.elavon.com/docs/opayo/spec/api-reference-0#operation/createTransaction

In this API, There are some conditional required fields.

postalCode - Not required when country is IE.

state - Required when country is US.

browserJavaEnabled - Required if browserJavascriptEnabled is true.

browserColorDepth - Required if browserJavascriptEnabled is true.

credentialType object - is required when Save is true and so on..

Is there any package to add conditional Required field in asp .net core? ( for Required and NOT Required )

hanushic
  • 369
  • 1
  • 5
  • 19
  • Related: [Conditionally required property using data annotations](https://stackoverflow.com/questions/26354853/conditionally-required-property-using-data-annotations), [RequiredIf Conditional Validation for two variables in MVC4](https://stackoverflow.com/questions/28336992/requiredif-conditional-validation-for-two-variables-in-mvc4) – mcalex Nov 16 '21 at 09:23
  • 1
    FluentValidation at least can do that. – juunas Nov 16 '21 at 09:57

0 Answers0