yuka1984 / azure-functions-extensions-swashbuckle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

QueryStringParameter is Mispelled and also breaks the swagger definition

SpicySyntax opened this issue · comments

First off I wanted to say how thankful I am you are working on this. I was able to get up and running quite easily and everything seems to be working well. However, I have noticed some issues.
First: 'QueryStringParamater' is mis-spelled and should be 'QueryStringParameter'
Second: When I use it it breaks my swagger definition.

To reproduce just add an annotation like '[QueryStringParamater("jobId", "Id of Job you are deleting.", Required = true)]' to a function then the azure logs give:
'[7/11/2019 8:42:58 PM] Executed 'Swagger' (Failed, Id=10b20162-2910-43b3-a9cb-4f99db00efe9)
[7/11/2019 8:42:58 PM] System.Private.CoreLib: Exception while executing function: Swagger. Swashbuckle.AspNetCore.SwaggerGen: Object reference not set to an instance of an
object.'

And the swagger UI endpoint yields: 'No API definition provided.'

Once this is fixed an available on Nuget I would happily start using this in my azure function projects. Thanks for you work!

So if you drill down in the code. You will see that there is no check for null and no default specified for the Property DataType. So in the QueryStringParameterAttributeFilter.cs file on line 26, this will error out
Type = context.SchemaRegistry.GetOrRegister(attribute.DataType).Type . So for all intends and purpose DataType is required for the Attribute

@MrBMills After adding this the query param definition works. Maybe for clarity sake, adding the DataType as a Constructor param would make it more explicit that it is required. Other than that, as long as the spelling is corrected on the next release this issue can be closed.

Best

Any plans for this issue fix?