Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Refitter.Core/RefitterSettingsLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public static class RefitterSettingsLoader
public static RefitGeneratorSettings Load(string json, string baseDirectory)
{
var settings = Serializer.Deserialize<RefitGeneratorSettings>(json);
if (settings is null)
{
throw new System.Text.Json.JsonException("Failed to deserialize settings: result was null");
}
ResolveRelativeSpecPaths(settings, baseDirectory);
return settings;
}
Expand All @@ -49,6 +53,8 @@ public static void ResolveRelativeSpecPaths(RefitGeneratorSettings settings, str
for (var i = 0; i < settings.OpenApiPaths.Length; i++)
{
var path = settings.OpenApiPaths[i];
if (string.IsNullOrWhiteSpace(path))
continue;
if (!IsUrl(path) && !Path.IsPathRooted(path))
{
settings.OpenApiPaths[i] = Path.GetFullPath(Path.Combine(baseDirectory, path));
Expand Down
13 changes: 7 additions & 6 deletions src/Refitter/GenerateCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,15 @@ protected override async Task<int> ExecuteAsync(CommandContext context, Settings
version += " (local build)";

// Header with branding
_reporter.ReportHeader(version);
if (!settings.NoBanner)
_reporter.ReportHeader(version);

// Support information
var supportKey = settings.NoLogging
? "Unavailable when logging is disabled"
: SupportInformation.GetSupportKey();

_reporter.ReportSupportKey(supportKey);
if (!settings.NoLogging)
{
var supportKey = SupportInformation.GetSupportKey();
_reporter.ReportSupportKey(supportKey);
}

if (context.Arguments.Any(a => a.Equals("--version", StringComparison.OrdinalIgnoreCase)) ||
context.Arguments.Any(a => a.Equals("-v", StringComparison.OrdinalIgnoreCase)))
Expand Down
Loading