-
Notifications
You must be signed in to change notification settings - Fork 254
Add Serialization & Deserialization of Sink File Properties with CLI Commands #2752
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
base: main
Are you sure you want to change the base?
Changes from all commits
333e63b
c24904c
c258d60
67b812b
e58fb27
8642be1
b4b9278
a7ee4ee
e25a446
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
namespace Azure.DataApiBuilder.Config.ObjectModel; | ||
|
||
/// <summary> | ||
/// Represents the options for configuring file sink telemetry. | ||
/// </summary> | ||
public record FileSinkOptions( | ||
bool Enabled = false, | ||
string? Path = "/logs/dab-log.txt", | ||
RollingIntervalMode? RollingInterval = RollingIntervalMode.Day, | ||
int? RetainedFileCountLimit = 1, | ||
int? FileSizeLimitBytes = 1048576) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we try to make FileSinkOptions with values below the minimum in the schema, do we end up with an invalid config, or do we error out first? |
||
{ | ||
public bool Enabled { get; init; } = Enabled; | ||
|
||
public string? Path { get; init; } = Path; | ||
|
||
public RollingIntervalMode? RollingInterval { get; init; } = RollingInterval; | ||
|
||
public int? RetainedFileCountLimit { get; init; } = RetainedFileCountLimit; | ||
|
||
public int? FileSizeLimitBytes { get; init; } = FileSizeLimitBytes; | ||
RubenCerna2079 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,18 @@ | ||||||
// Copyright (c) Microsoft Corporation. | ||||||
// Licensed under the MIT License. | ||||||
|
||||||
using System.Text.Json.Serialization; | ||||||
|
||||||
namespace Azure.DataApiBuilder.Config.ObjectModel; | ||||||
|
||||||
/// <summary> | ||||||
/// Represents the rolling interval options for file sink. | ||||||
/// The time it takes between the creation of new files. | ||||||
/// </summary> | ||||||
[JsonConverter(typeof(JsonStringEnumConverter))] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The default JsonStringEnumConverter will serialize enum values as "Hour"/"Day"/"Week", but the JSON schema expects lowercase strings ("hour","day","week"). Consider using JsonStringEnumConverter with a camel‐case naming policy (e.g. new JsonStringEnumConverter(JsonNamingPolicy.CamelCase)) or adjust the schema to match.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
public enum RollingIntervalMode | ||||||
{ | ||||||
Hour, | ||||||
Day, | ||||||
Week | ||||||
} |
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.
For any of these properties with defaults, if the default value is being used, but was not supplied by the user, does the property end up writing back out to the config?