Skip to content

Commit

Permalink
Introduction of Qowaiv.OpenApi.DataAnnotations
Browse files Browse the repository at this point in the history
  • Loading branch information
Corniel committed Dec 11, 2024
1 parent b136cbb commit d1a7a19
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 3 deletions.
6 changes: 6 additions & 0 deletions qowaiv-code-generation.sln
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Qowaiv.CodeGeneration.OpenA
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Qowaiv.CodeGeneration.Specs", "specs\Qowaiv.CodeGeneration.Specs\Qowaiv.CodeGeneration.Specs.csproj", "{89545131-D1B1-4FAE-82B4-4854FB479595}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Qowaiv.OpenApi.DataAnnotations", "src\Qowaiv.OpenApi.DataAnnotations\Qowaiv.OpenApi.DataAnnotations.csproj", "{1EEFFDE6-D03A-48A1-BCD9-2BF492B5CCB6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -59,6 +61,10 @@ Global
{89545131-D1B1-4FAE-82B4-4854FB479595}.Debug|Any CPU.Build.0 = Debug|Any CPU
{89545131-D1B1-4FAE-82B4-4854FB479595}.Release|Any CPU.ActiveCfg = Release|Any CPU
{89545131-D1B1-4FAE-82B4-4854FB479595}.Release|Any CPU.Build.0 = Release|Any CPU
{1EEFFDE6-D03A-48A1-BCD9-2BF492B5CCB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1EEFFDE6-D03A-48A1-BCD9-2BF492B5CCB6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1EEFFDE6-D03A-48A1-BCD9-2BF492B5CCB6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1EEFFDE6-D03A-48A1-BCD9-2BF492B5CCB6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace Qowaiv_SVO_definitions;

[Explicit]
public class Generation_of
{
private static readonly string Root = @"c:\code\Qowaiv";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="../../props/package.props" />

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Qowaiv.CodeGeneration/Qowaiv.CodeGeneration.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Project="../../props/package.props" />

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
5 changes: 5 additions & 0 deletions src/Qowaiv.OpenApi.DataAnnotations/AllOfAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace Qowaiv.OpenApi.DataAnnotations;

/// <summary>Specifies the involved sub schema's of which all should be picked.</summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public sealed class AllOfAttribute(params string[] schemas) : SubSchemasAttribute(schemas) { }
5 changes: 5 additions & 0 deletions src/Qowaiv.OpenApi.DataAnnotations/AnyOfAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace Qowaiv.OpenApi.DataAnnotations;

/// <summary>Specifies the involved sub schema's of which at least one should be picked.</summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public sealed class AnyOfAttribute(params string[] schemas) : SubSchemasAttribute(schemas) { }
5 changes: 5 additions & 0 deletions src/Qowaiv.OpenApi.DataAnnotations/OneOfAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace Qowaiv.OpenApi.DataAnnotations;

/// <summary>Specifies the involved sub schema's of which one should be picked.</summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public sealed class OneOfAttribute(params string[] schemas) : SubSchemasAttribute(schemas) { }
7 changes: 7 additions & 0 deletions src/Qowaiv.OpenApi.DataAnnotations/Properties/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
global using System;
global using System.Collections;
global using System.Collections.Generic;
global using System.Diagnostics;
global using System.Diagnostics.CodeAnalysis;
global using System.Globalization;
global using System.Linq;
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="../../props/package.props" />

<PropertyGroup>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
<Version>0.0.1-alpha-028</Version>
<PackageId>Qowaiv.OpenApi.DataAnnotations</PackageId>
<PackageReleaseNotes>
<![CDATA[
ToBeReleased
- Initial alpha release
]]>
</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
<Compile Include="../../shared/Guard.cs" Link="Guard.cs" />
</ItemGroup>


</Project>
1 change: 1 addition & 0 deletions src/Qowaiv.OpenApi.DataAnnotations/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Open API data annotations
10 changes: 10 additions & 0 deletions src/Qowaiv.OpenApi.DataAnnotations/SubSchemasAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Collections.Generic;

namespace Qowaiv.OpenApi.DataAnnotations;

/// <summary>Specifies the involved sub schema's.</summary>
public abstract class SubSchemasAttribute(params string[] schemas) : Attribute
{
/// <summary>The specified sub schema's.</summary>
public IReadOnlyCollection<string> Schemas { get; } = schemas;
}

0 comments on commit d1a7a19

Please sign in to comment.