Skip to content
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

[Bug]: dab validate blows up on invalid JSON. #2523

Open
JerryNixon opened this issue Jan 15, 2025 · 0 comments
Open

[Bug]: dab validate blows up on invalid JSON. #2523

JerryNixon opened this issue Jan 15, 2025 · 0 comments
Labels
bug Something isn't working triage issues to be triaged

Comments

@JerryNixon
Copy link
Contributor

Remove "permissions" from one of the entities in an otherwise valid configuration file.

Or just misspell "permissions", same result.

Then run dab validate

C:\Temp\dab\Working>dotnet dab validate
Information: Microsoft.DataApiBuilder 1.3.19
Information: Config not provided. Trying to get default config based on DAB_ENVIRONMENT...      
Information: Environment variable DAB_ENVIRONMENT is (null)
Information: Validating config file: dab-config.json
Loading config file from C:\Temp\dab\dotnet-template\Api\Working\dab-config.json.
Unhandled exception. System.AggregateException: One or more errors occurred. (Object reference not set to an instance of an object.)
 ---> System.NullReferenceException: Object reference not set to an instance of an object.      
   at Azure.DataApiBuilder.Core.Configurations.RuntimeConfigValidator.ValidatePermissionsInConfig(RuntimeConfig runtimeConfig) in /_/src/Core/Configurations/RuntimeConfigValidator.cs:line 733 
   at Azure.DataApiBuilder.Core.Configurations.RuntimeConfigValidator.TryValidateConfig(String configFilePath, ILoggerFactory loggerFactory) in /_/src/Core/Configurations/RuntimeConfigValidator.cs:line 154
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)     
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at Cli.ConfigGenerator.IsConfigValid(ValidateOptions options, FileSystemRuntimeConfigLoader loader, IFileSystem fileSystem) in /_/src/Cli/ConfigGenerator.cs:line 1709
   at Cli.Commands.ValidateOptions.Handler(ILogger logger, FileSystemRuntimeConfigLoader loader, IFileSystem fileSystem) in /_/src/Cli/Commands/ValidateOptions.cs:line 31
   at Cli.Program.<>c__DisplayClass2_0.<Execute>b__5(ValidateOptions options) in /_/src/Cli/Program.cs:line 67
   at CommandLine.ParserResultExtensions.MapResult[T1,T2,T3,T4,T5,T6,T7,T8,TResult](ParserResult`1 result, Func`2 parsedFunc1, Func`2 parsedFunc2, Func`2 parsedFunc3, Func`2 parsedFunc4, Func`2 parsedFunc5, Func`2 parsedFunc6, Func`2 parsedFunc7, Func`2 parsedFunc8, Func`2 notParsedFunc)
   at Cli.Program.Execute(String[] args, ILogger cliLogger, IFileSystem fileSystem, FileSystemRuntimeConfigLoader loader) in /_/src/Cli/Program.cs:line 61
   at Cli.Program.Main(String[] args) in /_/src/Cli/Program.cs:line 41

Of all CLI methods, validate should handle exceptions with elegance.

Solution

"Config file is not valid" at a minimum.

"permissions property is required on entity Actor" would be ideal.

@JerryNixon JerryNixon added bug Something isn't working triage issues to be triaged labels Jan 15, 2025
@JerryNixon JerryNixon changed the title [Bug]: dab validate blows up. [Bug]: dab validate blows up on invalid JSON. Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage issues to be triaged
Projects
None yet
Development

No branches or pull requests

1 participant