-
Notifications
You must be signed in to change notification settings - Fork 10
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
new concept #784
base: main
Are you sure you want to change the base?
new concept #784
Conversation
public void Configure(MvcOptions options) | ||
{ | ||
var jsonOptions = _jsonOptions.Get(_jsonSettingsName); | ||
var logger = _loggerFactory.CreateLogger<EnumAsNumberFormatter>(); |
Check warning
Code scanning / CodeQL
Useless assignment to local variable Warning
logger
} | ||
} | ||
|
||
internal class EnumToNumberJsonConverter<TEnum> : JsonConverter<TEnum> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a custom converter? Isn't number encoding the default?
@@ -21,6 +22,7 @@ namespace Altinn.App.Api.Controllers; | |||
/// </summary> | |||
[Authorize] | |||
[ApiController] | |||
[JsonSettingsName("EnumAsNumber")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the setting name should just be AltinnApis
or something? Denoting that whatever settings are injected are what is required to make our own APIs stable?
Now maybe we should consider API conventions as well so that we don't have to remember this attribute everywhere?
Description
This is a new solution, compare to #773.
Here we annotate controllers. This means we do not have to update all enums with an annotation and remember it for future enums, and do the same for enums from storage/platform.
The tradeoff is the scaffolding to make this happen.
See PartiesController for usage.
Related Issue(s)
Verification
Documentation