diff --git a/src/Service/Startup.cs b/src/Service/Startup.cs index 5a83ce3e7b..476fcd9736 100644 --- a/src/Service/Startup.cs +++ b/src/Service/Startup.cs @@ -624,18 +624,23 @@ private async Task PerformOnConfigChangeAsync(IApplicationBuilder app) runtimeConfigValidator.ValidateRelationshipsInConfig(runtimeConfig, sqlMetadataProviderFactory!); } - // Attempt to create OpenAPI document. - // Errors must not crash nor halt the intialization of the engine - // because OpenAPI document creation is not required for the engine to operate. - // Errors will be logged. - try + // OpenAPI document creation is only attempted for REST supporting database types. + // CosmosDB is not supported for OpenAPI document creation. + if (!runtimeConfig.CosmosDataSourceUsed) { - IOpenApiDocumentor openApiDocumentor = app.ApplicationServices.GetRequiredService(); - openApiDocumentor.CreateDocument(); - } - catch (DataApiBuilderException dabException) - { - _logger.LogError(exception: dabException, message: "OpenAPI Documentor initialization failed."); + // Attempt to create OpenAPI document. + // Errors must not crash nor halt the intialization of the engine + // because OpenAPI document creation is not required for the engine to operate. + // Errors will be logged. + try + { + IOpenApiDocumentor openApiDocumentor = app.ApplicationServices.GetRequiredService(); + openApiDocumentor.CreateDocument(); + } + catch (DataApiBuilderException dabException) + { + _logger.LogWarning(exception: dabException, message: "OpenAPI Documentor initialization failed. This will not affect dab startup."); + } } _logger.LogInformation("Successfully completed runtime initialization.");