in src/Cli/ConfigGenerator.cs [1800:1847]
private static EntityRestOptions ConstructUpdatedRestDetails(Entity entity, EntityOptions options, bool isCosmosDbNoSql)
{
// Updated REST Route details
EntityRestOptions restPath = (options.RestRoute is not null) ? ConstructRestOptions(restRoute: options.RestRoute, supportedHttpVerbs: null, isCosmosDbNoSql: isCosmosDbNoSql) : entity.Rest;
// Updated REST Methods info for stored procedures
SupportedHttpVerb[]? SupportedRestMethods;
if (!IsStoredProcedureConvertedToOtherTypes(entity, options)
&& (IsStoredProcedure(entity) || IsStoredProcedure(options)))
{
if (options.RestMethodsForStoredProcedure is null || !options.RestMethodsForStoredProcedure.Any())
{
SupportedRestMethods = entity.Rest.Methods;
}
else
{
SupportedRestMethods = CreateRestMethods(options.RestMethodsForStoredProcedure);
}
}
else
{
SupportedRestMethods = null;
}
if (!restPath.Enabled)
{
// Non-stored procedure scenario when the REST endpoint is disabled for the entity.
if (options.RestRoute is not null)
{
SupportedRestMethods = null;
}
else
{
if (options.RestMethodsForStoredProcedure is not null && options.RestMethodsForStoredProcedure.Any())
{
restPath = restPath with { Enabled = false };
}
}
}
if (IsEntityBeingConvertedToStoredProcedure(entity, options)
&& (SupportedRestMethods is null || SupportedRestMethods.Length == 0))
{
SupportedRestMethods = new SupportedHttpVerb[] { SupportedHttpVerb.Post };
}
return restPath with { Methods = SupportedRestMethods };
}