-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[C#] Support Asp.net core 2.1 #999
Comments
@SeanFarrow thanks for offering help to improve this project. To exclude files, have you considered using .openapi-generator-ignore files to prevent files from being overwritten/generated?
Whether authorization is required depends on the OpenAPI specification. We can consider authorization as a day 2 requirement. Have you tried the We can add an option to support ASP.Net Core 2.1 if 2.1 does not introduce a lot of changes. |
@wing328<https://github.com/wing328>
Microsoft changed the packages they recommend with asp.net core 2.1, plus there are some things within the asp.net core ecosystem in the future we may want to support (I’m thinking specifically about health checks).
If I create a blank asp.net core 2.1 project, what is the best way of allowing us to integrate this?
Within the current generater, the Microsoft.AspNetCore.All package is included which includes everything including things like database access, to my mind it’s up to a user whether they want that.
Also, supporting asp.net core 2.1 and by extension .net Core 2.1 would give some nice performance improvements.
From: William Cheng <notifications@github.com>
Sent: 09 September 2018 11:54
To: OpenAPITools/openapi-generator <openapi-generator@noreply.github.com>
Cc: Sean Farrow <sean.farrow@seanfarrow.co.uk>; Mention <mention@noreply.github.com>
Subject: Re: [OpenAPITools/openapi-generator] [C#] Support Asp.net core 2.1 (#999)
@SeanFarrow<https://github.com/SeanFarrow> thanks for offering help to improve this project.
To exclude files, have you considered using .openapi-generator-ignore files to prevent files from being overwritten/generated?
I'm assuming the starting point of an API with no authorization specified.
Whether authorization is required depends on the OpenAPI specification. We can consider authorization as a day 2 requirement.
Have you tried the aspnetcore generator? Does the output meet your requirement?
We can add an option to support ASP.Net Core 2.1 if 2.1 does not introduce a lot of changes.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#999 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABY1fnwFO4kvns4zoqteGCF62XLfeXZNks5uZPM7gaJpZM4WgOig>.
|
@SeanFarrow thanks for the details. Sounds like we should support 2.1 directly and drop the support for 2.0. @jimschubert @mandrean do you have an option on this topic? |
@wing328,
As well as everything I’ve previously mentioned, 2.1 provides the capability to support open api through attributes directly.
Perhaps we should allow a user to specify a version when generating the code?
Is this something that would be feasible?
From: William Cheng <notifications@github.com>
Sent: 09 September 2018 15:44
To: OpenAPITools/openapi-generator <openapi-generator@noreply.github.com>
Cc: Sean Farrow <sean.farrow@seanfarrow.co.uk>; Mention <mention@noreply.github.com>
Subject: Re: [OpenAPITools/openapi-generator] [C#] Support Asp.net core 2.1 (#999)
@SeanFarrow<https://github.com/SeanFarrow> thanks for the details. Sounds like we should support 2.1 directly and drop the support for 2.0.
@jimschubert<https://github.com/jimschubert> @mandrean<https://github.com/mandrean> do you have an option on this topic?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#999 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABY1frMLAli3TYv6RrtyWovcKJe98zyzks5uZSkXgaJpZM4WgOig>.
|
Yup, that's usually what we do. We can add an option "aspNetCoreVersion" to support future version (e.g. 2.2, 2.3, etc). |
@SeanFarrow as a starting point, what about updating the templates in https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/aspnetcore to make it work with ASP.net core 2.1 ? |
@wing328, |
Yup, we can deal with those later as it should not be difficult to skip with a CLI option. |
Ok,I’ll work on that today/tomorrow.
Does the C# generator support authorization, or is that something we need to add later?
Finally, is there a sample spec I can use to generate code to check the template is working as expected?
From: William Cheng <notifications@github.com>
Sent: 10 September 2018 03:54
To: OpenAPITools/openapi-generator <openapi-generator@noreply.github.com>
Cc: Sean Farrow <sean.farrow@seanfarrow.co.uk>; Mention <mention@noreply.github.com>
Subject: Re: [OpenAPITools/openapi-generator] [C#] Support Asp.net core 2.1 (#999)
then look at other things later, like the fact that if UseSwashbuckle is not specified
Yup, we can deal with those later as it should not be difficult to skip with a CLI option.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#999 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABY1fpna5S5fRj2s2mvNsX7dW7OVAYO3ks5uZdQqgaJpZM4WgOig>.
|
Seems like there's no authorization support at the moment as I couldn't find the mustache tag |
Ok,that’s whatI thought, but just wanted to check.
From: William Cheng <notifications@github.com>
Sent: 10 September 2018 05:35
To: OpenAPITools/openapi-generator <openapi-generator@noreply.github.com>
Cc: Sean Farrow <sean.farrow@seanfarrow.co.uk>; Mention <mention@noreply.github.com>
Subject: Re: [OpenAPITools/openapi-generator] [C#] Support Asp.net core 2.1 (#999)
Seems like there's no authorization support at the moment as I couldn't find the mustache tag authMethods in https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/aspnetcore
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#999 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABY1fugzQ5wBqypT2rZ4OyRuU4KFYWaaks5uZevegaJpZM4WgOig>.
|
@SeanFarrow we can work with you to add the authorization support later (which should be pretty straightforward) |
@wing328, |
Sure as Swashbuckle 3.0.0 also contains breaking changes: https://github.com/domaindrivendev/Swashbuckle.AspNetCore/releases/tag/v3.0.0
It's scheduled on coming Friday so we'll definitely include it if it's ready by that time. |
Ok, should be able to get a pr out by the end of the day.
How do I generate a pet store sample server, so I can test the changes quickly? I’m running on Windows.
From: William Cheng <notifications@github.com>
Sent: 10 September 2018 08:42
To: OpenAPITools/openapi-generator <openapi-generator@noreply.github.com>
Cc: Sean Farrow <sean.farrow@seanfarrow.co.uk>; Mention <mention@noreply.github.com>
Subject: Re: [OpenAPITools/openapi-generator] [C#] Support Asp.net core 2.1 (#999)
Sure as Swashbuckle 3.0.0 also contains breaking changes: https://github.com/domaindrivendev/Swashbuckle.AspNetCore/releases/tag/v3.0.0
I'm assuming this will ship in v3.3.0 of the generator?
It's scheduled on this coming Friday so we'll definitely include it if it's ready by that time.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#999 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABY1fkHMzKMYFnaZxeEOWCWPv8ja1ET8ks5uZhewgaJpZM4WgOig>.
|
To update the petstore sample, please run |
Ok, I can’t seem to find that bat file.
Everything seems to build though.
I’ll submit a pr in the next few hours.
From: William Cheng <notifications@github.com>
Sent: 10 September 2018 15:47
To: OpenAPITools/openapi-generator <openapi-generator@noreply.github.com>
Cc: Sean Farrow <sean.farrow@seanfarrow.co.uk>; Mention <mention@noreply.github.com>
Subject: Re: [OpenAPITools/openapi-generator] [C#] Support Asp.net core 2.1 (#999)
To update the petstore sample, please run bin\windows\aspnetcore-petstore-server.bat at the root folder of this project.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#999 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABY1frUJPk6WJoKioKNP8FRzLSx3DOmkks5uZntwgaJpZM4WgOig>.
|
Here is the URL to the batch file: https://github.com/OpenAPITools/openapi-generator/blob/master/bin/windows/aspnetcore-petstore-server.bat |
Ok, got, give me an hour or so to update the sample.
From: William Cheng <notifications@github.com>
Sent: 10 September 2018 16:51
To: OpenAPITools/openapi-generator <openapi-generator@noreply.github.com>
Cc: Sean Farrow <sean.farrow@seanfarrow.co.uk>; Mention <mention@noreply.github.com>
Subject: Re: [OpenAPITools/openapi-generator] [C#] Support Asp.net core 2.1 (#999)
Here is the URL to the batch file: https://github.com/OpenAPITools/openapi-generator/blob/master/bin/windows/aspnetcore-petstore-server.bat
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#999 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABY1frEaSmKHYYd7xPod6P6exhLEDU01ks5uZop_gaJpZM4WgOig>.
|
Please take your time. Let us know if you need any help. |
Ok, I’m happy this end.
Do you want commits squashed into a single commit?
Cheers
Sean.
From: William Cheng <notifications@github.com>
Sent: 10 September 2018 17:07
To: OpenAPITools/openapi-generator <openapi-generator@noreply.github.com>
Cc: Sean Farrow <sean.farrow@seanfarrow.co.uk>; Mention <mention@noreply.github.com>
Subject: Re: [OpenAPITools/openapi-generator] [C#] Support Asp.net core 2.1 (#999)
Please take your time. Let us know if you need any help.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#999 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABY1fpyNmeDRDsJyCFPKRrvoHsB9ua2tks5uZo4KgaJpZM4WgOig>.
|
Nope, we'll squash your commits into one as part of the merge. |
To comment on this as far as ASP.NET Core 2.1, I'd prefer to just update fully to 2.1 and not leave support for 2.0. 2.1 is LTS while 2.0 is not, so I don't see a reason for us to maintain a 2.0 option. I wouldn't consider this a breaking change as the generator isn't currently written with an intention to regenerate over existing code. .NET Core 2.0 will end-of-life at the end of this month. |
@jimschubert thanks for reviewing this. After I reviewed #1008 (only changes to mustache templates), I would suggest adding an option to select the framework with ASP.NET core 2.1 being the default and we'll mark 2.0 as deprecated so that we can remove it in the future release. That way we can merge the enhancement into 3.3.x branch targeted to be released this Friday. |
@jimschubert,
That’s exactly what I was thinking. I’ve upgraded everything to Asp.Net Core 2.1.
From: Jim Schubert <notifications@github.com>
Sent: 10 September 2018 23:02
To: OpenAPITools/openapi-generator <openapi-generator@noreply.github.com>
Cc: Sean Farrow <sean.farrow@seanfarrow.co.uk>; Mention <mention@noreply.github.com>
Subject: Re: [OpenAPITools/openapi-generator] [C#] Support Asp.net core 2.1 (#999)
To comment on this as far as ASP.NET Core 2.1, I'd prefer to just update fully to 2.1 and not leave support for 2.0. 2.1 is LTS while 2.0 is not, so I don't see a reason for us to maintain a 2.0 option. I wouldn't consider this a breaking change as the generator isn't currently written with an intention to regenerate over existing code.
.NET Core 2.0 will end-of-life at the end of this month.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#999 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABY1fgO0slWKWS31Kbai3m5RGjnZtzzBks5uZuFBgaJpZM4WgOig>.
|
@wing328,
What do I need to do to make that happen, I’m assuming this will need updates to the generater? Therefore should we do this as a separate issue/pr?
Could we do this after Friday, given that 2.2 will be coming later this year, so it would make sense then.
If we did this after Friday, could we still merge the template changes for 2.1 for Friday?
From: William Cheng <notifications@github.com>
Sent: 11 September 2018 03:16
To: OpenAPITools/openapi-generator <openapi-generator@noreply.github.com>
Cc: Sean Farrow <sean.farrow@seanfarrow.co.uk>; Mention <mention@noreply.github.com>
Subject: Re: [OpenAPITools/openapi-generator] [C#] Support Asp.net core 2.1 (#999)
@jimschubert<https://github.com/jimschubert> thanks for reviewing this.
After I reviewed #1008<#1008> (only changes to mustache templates), I would suggest adding an option to select the framework with ASP.NET core 2.1 being the default and we'll mark 2.0 as deprecated so that we can remove it in the future release. That way we can merge the enhancement into 3.3.x branch targeted to be released this Friday.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#999 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABY1forI76tGI8JxIIPTN8_7F7yRLMvMks5uZxz3gaJpZM4WgOig>.
|
@SeanFarrow I can add it after merging your PR (as I just did something similar for another enhancement related to Java Feign version upgrade) |
@wing328,
I’m happy to do the work, as it gives me more exposure to Java, I’d just need to understand what would be required.
From: William Cheng <notifications@github.com>
Sent: 11 September 2018 03:48
To: OpenAPITools/openapi-generator <openapi-generator@noreply.github.com>
Cc: Sean Farrow <sean.farrow@seanfarrow.co.uk>; Mention <mention@noreply.github.com>
Subject: Re: [OpenAPITools/openapi-generator] [C#] Support Asp.net core 2.1 (#999)
@SeanFarrow<https://github.com/SeanFarrow> I can add it after merging your PR (as I just did something similar for another enhancement related to Java Feign version upgrade)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#999 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABY1fvnG-NLhvY8Fy7K7qSHzahxRSeCPks5uZyRqgaJpZM4WgOig>.
|
@SeanFarrow sure, you will need to add a CLI option (e.g. aspNetCoreVersion) to support "2.0", "2.1" and put the templates (the existing one for v2.0) in a separate folder. We'd a very similar change for Dart to support Dart v2 recently and https://github.com/OpenAPITools/openapi-generator/pull/754/files#diff-79347eb38a35fa462a0c2b03aa771e75R129 is a good starting point. Please let me know if you need help adding the option. |
@wing328,
That sounds doable.
I’ll do this either later in the week or this weekend, if that works for you given the release on Friday?
From: William Cheng <notifications@github.com>
Sent: 11 September 2018 04:02
To: OpenAPITools/openapi-generator <openapi-generator@noreply.github.com>
Cc: Sean Farrow <sean.farrow@seanfarrow.co.uk>; Mention <mention@noreply.github.com>
Subject: Re: [OpenAPITools/openapi-generator] [C#] Support Asp.net core 2.1 (#999)
@SeanFarrow<https://github.com/SeanFarrow> sure, you will need to add a CLI option (e.g. aspNetCoreVersion) to support "2.0", "2.1" and put the templates (the existing one for v2.0) in a separate folder. We'd a very similar change for Dart to support Dart v2 recently and https://github.com/OpenAPITools/openapi-generator/pull/754/files#diff-79347eb38a35fa462a0c2b03aa771e75R129 is a good starting point.
Please let me know if you need help adding the option.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#999 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABY1fj-3Omy_9O4b2WjgWOjd17xVoTPMks5uZye0gaJpZM4WgOig>.
|
@SeanFarrow if we (you or me) add it after the minor release (3.3.x) this Friday, we may need to wait for 2 months as we plan to change the minor release schedule to bi-monthly: #956 |
@wing328,
OK, given my currently available time this week, it’s probably best you tackle this, sorry!
From: William Cheng <notifications@github.com>
Sent: 11 September 2018 05:02
To: OpenAPITools/openapi-generator <openapi-generator@noreply.github.com>
Cc: Sean Farrow <sean.farrow@seanfarrow.co.uk>; Mention <mention@noreply.github.com>
Subject: Re: [OpenAPITools/openapi-generator] [C#] Support Asp.net core 2.1 (#999)
@SeanFarrow<https://github.com/SeanFarrow> if we (you or me) add it after the minor release (3.3.x) this Friday, we may need to wait for 2 months as we plan to change the minor release schedule to bi-monthly: #956<#956>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#999 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABY1fu66pBExeixfeRmRX1R1edxKebaoks5uZzXQgaJpZM4WgOig>.
|
No worry. I'll do it later today and keep you posted. |
I've updated #1008 with the option "aspnetCoreVersion" (default to 2.1). Please have a look when you've time. |
@wing328,
This looks good, can we close/merge? Have the docs been updated?
From: William Cheng <notifications@github.com>
Sent: 11 September 2018 10:33
To: OpenAPITools/openapi-generator <openapi-generator@noreply.github.com>
Cc: Sean Farrow <sean.farrow@seanfarrow.co.uk>; Mention <mention@noreply.github.com>
Subject: Re: [OpenAPITools/openapi-generator] [C#] Support Asp.net core 2.1 (#999)
I've updated #1008<#1008> with the option "aspnetCoreVersion" (default to 2.1). Please have a look when you've time.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#999 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABY1fhCYKH28t177I4aMVXy-AxVVzEemks5uZ4M0gaJpZM4WgOig>.
|
@SeanFarrow PR merged. Thanks for your PR. Do you have a Twitter account? We'll promote the enhancement via https://twitter.com/oas_generator I'll update the documentation later if needed. |
@wing328,
No problem, I’ve just followed that account. My twitter handle is @SeanRFarrow
From: William Cheng <notifications@github.com>
Sent: 12 September 2018 11:43
To: OpenAPITools/openapi-generator <openapi-generator@noreply.github.com>
Cc: Sean Farrow <sean.farrow@seanfarrow.co.uk>; Mention <mention@noreply.github.com>
Subject: Re: [OpenAPITools/openapi-generator] [C#] Support Asp.net core 2.1 (#999)
@SeanFarrow<https://github.com/SeanFarrow> PR merged. Thanks for your PR.
Do you have a Twitter account? We'll promote the enhancement via https://twitter.com/oas_generator
I'll update the documentation later if needed.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#999 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABY1frLL3V90nsZOdnPNufNHho-LsbiPks5uaOVBgaJpZM4WgOig>.
|
👌 |
Tweet: https://twitter.com/oas_generator/status/1039932534258167808 Please help retweet to promote the enhancement |
It would be nice if the generator supported Asp.Net Core 2.1.
I'm happy to do the work for this, but have a few questions:
Firstly, is there a way to completely exclude files from the output if they are not needed. The case where SwashBuckle is not included is the example I'm thinking of, so we should probably exclude wwroot.
Secondly, how does the generator indicate that authorization is needed on an endpoint to the code that generates files from the templates. I'm assuming the starting point of an API with no authorization specified.
Thanks for any help.
Sean.
Description
openapi-generator version
OpenAPI declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
The text was updated successfully, but these errors were encountered: