-
Notifications
You must be signed in to change notification settings - Fork 325
Fix logs for autoentities #3299
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
793e67a
0426c52
ba65502
dd360b4
f52a5d5
33da7ac
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 |
|---|---|---|
|
|
@@ -305,7 +305,7 @@ protected override async Task GenerateAutoentitiesIntoEntities(IReadOnlyDictiona | |
| foreach ((string autoentityName, Autoentity autoentity) in autoentities) | ||
| { | ||
| int addedEntities = 0; | ||
| JsonArray? resultArray = await QueryAutoentitiesAsync(autoentity); | ||
| JsonArray? resultArray = await QueryAutoentitiesAsync(autoentityName, autoentity); | ||
| if (resultArray is null) | ||
| { | ||
| continue; | ||
|
|
@@ -316,7 +316,7 @@ protected override async Task GenerateAutoentitiesIntoEntities(IReadOnlyDictiona | |
| if (resultObject is null) | ||
| { | ||
| throw new DataApiBuilderException( | ||
| message: $"Cannot create new entity from autoentity pattern due to an internal error.", | ||
| message: $"Cannot create new entity from autoentities definition '{autoentityName}' due to an internal error.", | ||
|
Collaborator
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. As per the bug #3264 , the message should be: Cannot create new entity from autoentities member 'autoentityName' due to an internal error whereas the other bug says it should be |
||
| statusCode: HttpStatusCode.InternalServerError, | ||
| subStatusCode: DataApiBuilderException.SubStatusCodes.ErrorInInitialization); | ||
| } | ||
|
|
@@ -329,7 +329,7 @@ protected override async Task GenerateAutoentitiesIntoEntities(IReadOnlyDictiona | |
|
|
||
| if (string.IsNullOrWhiteSpace(entityName) || string.IsNullOrWhiteSpace(objectName) || string.IsNullOrWhiteSpace(schemaName)) | ||
| { | ||
| _logger.LogError("Skipping autoentity generation: entity_name or object is null or empty for autoentity pattern '{AutoentityName}'.", autoentityName); | ||
| _logger.LogError("Skipping autoentity generation: 'entity_name', 'object', or 'schema' is null or empty for autoentities definition '{AutoentityName}'.", autoentityName); | ||
| continue; | ||
| } | ||
|
|
||
|
|
@@ -356,7 +356,7 @@ protected override async Task GenerateAutoentitiesIntoEntities(IReadOnlyDictiona | |
| if (!entities.TryAdd(entityName, generatedEntity) || !runtimeConfig.TryAddGeneratedAutoentityNameToDataSourceName(entityName, autoentityName)) | ||
| { | ||
| throw new DataApiBuilderException( | ||
| message: $"Entity with name '{entityName}' already exists. Cannot create new entity from autoentity pattern with definition-name '{autoentityName}'.", | ||
| message: $"Entity with name '{entityName}' already exists. Cannot create new entity from autoentities definition '{autoentityName}'.", | ||
| statusCode: HttpStatusCode.BadRequest, | ||
| subStatusCode: DataApiBuilderException.SubStatusCodes.ErrorInInitialization); | ||
| } | ||
|
|
@@ -375,14 +375,14 @@ protected override async Task GenerateAutoentitiesIntoEntities(IReadOnlyDictiona | |
|
|
||
| if (addedEntities == 0) | ||
| { | ||
| _logger.LogWarning("No new entities were generated from the autoentity {autoentityName} defined in the configuration.", autoentityName); | ||
| _logger.LogWarning("No new entities were generated from the autoentities definition '{autoentityName}'.", autoentityName); | ||
| } | ||
| } | ||
|
|
||
| _runtimeConfigProvider.AddMergedEntitiesToConfig(entities); | ||
| } | ||
|
|
||
RubenCerna2079 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| public async Task<JsonArray?> QueryAutoentitiesAsync(Autoentity autoentity) | ||
| public async Task<JsonArray?> QueryAutoentitiesAsync(string autoentityName, Autoentity autoentity) | ||
| { | ||
| string include = string.Join(",", autoentity.Patterns.Include); | ||
| string exclude = string.Join(",", autoentity.Patterns.Exclude); | ||
|
|
@@ -395,10 +395,10 @@ protected override async Task GenerateAutoentitiesIntoEntities(IReadOnlyDictiona | |
| { $"{BaseQueryStructure.PARAM_NAME_PREFIX}name_pattern", new(namePattern, null, SqlDbType.NVarChar) } | ||
| }; | ||
|
|
||
| _logger.LogInformation("Query for Autoentities is being executed with the following parameters."); | ||
| _logger.LogInformation($"Autoentities include pattern: {include}"); | ||
| _logger.LogInformation($"Autoentities exclude pattern: {exclude}"); | ||
| _logger.LogInformation($"Autoentities name pattern: {namePattern}"); | ||
| _logger.LogDebug("Query for autoentities is being executed with the following parameters."); | ||
| _logger.LogDebug($"The autoentities definition '{autoentityName}' include pattern: {include}"); | ||
| _logger.LogDebug($"The autoentities definition '{autoentityName}' exclude pattern: {exclude}"); | ||
| _logger.LogDebug($"The autoentities definition '{autoentityName}' name pattern: {namePattern}"); | ||
RubenCerna2079 marked this conversation as resolved.
Show resolved
Hide resolved
RubenCerna2079 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| JsonArray? resultArray = await QueryExecutor.ExecuteQueryAsync( | ||
| sqltext: getAutoentitiesQuery, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.