Skip to content

Commit

Permalink
Clean-up.
Browse files Browse the repository at this point in the history
  • Loading branch information
Corniel committed Jun 13, 2024
1 parent 1d5bb1c commit 994d0e3
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 12 deletions.
7 changes: 0 additions & 7 deletions src/Qowaiv.CodeGeneration.OpenApi/ModelType.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class OpenApiTypeResolverSettings
public bool Partial { get; init; } = true;

/// <summary>Model type to generate (default is <see cref="ModelType.Record"/>).</summary>
public ModelType ModelType { get; init; }
public ModelType ModelType { get; init; } = ModelType.Record;

/// <summary>Property access to generate (default is <see cref="PropertyAccess.InitOnly"/>).</summary>
public PropertyAccess PropertyAccess { get; init; }
Expand Down
7 changes: 6 additions & 1 deletion src/Qowaiv.CodeGeneration/CSharpWriter.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System.IO;
using Qowaiv.CodeGeneration.Syntax;
using System.IO;

namespace Qowaiv.CodeGeneration;

/// <summary>Writer to generate C# code.</summary>
public sealed class CSharpWriter
{
/// <summary>UTF-8 BOM.</summary>
Expand Down Expand Up @@ -53,6 +55,7 @@ public CSharpWriter Write(CodeVisibility visibility)
return this;
}

/// <summary>Writes multiple instructions separated by a split action.</summary>
[FluentSyntax]
public CSharpWriter Write(IEnumerable<Action<CSharpWriter>> writes, Action<CSharpWriter> split)
{
Expand All @@ -71,9 +74,11 @@ public CSharpWriter Write(IEnumerable<Action<CSharpWriter>> writes, Action<CShar
return this;
}

/// <summary>Writes a type declaration to the code file.</summary>
[FluentSyntax]
public CSharpWriter Write(Type type) => Write(type, attribute: false);

/// <summary>Writes a type declaration to the code file.</summary>
[FluentSyntax]
public CSharpWriter Write(Type type, bool attribute)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Qowaiv.CodeGeneration/NamingStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ public static string EscapeKeywords(this string name)
? "@" + name
: name;

private static readonly string[] keywords = new[] { "default", "new", };
private static readonly string[] keywords = ["default", "new", "class"];
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Qowaiv.CodeGeneration;
namespace Qowaiv.CodeGeneration.Syntax;

/// <summary>Describes the code visibility.</summary>
public enum CodeVisibility
Expand Down
14 changes: 14 additions & 0 deletions src/Qowaiv.CodeGeneration/Syntax/ModelType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Qowaiv.CodeGeneration.Syntax;

/// <summary>The type of the model.</summary>
public enum ModelType
{
/// <summary>None.</summary>
None = 0,

/// <summary>Record.</summary>
Record = 1,

/// <summary>Class.</summary>
Class = 2,
}
2 changes: 2 additions & 0 deletions src/Qowaiv.CodeGeneration/Types/AttributeInfo.Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public partial class AttributeInfo

public static readonly AttributeInfo Qowaiv_Validation_DataAnnotations_Optional = new(typeof(Qowaiv.Validation.DataAnnotations.OptionalAttribute));

public static readonly AttributeInfo System_ComponentModel_DataAnnotations_Key = new(typeof(System.ComponentModel.DataAnnotations.KeyAttribute));

public static readonly AttributeInfo System_ComponentModel_DataAnnotations_Required = new(typeof(System.ComponentModel.DataAnnotations.RequiredAttribute));

public static readonly AttributeInfo System_Flags = new(typeof(System.FlagsAttribute));
Expand Down
2 changes: 1 addition & 1 deletion src/Qowaiv.CodeGeneration/Types/TypeBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ protected TypeBase(TypeInfo info)

/// <summary>The namespace of the type.</summary>
/// <remarks>
/// THis method exists to prevent unintended usage of the extension method
/// This method exists to prevent unintended usage of the extension method
/// on <see cref="System.Type"/>.
/// </remarks>
#pragma warning disable S1133 // Deprecated code should be removed
Expand Down

0 comments on commit 994d0e3

Please sign in to comment.