Skip to content

Commit f3f727b

Browse files
committed
Nullability handling
1 parent 3c5f6f1 commit f3f727b

File tree

2 files changed

+47
-16
lines changed

2 files changed

+47
-16
lines changed

src/Simplify.Web.Postman/Settings/IPostmanGenerationSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public interface IPostmanGenerationSettings
3535
/// <value>
3636
/// The name of the environment file.
3737
/// </value>
38-
string? EnvironmentFileName { get; }
38+
string EnvironmentFileName { get; }
3939

4040
/// <summary>
4141
/// Gets or sets the environment file name postfix.
Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Reflection;
1+
using System;
2+
using System.Reflection;
23

34
namespace Simplify.Web.Postman.Settings
45
{
@@ -7,20 +8,26 @@ namespace Simplify.Web.Postman.Settings
78
/// </summary>
89
public class PostmanGenerationSettings : IPostmanGenerationSettings
910
{
11+
private string _collectionName;
12+
private string _collectionFileName;
13+
private string _collectionFileNamePostfix;
14+
private string _environmentFileName;
15+
private string _environmentFileNamePostfix;
16+
private string _generationFolderPath;
17+
1018
/// <summary>
11-
/// Initializes a new instance of the <see cref="PostmanGenerationSettings"/> class.
19+
/// Initializes a new instance of the <see cref="PostmanGenerationSettings" /> class.
1220
/// </summary>
1321
public PostmanGenerationSettings()
1422
{
15-
GenerationFolderPath = "postman";
16-
CollectionFileNamePostfix = ".postman_collection";
17-
EnvironmentFileNamePostfix = ".postman_environment";
18-
1923
var projectAssemblyName = Assembly.GetEntryAssembly()?.GetName().Name ?? "App";
2024

21-
CollectionName = projectAssemblyName;
22-
CollectionFileName = projectAssemblyName;
23-
EnvironmentFileName = projectAssemblyName;
25+
_collectionName = projectAssemblyName;
26+
_collectionFileName = projectAssemblyName;
27+
_collectionFileNamePostfix = ".postman_collection";
28+
_environmentFileName = projectAssemblyName;
29+
_environmentFileNamePostfix = ".postman_environment";
30+
_generationFolderPath = "postman";
2431
}
2532

2633
/// <summary>
@@ -29,46 +36,70 @@ public PostmanGenerationSettings()
2936
/// <value>
3037
/// The name of the collection.
3138
/// </value>
32-
public string? CollectionName { get; set; }
39+
public string CollectionName
40+
{
41+
get => _collectionName;
42+
set => _collectionName = value ?? throw new ArgumentNullException(nameof(value));
43+
}
3344

3445
/// <summary>
3546
/// Gets or sets the name of the collection file.
3647
/// </summary>
3748
/// <value>
3849
/// The name of the collection file.
3950
/// </value>
40-
public string? CollectionFileName { get; set; }
51+
public string CollectionFileName
52+
{
53+
get => _collectionFileName;
54+
set => _collectionFileName = value ?? throw new ArgumentNullException(nameof(value));
55+
}
4156

4257
/// <summary>
4358
/// Gets or sets the collection file name postfix.
4459
/// </summary>
4560
/// <value>
4661
/// The collection file name postfix.
4762
/// </value>
48-
public string CollectionFileNamePostfix { get; set; }
63+
public string CollectionFileNamePostfix
64+
{
65+
get => _collectionFileNamePostfix;
66+
set => _collectionFileNamePostfix = value ?? throw new ArgumentNullException(nameof(value));
67+
}
4968

5069
/// <summary>
5170
/// Gets or sets the name of the environment file.
5271
/// </summary>
5372
/// <value>
5473
/// The name of the environment file.
5574
/// </value>
56-
public string? EnvironmentFileName { get; set; }
75+
public string EnvironmentFileName
76+
{
77+
get => _environmentFileName;
78+
set => _environmentFileName = value ?? throw new ArgumentNullException(nameof(value));
79+
}
5780

5881
/// <summary>
5982
/// Gets or sets the environment file name postfix.
6083
/// </summary>
6184
/// <value>
6285
/// The environment file name postfix.
6386
/// </value>
64-
public string EnvironmentFileNamePostfix { get; set; }
87+
public string EnvironmentFileNamePostfix
88+
{
89+
get => _environmentFileNamePostfix;
90+
set => _environmentFileNamePostfix = value ?? throw new ArgumentNullException(nameof(value));
91+
}
6592

6693
/// <summary>
6794
/// Gets or sets the generation folder path.
6895
/// </summary>
6996
/// <value>
7097
/// The generation folder path.
7198
/// </value>
72-
public string GenerationFolderPath { get; set; }
99+
public string GenerationFolderPath
100+
{
101+
get => _generationFolderPath;
102+
set => _generationFolderPath = value ?? throw new ArgumentNullException(nameof(value));
103+
}
73104
}
74105
}

0 commit comments

Comments
 (0)