Skip to content

Commit

Permalink
#9 breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
yuka-abn committed Dec 14, 2019
1 parent d256beb commit fa73019
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Expand Up @@ -5,9 +5,9 @@
namespace AzureFunctions.Extensions.Swashbuckle.Attribute
{
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = true)]
public class QueryStringParamaterAttribute : System.Attribute
public class QueryStringParameterAttribute : System.Attribute
{
public QueryStringParamaterAttribute(string name, string description)
public QueryStringParameterAttribute(string name, string description)
{
Name = name;
Description = description;
Expand Down
Expand Up @@ -14,7 +14,7 @@ public void Apply(Operation operation, OperationFilterContext context)
{
var attributes = context.MethodInfo.DeclaringType.GetCustomAttributes(true)
.Union(context.MethodInfo.GetCustomAttributes(true))
.OfType<QueryStringParamaterAttribute>();
.OfType<QueryStringParameterAttribute>();

foreach (var attribute in attributes)
operation.Parameters.Add(new NonBodyParameter
Expand All @@ -23,7 +23,7 @@ public void Apply(Operation operation, OperationFilterContext context)
Description = attribute.Description,
In = "query",
Required = attribute.Required,
Type = context.SchemaRegistry.GetOrRegister(attribute.DataType).Type
Type = context.SchemaRegistry.GetOrRegister(attribute.DataType ?? typeof(string)).Type
});
}
}
Expand Down
Expand Up @@ -27,7 +27,7 @@ public class TestController
/// <returns>すべてのテスト</returns>
[ProducesResponseType(typeof(TestModel[]), (int)HttpStatusCode.OK)]
[FunctionName("TestGets")]
[QueryStringParamater("expand", "it is expand parameter", DataType = typeof(int))]
[QueryStringParameter("expand", "it is expand parameter", DataType = typeof(int))]
public async Task<IActionResult> Gets([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "test")] HttpRequest request)
{
return new OkObjectResult(new[] {new TestModel(), new TestModel(),});
Expand All @@ -54,6 +54,7 @@ public async Task<IActionResult> Gets([HttpTrigger(AuthorizationLevel.Anonymous,
/// <param name="id">テストId</param>
/// <returns>指定されたテスト</returns>
[ProducesResponseType(typeof(TestModel), (int)HttpStatusCode.OK)]
[QueryStringParameter("name", "this is name", DataType = typeof(string), Required = true)]
[FunctionName("TestGetCat")]
public Task<IActionResult> GetCat([HttpTrigger(AuthorizationLevel.Function, "get", Route = "cat/{id}/{testId?}")]
HttpRequest request, int id, int? testId)
Expand All @@ -79,6 +80,7 @@ public Task<IActionResult> Add([HttpTrigger(AuthorizationLevel.Anonymous, "post"
/// <param name="testModel">テストモデル</param>
/// <returns>追加結果</returns>
[ProducesResponseType(typeof(TestModel), (int)HttpStatusCode.Created)]
[QueryStringParameter("test", "test", Required = false)]
[FunctionName("TestAddGet")]
public async Task<IActionResult> AddAndGet([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "testandget")]HttpRequest httpRequest)
{
Expand Down

0 comments on commit fa73019

Please sign in to comment.