Skip to content
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

Added ability to add parameter description attributes #1202

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

jsheely
Copy link

@jsheely jsheely commented Dec 8, 2017

There was no way to add descriptions to query param without using XML comments.

@heldersepu
Copy link
Contributor

Some unit tests will be nice...

@jsheely
Copy link
Author

jsheely commented Dec 11, 2017

Ref work done in AspNetCore version domaindrivendev/Swashbuckle.AspNetCore#554

@heldersepu
Copy link
Contributor

heldersepu commented Dec 11, 2017

@jsheely
I Like the unit test, nicely done!
But why SwaggerDescriptionAttribute? I liked it better the way you had it before...

@jsheely
Copy link
Author

jsheely commented Dec 12, 2017

After thinking about it using System.ComponentModel.DescriptionAttribute felt like overloading that attribute. This way it fits better with all the other swagger specific attributes. I wouldn't want there to be a situation where someone wanted to use [Description] for a model property in the UI but have a different description in the API.

Perhaps there could be an option to enable using [Description] for anyone who wants that.

@jsheely
Copy link
Author

jsheely commented Dec 22, 2017

Here is a good reason to use [SwaggerDescription] instead of [Description]. Now I can add summary to the heading of each method.

@heldersepu
Copy link
Contributor

See the build log:

Swagger\SchemaExtensions.cs(57,41): error CS1525: Invalid expression term '.' [C:\projects\swashbuckle\Swashbuckle.Core\Swashbuckle.Core.csproj]
Swagger\SchemaExtensions.cs(57,42): error CS1003: Syntax error, ':' expected [C:\projects\swashbuckle\Swashbuckle.Core\Swashbuckle.Core.csproj]
Done Building Project "C:\projects\swashbuckle\Swashbuckle.Core\Swashbuckle.Core.csproj" (default targets) -- FAILED.
The target "_ConvertPdbFiles" listed in a BeforeTargets attribute at "C:\Program Files

@heldersepu
Copy link
Contributor

I think the compiler does not like your short syntax:
schema.description = attrib?.Description;

@jsheely
Copy link
Author

jsheely commented Dec 22, 2017

Any idea how to update the AppVeyor compiler to do the right thing? I'd rather not have to change the operator. I really like the null check operator.

@heldersepu
Copy link
Contributor

What version of Visual Studio are you using?
This project shows 2013 on the solution:
https://github.com/domaindrivendev/Swashbuckle/blob/master/Swashbuckle.sln

I don't think that was available back then...

@jsheely
Copy link
Author

jsheely commented Dec 25, 2017

Well I made the build work. But I have no idea why appVeyor doesn't build the same way as it does locally. Should be using Visual Studio 2017.

@Liero
Copy link

Liero commented Jan 15, 2018

But I have no idea why appVeyor doesn't build the same way as it does locally. Should be using Visual Studio 2017.

I recommend to explicitly set C# language version in project properties -> build -> advanced. The default settings uses latest available C# version. which depends on version of Visual Studio you (or the build server) are using.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants