Skip to content

Add DecimalTypeObject to test-integration (#143) #237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
2dc3505
Add DecimalTypeObject to test-integration
Sep 11, 2021
c530163
GET->POST Chage
meanstigerkim Sep 17, 2021
2a550b1
Add OpenApiRequestBody
meanstigerkim Sep 17, 2021
5b921c6
Given_OpenApiDocument_Then_It_Should_Return_OperationRequestBodyConte…
meanstigerkim Sep 23, 2021
9900771
I modified it based on the advice I got from Git from Deserve82
meanstigerkim Sep 23, 2021
aad319e
fix bug
meanstigerkim Sep 27, 2021
ec859f8
fix bug(text/plain) -> application/octet-stream
meanstigerkim Sep 27, 2021
3b6f60f
fix bug(text/plain) -> application/octet-stream
meanstigerkim Sep 27, 2021
fa45f53
Merge branch 'feature/test-integration2' of https://github.com/minbum…
meanstigerkim Sep 27, 2021
b70e1fb
Merge branch 'feature/test-integration2' of https://github.com/minbum…
meanstigerkim Sep 27, 2021
32a7d4d
Merge branch 'feature/test-integration2' of https://github.com/minbum…
meanstigerkim Sep 27, 2021
ea84da4
fix bug
Oct 4, 2021
503462d
fixed that fails to use a model with a property named Aliases (#218)
level120 Sep 14, 2021
b2596d5
Feature/#156 list of recursive models (#233)
tsolbjor Sep 17, 2021
5e5acff
Add integration testing for Boolean Object Type (#143) (#236)
Deserve82 Sep 17, 2021
f862a32
Support "Base Object (root of all classes)" type (#234)
Lee-WonJun Sep 23, 2021
3a96a38
Tidy up files
justinyoo Sep 23, 2021
09cb79b
Fix: Change links to moved docs (#242)
cjakobsen Sep 23, 2021
bb7319a
Update docs
justinyoo Sep 23, 2021
e01dd8a
Add DoubleObject to test-integration (#143) (#239)
SoniaComp Sep 24, 2021
3e6dd62
Update type extension methods to detect arrays and dictionaries bette…
justinyoo Sep 24, 2021
7ecff10
Update issue templates
justinyoo Sep 25, 2021
f857a5b
Add issue template
justinyoo Sep 25, 2021
cebbd7a
Change the issue template name
justinyoo Sep 25, 2021
2135d96
Add PR template
justinyoo Sep 25, 2021
8b9d84b
Add integration testing for String Object Type (#250)
Deserve82 Oct 1, 2021
0f625c7
Feature/#139 OpenAPI query string/path parameter examples (#243)
choipureum Oct 1, 2021
e612070
HTTP/HTTPS in Swagger UI + oauth2+redirect.html (#253)
justinyoo Oct 1, 2021
39820ca
Fix "could not resolve reference error" #160 (#246)
haileymoon Oct 1, 2021
ef9169c
Add authorisation feature to OpenApiHttpTriggerContext (#255)
justinyoo Oct 1, 2021
2180949
Add integration testing for jObject Type (#252)
choipureum Oct 1, 2021
7db0d2f
Formatting
justinyoo Oct 1, 2021
af42aaf
Update docs for 0.9.0-preview (#256)
justinyoo Oct 2, 2021
6dc3cb6
Revert "Update docs for 0.9.0-preview (#256)"
Oct 5, 2021
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
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Bug report, feature request or other
about: Create a report to help us improve
title: Bug report, feature request or other request
labels: ''
assignees: ''
---

**Describe the issue**
A clear and concise description of what the issue is about.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your issue.

**Environment (please complete the following information, if applicable):**
- OS: [e.g. Windows/Mac/Linux]
- Browser [e.g. edge, chrome, firefox, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
18 changes: 18 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Pull request
about: Create a pull request
title: Pull request
labels: ''
assignees: ''
---

Related to #{issue_number}.

**Changes proposed in this pull request**:

* ...
* ...
* ...

**Screenshots**
If applicable, add screenshots to help explain your pull request.
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Contributing #

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
## Getting Started ##

* [**Enable OpenAPI documents to your Azure Functions HTTP Trigger (Preview)**](docs/enable-open-api-endpoints.md): This document shows how to enable OpenAPI extension on your Azure Functions applications and render Swagger UI, and OpenAPI v2 and v3 documents on-the-fly. It's currently in preview.
* [**Microsoft.Azure.WebJobs.Extensions.OpenApi**](docs/openapi.md)
* [**Microsoft.Azure.Functions.Worker.Extensions.OpenApi**](docs/openapi-out-of-proc.md)
* [**Microsoft.Azure.WebJobs.Extensions.OpenApi**](docs/openapi-in-proc.md)
* [**Microsoft.Azure.WebJobs.Extensions.OpenApi.Core**](docs/openapi-core.md)
* [**Azure Functions v1 Support**](docs/azure-functions-v1-support.md): This document shows how to support Azure Functions v1 runtime with this OpenAPI extension.
* [**Integrating OpenAPI-enabled Azure Functions to Azure API Management**](docs/integrate-with-apim.md): This document shows how to integrate the Azure Functions application with [Azure API Management](https://docs.microsoft.com/azure/api-management/api-management-key-concepts?WT.mc_id=dotnet_0000_juyoo), via this OpenAPI extension.
Expand Down Expand Up @@ -38,12 +39,10 @@ Here are the other sample apps directly using the NuGet packages (external repos
* [Function App .NET 6 with IoC Container (out-of-proc)](https://github.com/justinyoo/azfunc-openapi-dotnet/tree/main/Net60.FunctionApp.OutOfProc.IoC)
* [Function App .NET 6 with Static (out-of-proc)](https://github.com/justinyoo/azfunc-openapi-dotnet/tree/main/Net60.FunctionApp.OutOfProc.Static)

> **NOTE**: .NET 6 support is currently very early preview.


## Azure Functions V1 Support ##

This library supports Azure Functions V2 and onwards. If you still want to get your v1 app supported, find the [community contribution](https://github.com/aliencube/AzureFunctions.Extensions).
This library supports Azure Functions V2 and onwards. If you still want to get your v1 app supported, find the [community contribution](https://github.com/aliencube/AzureFunctions.Extensions) or the [proxy feature](docs/azure-functions-v1-support.md).


## Issues? ##
Expand Down
9 changes: 5 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# AzureFunctions.Extensions #
# Azure Functions OpenAPI Extension #

This provides some useful extensions for Azure Functions.
This extension adds the OpenAPI capability to your Azure Functions app.


## Getting Started ![Build and Test](https://github.com/Azure/azure-functions-openapi-extension/workflows/Build%20and%20Test/badge.svg) ##

| Package | Status | Version |
| --- | --- | --- |
| [Microsoft.Azure.Functions.Worker.Extensions.OpenApi](openapi-out-of-proc.md) | [![](https://img.shields.io/nuget/dt/Microsoft.Azure.Functions.Worker.Extensions.OpenApi.svg)](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.OpenApi/) | [![](https://img.shields.io/nuget/v/Microsoft.Azure.Functions.Worker.Extensions.OpenApi.svg)](https://www.nuget.org/packages/Microsoft.Azure.Functions.Worker.Extensions.OpenApi/) |
| [Microsoft.Azure.WebJobs.Extensions.OpenApi.Configuration.AppSettings](app-settings.md) | [![](https://img.shields.io/nuget/dt/Microsoft.Azure.WebJobs.Extensions.OpenApi.Configuration.AppSettings.svg)](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi.Configuration.AppSettings/) | [![](https://img.shields.io/nuget/v/Microsoft.Azure.WebJobs.Extensions.OpenApi.Configuration.AppSettings.svg)](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi.Configuration.AppSettings/) |
| [Microsoft.Azure.WebJobs.Extensions.OpenApi.Core](openapi-core.md) | [![](https://img.shields.io/nuget/dt/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.svg)](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/) | [![](https://img.shields.io/nuget/v/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.svg)](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/) |
| [Microsoft.Azure.WebJobs.Extensions.OpenApi](openapi.md) | [![](https://img.shields.io/nuget/dt/Microsoft.Azure.WebJobs.Extensions.OpenApi.svg)](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi/) | [![](https://img.shields.io/nuget/v/Microsoft.Azure.WebJobs.Extensions.OpenApi.svg)](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi/) |
| [Microsoft.Azure.WebJobs.Extensions.OpenApi.CLI](openapi-cli.md) | [![](https://img.shields.io/static/v1?label=tag&message=cli-*&color=brightgreen)](https://github.com/Azure/azure-functions-openapi-extension/releases) | [![](https://img.shields.io/static/v1?label=tag&message=cli-*&color=brightgreen)](https://github.com/Azure/azure-functions-openapi-extension/releases) |
| [Microsoft.Azure.WebJobs.Extensions.OpenApi](openapi-in-proc.md) | [![](https://img.shields.io/nuget/dt/Microsoft.Azure.WebJobs.Extensions.OpenApi.svg)](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi/) | [![](https://img.shields.io/nuget/v/Microsoft.Azure.WebJobs.Extensions.OpenApi.svg)](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.OpenApi/) |
| [Microsoft.Azure.WebJobs.Extensions.OpenApi.CLI](openapi-cli.md) | [![](https://img.shields.io/static/v1?label=tag&message=cli-*&color=brightgreen)](https://github.com/Azure/azure-functions-openapi-extension/releases) | [![](https://img.shields.io/static/v1?label=tag&message=cli-*&color=brightgreen)](https://github.com/Azure/azure-functions-openapi-extension/releases) |
5 changes: 4 additions & 1 deletion docs/enable-open-api-endpoints.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# DOCUMENT MOVED <br/> &nbsp;&nbsp;&nbsp;&nbsp; 👉 [Enable OpenAPI Endpoints on Azure Functions (Preview) &ndash; In-Process Model](./enable-open-api-endpoints-in-proc.md) #
# Enable OpenAPI Endpoints on Azure Functions (Preview) #

* [Enable OpenAPI Endpoints on Azure Functions (Preview) &ndash; In-Process Model](./enable-open-api-endpoints-in-proc.md)
* [Enable OpenAPI Endpoints on Azure Functions (Preview) &ndash; Out-of-Process Model](./enable-open-api-endpoints-out-of-proc.md)
5 changes: 4 additions & 1 deletion docs/openapi.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# DOCUMENT MOVED <br/> &nbsp;&nbsp;&nbsp;&nbsp; 👉 [Microsoft.Azure.WebJobs.Extensions.OpenApi](./openapi-in-proc.md) #
# Packages for In-Process / Out-of-Process Worker #

* [Microsoft.Azure.WebJobs.Extensions.OpenApi &ndash; In-Process Model](./openapi-in-proc.md)
* [Microsoft.Azure.Functions.Worker.Extensions.OpenApi &ndash; Out-of-Process Model](./openapi-out-of-proc.md)
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;

namespace Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.Models
{
Expand All @@ -9,5 +11,7 @@ public class DummyListModel
public HashSet<int> ListValues2 { get; set; }

public ISet<DummyStringModel> ListValues3 { get; set; }

public ValidationProblemDetails ValidationProblemDetails { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,9 @@ public class DummyResponseModel
public DummySubResponseModel SubResponse2 { get; set; }

public DummyGenericModel<DummyModel> DummyGenericDummyModel { get; set; }

public List<DummyResponseModel> Children { get; set; }

public Dictionary<string, DummyResponseModel> Children2 { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// using System.Globalization;
// using System.Linq;
// using System.Net;
// using System.Threading.Tasks;

// using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Abstractions;
// using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Configurations;
// using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Extensions;

// namespace Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.V3Static.Configurations
// {
// public class OpenApiHttpTriggerAuthorization : DefaultOpenApiHttpTriggerAuthorization
// {
// public override async Task<OpenApiAuthorizationResult> AuthorizeAsync(IHttpRequestDataObject req)
// {
// var result = default(OpenApiAuthorizationResult);
// var authtoken = (string) req.Headers["Authorization"];
// if (authtoken.IsNullOrWhiteSpace())
// {
// result = new OpenApiAuthorizationResult()
// {
// StatusCode = HttpStatusCode.Unauthorized,
// ContentType = "text/plain",
// Payload = "Unauthorized",
// };

// return await Task.FromResult(result).ConfigureAwait(false);
// }

// if (authtoken.StartsWith("Bearer", ignoreCase: true, CultureInfo.InvariantCulture) == false)
// {
// result = new OpenApiAuthorizationResult()
// {
// StatusCode = HttpStatusCode.Unauthorized,
// ContentType = "text/plain",
// Payload = "Invalid auth format",
// };

// return await Task.FromResult(result).ConfigureAwait(false);
// }

// var token = authtoken.Split(' ').Last();
// if (token != "secret")
// {
// result = new OpenApiAuthorizationResult()
// {
// StatusCode = HttpStatusCode.Forbidden,
// ContentType = "text/plain",
// Payload = "Invalid auth token",
// };

// return await Task.FromResult(result).ConfigureAwait(false);
// }

// return await Task.FromResult(result).ConfigureAwait(false);
// }
// }
// }
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using Newtonsoft.Json.Serialization;

using GenericExtensions = Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Extensions.GenericExtensions;
using HttpRequestDataObjectExtensions = Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Extensions.HttpRequestDataObjectExtensions;
using OpenApiDocumentExtensions = Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Extensions.OpenApiDocumentExtensions;
using StringExtensions = Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Extensions.StringExtensions;

Expand Down Expand Up @@ -73,7 +74,7 @@ public IDocument AddServer(IHttpRequestDataObject req, string routePrefix, IOpen
this._req = req;

var prefix = string.IsNullOrWhiteSpace(routePrefix) ? string.Empty : $"/{routePrefix}";
var baseUrl = $"{this._req.Scheme}://{this._req.Host}{prefix}";
var baseUrl = $"{HttpRequestDataObjectExtensions.GetScheme(this._req, options)}://{this._req.Host}{prefix}";

var server = new OpenApiServer { Url = baseUrl };

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Azure.Functions.Worker.Extensions.OpenApi.Functions;
using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Abstractions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;

using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Internal;
Expand All @@ -15,10 +16,44 @@ namespace Microsoft.Azure.Functions.Worker.Extensions.OpenApi.Extensions
public static class OpenApiHttpRequestDataExtensions
{
/// <summary>
/// Gets the <see cref="QueryCollection"/> instance from the <see cref="HttpRequestData"/>.
/// Gets the <see cref="IHeaderDictionary"/> instance from the <see cref="HttpRequestData"/>.
/// </summary>
/// <param name="req"><see cref="HttpRequestData"/> instance.</param>
/// <returns>Returns <see cref="QueryCollection"/> instance.</returns>
/// <returns>Returns <see cref="IHeaderDictionary"/> instance.</returns>
public static IHeaderDictionary Headers(this HttpRequestData req)
{
req.ThrowIfNullOrDefault();

var headers = req.Headers.ToDictionary(p => p.Key, p => new StringValues(p.Value.ToArray()));
if (headers.IsNullOrDefault() || headers.Any() == false)
{
headers = new Dictionary<string, StringValues>();
}

return new HeaderDictionary(headers);
}

/// <summary>
/// Gets the <see cref="StringValues"/> object from the header of <see cref="HttpRequestData"/>.
/// </summary>
/// <param name="req"><see cref="HttpRequestData"/> instance.</param>
/// <param name="key">Header key.</param>
/// <returns>Returns <see cref="StringValues"/> object.</returns>
public static StringValues Header(this HttpRequestData req, string key)
{
req.ThrowIfNullOrDefault();

var headers = Headers(req);
var value = headers.ContainsKey(key) ? headers[key] : new StringValues(default(string));

return value;
}

/// <summary>
/// Gets the <see cref="IQueryCollection"/> instance from the <see cref="HttpRequestData"/>.
/// </summary>
/// <param name="req"><see cref="HttpRequestData"/> instance.</param>
/// <returns>Returns <see cref="IQueryCollection"/> instance.</returns>
public static IQueryCollection Queries(this HttpRequestData req)
{
req.ThrowIfNullOrDefault();
Expand All @@ -33,7 +68,7 @@ public static IQueryCollection Queries(this HttpRequestData req)
}

/// <summary>
/// Gets the <see cref="StringValues"/> object from the <see cref="HttpRequestData"/>.
/// Gets the <see cref="StringValues"/> object from the querystring of <see cref="HttpRequestData"/>.
/// </summary>
/// <param name="req"><see cref="HttpRequestData"/> instance.</param>
/// <param name="key">Querystring key.</param>
Expand Down
Loading