-
Notifications
You must be signed in to change notification settings - Fork 334
fix: deprecate --*.disabled CLI flags, wire up --mcp.disabled #3482
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
4b9e0f1
867439a
b5deead
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 |
|---|---|---|
|
|
@@ -102,21 +102,28 @@ public static bool TryCreateRuntimeConfig(InitOptions options, FileSystemRuntime | |
| // If --rest.disabled flag is included in the init command, we log a warning to not use this flag as it will be deprecated in future versions of DAB. | ||
| if (options.RestDisabled is true) | ||
| { | ||
| _logger.LogWarning("The option --rest.disabled will be deprecated and support for the option will be removed in future versions of Data API builder." + | ||
| " We recommend that you use the --rest.enabled option instead."); | ||
| _logger.LogWarning("The option --rest.disabled is deprecated and support for the option will be removed in future versions of Data API builder." + | ||
| " Use the --rest.enabled option instead."); | ||
| } | ||
|
|
||
| // If --graphql.disabled flag is included in the init command, we log a warning to not use this flag as it will be deprecated in future versions of DAB. | ||
|
Contributor
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. nit: Change the comment so instead of saying the flag will be deprecated in the future, it will say that it is deprecated. |
||
| if (options.GraphQLDisabled is true) | ||
| { | ||
| _logger.LogWarning("The option --graphql.disabled will be deprecated and support for the option will be removed in future versions of Data API builder." + | ||
| " We recommend that you use the --graphql.enabled option instead."); | ||
| _logger.LogWarning("The option --graphql.disabled is deprecated and support for the option will be removed in future versions of Data API builder." + | ||
| " Use the --graphql.enabled option instead."); | ||
| } | ||
|
|
||
| // If --mcp.disabled flag is included in the init command, we log a warning to not use this flag as it will be deprecated in future versions of DAB. | ||
|
Contributor
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. nit: Change the comment so instead of saying the flag will be deprecated in the future, it will say that it is deprecated. |
||
| if (options.McpDisabled is true) | ||
| { | ||
| _logger.LogWarning("The option --mcp.disabled is deprecated and support for the option will be removed in future versions of Data API builder." + | ||
| " Use the --mcp.enabled option instead."); | ||
| } | ||
|
|
||
| bool restEnabled, graphQLEnabled, mcpEnabled; | ||
| if (!TryDetermineIfApiIsEnabled(options.RestDisabled, options.RestEnabled, ApiType.REST, out restEnabled) || | ||
| !TryDetermineIfApiIsEnabled(options.GraphQLDisabled, options.GraphQLEnabled, ApiType.GraphQL, out graphQLEnabled) || | ||
| !TryDetermineIfMcpIsEnabled(options.McpEnabled, out mcpEnabled)) | ||
| !TryDetermineIfApiIsEnabled(options.McpDisabled, options.McpEnabled, ApiType.MCP, out mcpEnabled)) | ||
| { | ||
|
souvikghosh04 marked this conversation as resolved.
|
||
| return false; | ||
| } | ||
|
|
@@ -236,7 +243,7 @@ public static bool TryCreateRuntimeConfig(InitOptions options, FileSystemRuntime | |
| } | ||
| } | ||
|
|
||
| if (options.RestDisabled && options.GraphQLDisabled) | ||
| if (!restEnabled && !graphQLEnabled) | ||
|
Contributor
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. Shouldn't this be changed so that all three
Contributor
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. This might be a better way to update the code. |
||
| { | ||
| _logger.LogError("Both Rest and GraphQL cannot be disabled together."); | ||
| return false; | ||
|
|
@@ -296,12 +303,12 @@ public static bool TryCreateRuntimeConfig(InitOptions options, FileSystemRuntime | |
|
|
||
| /// <summary> | ||
| /// Helper method to determine if the api is enabled or not based on the enabled/disabled options in the dab init command. | ||
| /// The method also validates that there is no mismatch in semantics of enabling/disabling the REST/GraphQL API(s) | ||
| /// The method also validates that there is no mismatch in semantics of enabling/disabling the REST/GraphQL/MCP API(s) | ||
| /// based on the values supplied in the enabled/disabled options for the API in the init command. | ||
| /// </summary> | ||
| /// <param name="apiDisabledOptionValue">Value of disabled option as in the init command. If the option is omitted in the command, default value is assigned.</param> | ||
| /// <param name="apiEnabledOptionValue">Value of enabled option as in the init command. If the option is omitted in the command, default value is assigned.</param> | ||
| /// <param name="apiType">ApiType - REST/GraphQL.</param> | ||
| /// <param name="apiType">ApiType - REST/GraphQL/MCP.</param> | ||
| /// <param name="isApiEnabled">Boolean value indicating whether the API endpoint is enabled or not.</param> | ||
| private static bool TryDetermineIfApiIsEnabled(bool apiDisabledOptionValue, CliBool apiEnabledOptionValue, ApiType apiType, out bool isApiEnabled) | ||
| { | ||
|
|
@@ -333,17 +340,6 @@ private static bool TryDetermineIfApiIsEnabled(bool apiDisabledOptionValue, CliB | |
| return true; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Helper method to determine if the mcp api is enabled or not based on the enabled/disabled options in the dab init command. | ||
| /// </summary> | ||
| /// <param name="mcpEnabledOptionValue">True, if MCP is enabled</param> | ||
| /// <param name="isMcpEnabled">Out param isMcpEnabled</param> | ||
| /// <returns>True if MCP is enabled</returns> | ||
| private static bool TryDetermineIfMcpIsEnabled(CliBool mcpEnabledOptionValue, out bool isMcpEnabled) | ||
| { | ||
| return TryDetermineIfApiIsEnabled(false, mcpEnabledOptionValue, ApiType.MCP, out isMcpEnabled); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Helper method to determine if the multiple create operation is enabled or not based on the inputs from dab init command. | ||
| /// </summary> | ||
|
|
||
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.
nit: Change the comment so instead of saying the flag will be deprecated in the future, it will say that it is deprecated.