Skip to content

Commit

Permalink
Add Swagger Pet Store samples
Browse files Browse the repository at this point in the history
  • Loading branch information
justinyoo committed Jul 19, 2020
1 parent b6b563f commit 91a020d
Show file tree
Hide file tree
Showing 33 changed files with 901 additions and 24 deletions.
15 changes: 13 additions & 2 deletions Aliencube.AzureFunctions.Extensions.sln
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,19 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aliencube.AzureFunctions.Fu
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aliencube.AzureFunctions.FunctionAppV1IoC", "samples\Aliencube.AzureFunctions.FunctionAppV1IoC\Aliencube.AzureFunctions.FunctionAppV1IoC.csproj", "{7FD855AB-EB0E-42AE-A26D-E164D375D6A5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aliencube.AzureFunctions.FunctionAppV2Static", "samples\Aliencube.AzureFunctions.FunctionAppV2Static\Aliencube.AzureFunctions.FunctionAppV2Static.csproj", "{848EDB8F-9C45-462B-A544-EA237774F3BA}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aliencube.AzureFunctions.FunctionAppV2Static", "samples\Aliencube.AzureFunctions.FunctionAppV2Static\Aliencube.AzureFunctions.FunctionAppV2Static.csproj", "{848EDB8F-9C45-462B-A544-EA237774F3BA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aliencube.AzureFunctions.FunctionAppV2IoC", "samples\Aliencube.AzureFunctions.FunctionAppV2IoC\Aliencube.AzureFunctions.FunctionAppV2IoC.csproj", "{D6C3806E-2685-4E8D-9F4F-7A93E5270891}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aliencube.AzureFunctions.FunctionAppV2IoC", "samples\Aliencube.AzureFunctions.FunctionAppV2IoC\Aliencube.AzureFunctions.FunctionAppV2IoC.csproj", "{D6C3806E-2685-4E8D-9F4F-7A93E5270891}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "templates", "templates", "{56A43630-87E6-4E94-B24A-859258202578}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OpenApiEndpoints", "OpenApiEndpoints", "{41695443-A292-4909-89A6-2D9846753164}"
ProjectSection(SolutionItems) = preProject
templates\OpenApiEndpints\IOpenApiHttpTriggerContext.cs = templates\OpenApiEndpints\IOpenApiHttpTriggerContext.cs
templates\OpenApiEndpints\OpenApiHttpTrigger.cs = templates\OpenApiEndpints\OpenApiHttpTrigger.cs
templates\OpenApiEndpints\OpenApiHttpTriggerContext.cs = templates\OpenApiEndpints\OpenApiHttpTriggerContext.cs
templates\OpenApiEndpints\OpenApiHttpTriggerV1.cs = templates\OpenApiEndpints\OpenApiHttpTriggerV1.cs
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -220,6 +230,7 @@ Global
{7FD855AB-EB0E-42AE-A26D-E164D375D6A5} = {66D8DEA8-B477-497F-95BB-E8F9A5BAC352}
{848EDB8F-9C45-462B-A544-EA237774F3BA} = {66D8DEA8-B477-497F-95BB-E8F9A5BAC352}
{D6C3806E-2685-4E8D-9F4F-7A93E5270891} = {66D8DEA8-B477-497F-95BB-E8F9A5BAC352}
{41695443-A292-4909-89A6-2D9846753164} = {56A43630-87E6-4E94-B24A-859258202578}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {70FEC644-BB3C-4441-AF91-DC694803C8F2}
Expand Down
23 changes: 23 additions & 0 deletions samples/Aliencube.AzureFunctions.FunctionApp.Models/ApiResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace Aliencube.AzureFunctions.FunctionApp.Models
{
/// <summary>
/// This represents the model entity for API response of Swagger Pet Store.
/// </summary>
public class ApiResponse
{
/// <summary>
/// Gets or sets the code.
/// </summary>
public int? Code { get; set; }

/// <summary>
/// Gets or sets the type.
/// </summary>
public string Type { get; set; }

/// <summary>
/// Gets or sets the message.
/// </summary>
public string Message { get; set; }
}
}
18 changes: 18 additions & 0 deletions samples/Aliencube.AzureFunctions.FunctionApp.Models/Category.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace Aliencube.AzureFunctions.FunctionApp.Models
{
/// <summary>
/// This represents the model entity for category of Swagger Pet Store.
/// </summary>
public class Category
{
/// <summary>
/// Gets or sets the category ID.
/// </summary>
public long? Id { get; set; }

/// <summary>
/// Gets or sets the name.
/// </summary>
public string Name { get; set; }
}
}
40 changes: 40 additions & 0 deletions samples/Aliencube.AzureFunctions.FunctionApp.Models/Order.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System;

namespace Aliencube.AzureFunctions.FunctionApp.Models
{
/// <summary>
/// This represents the model entity for order of Swagger Pet Store.
/// </summary>
public class Order
{
/// <summary>
/// Gets or sets the order ID.
/// </summary>
public long? Id { get; set; }

/// <summary>
/// Gets or sets the pet ID.
/// </summary>
public long? PetId { get; set; }

/// <summary>
/// Gets or sets the quantity.
/// </summary>
public int? Quantity { get; set; }

/// <summary>
/// Gets or seets the date/time shipped.
/// </summary>
public DateTime? ShipDate { get; set; }

/// <summary>
/// Gets or sets the <see cref="OrderStatus"/> value.
/// </summary>
public OrderStatus? Status { get; set; }

/// <summary>
/// Gets or sets the value indicating whether the order is complete or not.
/// </summary>
public bool? Complete { get; set; }
}
}
27 changes: 27 additions & 0 deletions samples/Aliencube.AzureFunctions.FunctionApp.Models/OrderStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace Aliencube.AzureFunctions.FunctionApp.Models
{
/// <summary>
/// This specifies the order status.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum OrderStatus
{
/// <summary>
/// Identifies as "placed".
/// </summary>
Placed = 1,

/// <summary>
/// Identifies as "approved".
/// </summary>
Approved = 2,

/// <summary>
/// Identifies as "delivered".
/// </summary>
Delivered = 3
}
}
44 changes: 44 additions & 0 deletions samples/Aliencube.AzureFunctions.FunctionApp.Models/Pet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using System.Collections.Generic;

using Newtonsoft.Json;

namespace Aliencube.AzureFunctions.FunctionApp.Models
{
/// <summary>
/// This represents the model entity for pet of Swagger Pet Store.
/// </summary>
public class Pet
{
/// <summary>
/// Gets or sets the pet ID.
/// </summary>
public long? Id { get; set; }

/// <summary>
/// Gets or sets the category.
/// </summary>
public Category Category { get; set; }

/// <summary>
/// Gets or sets the name.
/// </summary>
[JsonRequired]
public string Name { get; set; }

/// <summary>
/// Gets or sets the list of photo URLs.
/// </summary>
[JsonRequired]
public List<string> PhotoUrls { get; set; } = new List<string>();

/// <summary>
/// Gets or sets the list of tags.
/// </summary>
public List<Tag> Tags { get; set; }

/// <summary>
/// Gets or sets the <see cref="PetStatus"/> value.
/// </summary>
public PetStatus? Status { get; set; }
}
}
27 changes: 27 additions & 0 deletions samples/Aliencube.AzureFunctions.FunctionApp.Models/PetStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace Aliencube.AzureFunctions.FunctionApp.Models
{
/// <summary>
/// This specifices the pet status.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum PetStatus
{
/// <summary>
/// Identifies as "available".
/// </summary>
Available = 1,

/// <summary>
/// Identifies as "pending".
/// </summary>
Pending = 2,

/// <summary>
/// Identifies as "sold".
/// </summary>
Sold = 3
}
}
18 changes: 18 additions & 0 deletions samples/Aliencube.AzureFunctions.FunctionApp.Models/Tag.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace Aliencube.AzureFunctions.FunctionApp.Models
{
/// <summary>
/// This represents the model entity for tag of Swagger Pet Store.
/// </summary>
public class Tag
{
/// <summary>
/// Gets or sets the tag ID.
/// </summary>
public long? Id { get; set; }

/// <summary>
/// Gets or sets the name.
/// </summary>
public string Name { get; set; }
}
}
48 changes: 48 additions & 0 deletions samples/Aliencube.AzureFunctions.FunctionApp.Models/User.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
namespace Aliencube.AzureFunctions.FunctionApp.Models
{
/// <summary>
/// This represents the model entity for user of Swagger Pet Store.
/// </summary>
public class User
{
/// <summary>
/// Gets or sets the user ID.
/// </summary>
public long? Id { get; set; }

/// <summary>
/// Gets or sets the username.
/// </summary>
public string Username { get; set; }

/// <summary>
/// Gets or sets the first name.
/// </summary>
public string FirstName { get; set; }

/// <summary>
/// Gets or sets the last name.
/// </summary>
public string LastName { get; set; }

/// <summary>
/// Gets or sets the email.
/// </summary>
public string Email { get; set; }

/// <summary>
/// Gets or sets the password.
/// </summary>
public string Password { get; set; }

/// <summary>
/// Gets or sets the phone number.
/// </summary>
public string Phone { get; set; }

/// <summary>
/// Gets or sets the user status value.
/// </summary>
public int? UserStatus { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aliencube.AzureFunctions.Extensions.OpenApi" Version="1.8.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.28" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Aliencube.AzureFunctions.Extensions.OpenApi\Aliencube.AzureFunctions.Extensions.OpenApi.csproj" />
<ProjectReference Include="..\Aliencube.AzureFunctions.FunctionApp.Functions\Aliencube.AzureFunctions.FunctionApp.Functions.csproj" />
</ItemGroup>

Expand All @@ -27,4 +27,17 @@
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>

<ItemGroup Condition="'$(Configuration)'=='Debug'">
<Compile Include="..\..\templates\OpenApiEndpints\IOpenApiHttpTriggerContext.cs">
<BuildAction>Compile</BuildAction>
</Compile>
<Compile Include="..\..\templates\OpenApiEndpints\OpenApiHttpTriggerContext.cs">
<BuildAction>Compile</BuildAction>
</Compile>
<Compile Include="..\..\templates\OpenApiEndpints\OpenApiHttpTriggerV1.cs">
<BuildAction>Compile</BuildAction>
</Compile>
</ItemGroup>

</Project>
Loading

0 comments on commit 91a020d

Please sign in to comment.