Тёмный

NSwag - SWAGGER For ASP.NET CORE and AUTOMATIC Type Generation For TypeScript | 

Rahul Nath
Подписаться 32 тыс.
Просмотров 23 тыс.
50% 1

Hey Friends, "The OpenAPI Specification, originally known as the Swagger Specification,
is a specification for machine-readable interface files for describing, producing,
consuming, and visualizing RESTful web services"
In this video, I will walk you through on how to set up an OpenAPI spec (Swagger endpoint) for your ASP.NET
Core Web API, using NSwag. NSwag provides tools to generate OpenAPI specs and generate
client code to consume these APIs. I will also show how to automatically generate typescript clients and types to consume the API using MSBuild tasks. Every time we build the
project (csproj), it will automatically generate the associated typescript types from the
Data Transfer Objects (DTO) used in the API Controllers.
This allows us to easily integrate our front-end application without backend APIs, giving us
full type safety. Any time we update our DTO's it will also show the associated errors in our
frontend code right at compile time.
🔗 Source - rahulpnath.visualstudio.com/D...
🔗 NSwag - github.com/RicoSuter/NSwag
🔗 NSwag Studio - github.com/RicoSuter/NSwag/wi...
🔗 NSwag Msbuild - github.com/RicoSuter/NSwag/wi...
Come say hi! ✋
🌍 Blog - rahulpnath.com/
✉ Subscribe to my Newsletter - www.rahulpnath.com/subscribe
🐦Twitter - / rahulpnath
📸Instagram - / rahulpnath
🎥 Recording Setup and Workflow - www.rahulpnath.com/blog/youtu...
Make sure to SUBSCRIBE to the channel. THANK YOU for helping me grow this channel !!

Хобби

Опубликовано:

 

30 июн 2020

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 98   
@bigchunk1
@bigchunk1 3 года назад
My man! You explained this better than anyone else I could find! So many incomplete explanations, but you just walk us through it. Thank you!
@RahulNath
@RahulNath 3 года назад
Awesome, glad it helped!
@ofnoisealteredtastes6637
@ofnoisealteredtastes6637 2 года назад
This was an excellent walkthrough. You addressed many potential areas of confusion and your explanation was thorough but perfectly concise. Will be coming back to reference as I adopt NSwag myself, thank you!
@RahulNath
@RahulNath 2 года назад
Glad you enjoyed it!
@2cool238
@2cool238 3 года назад
Ok, you took the throne. You are the new boss of making much needed tutorials
@RahulNath
@RahulNath 3 года назад
Lovely, thanks! 😀
@jamesthompson2122
@jamesthompson2122 3 года назад
This is the third video of yours I've watched....very clear and concise, like the other two. Well done Rahul
@RahulNath
@RahulNath 3 года назад
Thank you James. You've made my day and a great Monday start 😀 I am sure you'll like the other videos in the ASP NET Core Series. ru-vid.com/group/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP Thank you again for letting me know
@k7raman
@k7raman 2 года назад
quality content . Thank you Rahul. it is easy to brush my skills in .net in which I developed more than a year ago. Not a single second of video is waste. I appreciate that you've respected the viewers to provide "To the point" information.
@k7raman
@k7raman 2 года назад
kudos for sharing shortcuts of IDE also.
@RahulNath
@RahulNath 2 года назад
Thank you and happy you find it useful. Do check out the full series here bit.ly/asp-net-core-series. Let me know how you find it!
@k7raman
@k7raman 2 года назад
@@RahulNath RU-vid itself recommended. I found your videos in the feed.
@RahulNath
@RahulNath 2 года назад
@@k7raman Hope you find it useful!
@chadhawley569
@chadhawley569 3 года назад
Very clear. Great job on this one!
@RahulNath
@RahulNath 3 года назад
Thanks Chad!
@maurobilotti
@maurobilotti 3 года назад
Incredible tutorial! Worked like a charm!!
@RahulNath
@RahulNath 3 года назад
Great to hear!
@starman9000
@starman9000 3 года назад
Another addition for knowledge base to improve! great work! I would like to see CI/CD with Git - TeamCity - Docker - Octopus as well!! Sorry huge list!!! I am addicted to your content, easy to digest!
@RahulNath
@RahulNath 3 года назад
I plan to do one with docker and DevOps. The trouble with TeamCity is I need to set this up on VM or my laptop. I will do one with OctopusDeploy some time (but can’t guarantee when)
@ognjenvojnovic9778
@ognjenvojnovic9778 3 года назад
You did so great job it looks like a piece of cake ... well done!
@RahulNath
@RahulNath 3 года назад
Thanks so much 😊
@mohammadalinia
@mohammadalinia 2 года назад
This was really helpful and easy to follow Rahul. I loved the extra tips on how you can avoid code generation on your pipelines. Thank you!
@RahulNath
@RahulNath 2 года назад
Glad it was helpful! And great to see you comment here 😀
@dand4485
@dand4485 4 года назад
Oooops you did it again, so I have to say Excellent job again :)
@RahulNath
@RahulNath 4 года назад
Thank you the encouragement - It really helps! Do let know if you have any particular videos that you would like to see here. 😀
@nat-moba
@nat-moba 3 года назад
Finally a step by step tutorial thank u \m/ the official documentation is confusing as hell
@RahulNath
@RahulNath 3 года назад
Thank you Ricardo and happy it helped you. You might find other interesting videos in my ASP NET Series here ru-vid.com/group/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP
@elpiruwebmaster
@elpiruwebmaster Год назад
Muchas gracias, fue de muchas utilidad, las aclaraciones hechas ayudaron a configurar un caso con distintas configuraciones
@RahulNath
@RahulNath Год назад
Thank you!
@techrelated2417
@techrelated2417 3 года назад
Awsome explaination !!! Simply the best!!
@RahulNath
@RahulNath 3 года назад
Awesome! Glad you like it 😀
@TonoNamnum
@TonoNamnum 2 года назад
This is Amazing! Wish I had seen your videos before.
@RahulNath
@RahulNath 2 года назад
Glad it was helpful Antonio. Hope you are liking the full series bit.ly/asp-net-core-series
@samuellepage3975
@samuellepage3975 3 года назад
Thanks for the tutorial, helped me at work :)
@RahulNath
@RahulNath 3 года назад
Great to hear Samuel. Do check out the full series here ru-vid.com/group/PL59L9XrzUa-nqfCHIKazYMFRKapPNI4sP I'm sure you like them 😉
@DavidReidChannel
@DavidReidChannel 2 года назад
Hi Rahul, this was extremely helpful. Great video, keep up the good work and thanks for sharing this with us.
@RahulNath
@RahulNath 2 года назад
Great to hear that David. Do check the full series here bit.ly/asp-net-core-series I am sure you will like it!
@promal2006
@promal2006 2 года назад
Excellent video!!!!
@RahulNath
@RahulNath 2 года назад
Glad you liked it! Do check out the full ASP NET Series here in case you haven't bit.ly/asp-net-core-series
@triyuga
@triyuga 4 года назад
Amazing coincidence! One of my colleagues just implemented swagger in a new project at work...
@RahulNath
@RahulNath 4 года назад
Yeah such a conincidence that we work together 😀
@highwaybird
@highwaybird 8 месяцев назад
Very helpful!
@RahulNath
@RahulNath 8 месяцев назад
Glad it was helpful! Do check out the series bit.ly/asp-net-core-series
@jessegador
@jessegador 2 года назад
Very helpful. Thank you.
@RahulNath
@RahulNath 2 года назад
Glad it was helpful Jesse. Do check out my ASP NET Core series!
@PeterParker-nh9di
@PeterParker-nh9di 3 года назад
Awesome tutorial! Would love to see how your CI/CD pipeline works for an aspnetcore, typescript react app
@RahulNath
@RahulNath 3 года назад
Thanks Peter and glad you like it. I don’t have one that covers ASP NET Core and react app. I might do it as a live stream (to save time on editing) 😀 I will post back link here once I do it.
@RajaSingh012
@RajaSingh012 3 года назад
Thanks for the video. It is useful
@RahulNath
@RahulNath 3 года назад
Glad it was helpful!
@TonyGrayCanada
@TonyGrayCanada Год назад
Really clear and to the point, excellent work. Unfortunately for me nSwag studio just hangs or crashes on my project and never generates anything.
@abijithmv3739
@abijithmv3739 Год назад
Great video bro
@RahulNath
@RahulNath Год назад
Thank you Abijith- Hope you are liking the full ASP Series bit.ly/asp-net-core-series
@BarbarosYurttagul
@BarbarosYurttagul 7 месяцев назад
I hit the like button. Thanks
@RahulNath
@RahulNath 7 месяцев назад
Glad you liked it. Do checkout the ASP Series bit.ly/asp-net-core-series
@vikranthreddy1863
@vikranthreddy1863 Год назад
Great content. Feel free to blink more in your videos. :)
@RahulNath
@RahulNath Год назад
Glad you like it Vikranth and thank you for the permission. I will from now on 😂Working on my camera presence, guessing the newer videos are different. Do check the full series here bit.ly/asp-net-core-series
@manasipalkar9794
@manasipalkar9794 4 месяца назад
Hi Rahul , thanks it was an amazing explanation. Can we do it for angular typescript and using Nswag should be mandatory?
@daviad9832
@daviad9832 2 года назад
your explanation was top notch
@RahulNath
@RahulNath 2 года назад
Glad you liked it. Do check out my full series here bit.ly/asp-net-core-series. I am sure you will like it. Let me know in case you get to watch any!
@daviad9832
@daviad9832 2 года назад
@@RahulNath I have already started that series, it is great. I really appreciate it
@RahulNath
@RahulNath 2 года назад
@@daviad9832 Glad you are liking it. Do let me know in case you have any topic suggestions!
@AxeFinance-wm1cp
@AxeFinance-wm1cp 10 месяцев назад
I created two project nets 6, first with nswag and second with Swashbuckle, and created a project angular, I don't find any differences
@akirablac
@akirablac Год назад
Great video. Your teaching style is awesome. Can you please do the series on .Net Web API unit & integration testing?? Thanks
@RahulNath
@RahulNath Год назад
Thank you Akira. I’ve a playlist here on testing if that helps ru-vid.com/group/PL59L9XrzUa-lWi02jkBID4a853wypd2sW Also do check out the ASP Series
@dhirajpandeydhirjpndy
@dhirajpandeydhirjpndy 3 года назад
Thanks for the detailed video on swagger. One question related to TS support in this spa template, How can we add typescript here. Is it something we have to explicitly do with CRA and replace the content in clientApp folder?
@RahulNath
@RahulNath 3 года назад
You can either update the create react app to support typescript as mentioned in the post here create-react-app.dev/docs/adding-typescript/ Or you can delete all the contents in ClientApp folder and create a brand new create react app with typescript support create-react-app.dev/docs/getting-started/#creating-a-typescript-app Let know if that helps Dhiraj.
@cindy3661
@cindy3661 4 года назад
Nice one.
@RahulNath
@RahulNath 4 года назад
Thanks!
@pvchio
@pvchio 3 года назад
this is excellent and clear. Thank you. I have a question. What if you are working on an enterprise application and there are tons of controllers, do you also put all type definitions in one file? thanks
@RahulNath
@RahulNath 3 года назад
Glad it was helpful Charlie. I don't mind putting it in one file, since this is generated code. Unless if there is a reason for it to be in separate files. Are you looking at any particular use cases here?
@pvchio
@pvchio 3 года назад
@@RahulNath thanks for the quick reply. Hypothetically, there could be name collision if my frontend app talks to two different api solutions. E.g. solution A has a FooModel with three fields, and solution B also has a FooModel but with only two fields. In that case, how can NSwag handle it when generating the types? or it will never be that case? Thanks
@RahulNath
@RahulNath 3 года назад
@@pvchio There is a related issue here which speaks of a similar problem. Looks like this is not yet fully supported - github.com/RicoSuter/NSwag/issues/828. I have not run into this specific issue.
@KCAbramson
@KCAbramson Год назад
Great tutorial thanks. I have a Q. Why do you write your own api methods instead of using nswag? Seems like so much work that could be 1-button automated.
@RahulNath
@RahulNath Год назад
I wasn't aware of this feature or probably it wasn't available back when I recorded this video. But yes that if that helps to speed up the whole process do use that. Thank you for pointing it out here 👍👍
@pedroferreira9234
@pedroferreira9234 3 года назад
What if the clientApp and api are separated resources? Good video btw
@RahulNath
@RahulNath 3 года назад
You can specify the URL to the API Swagger that needs to be generated. Let know if that helps or you need any additional info
@pedroferreira9234
@pedroferreira9234 3 года назад
@@RahulNath yes, thx you. Keep the good work
@kpg7882
@kpg7882 2 года назад
This not explain basics... I.e. how can you add description to API endpoint method in Swagger just by editing c# code? i.e. string name
@RahulNath
@RahulNath 2 года назад
Added to my backlog video list. I will cover this some time!
@jasminsabanovic869
@jasminsabanovic869 9 месяцев назад
can we create C# classes with it?
@RahulNath
@RahulNath 7 месяцев назад
yes you can - hope you were able to figure it !
@bisarothub1644
@bisarothub1644 2 года назад
I hope you could have a tutorial on nswag on mac
@RahulNath
@RahulNath 2 года назад
Thank you for the suggestion Bisarot. Anything specific you are missing? I guess the NSwag Studio is not available on mac?
@bisarothub1644
@bisarothub1644 2 года назад
@@RahulNath Im trying to do the nswag CLI on mac but I wasn’t able to generate typescript or angular codes from c#. Maybe using nswag cli, setting it up and generating typescript? 😁
@RahulNath
@RahulNath 2 года назад
@@bisarothub1644 Thank you for the suggestion. Are you using .NET project? I show how to set this up as part of msbuild at 13:30.
@RaviKumar-mq8fv
@RaviKumar-mq8fv Год назад
bhai basic se banao
@RahulNath
@RahulNath Год назад
Is it missing any details ?
@RaviKumar-mq8fv
@RaviKumar-mq8fv Год назад
@@RahulNath what you created only for professional,Beginner can not understand.You want to make then start from basic.Then it will be helpful.
@Felix-og7pd
@Felix-og7pd Год назад
consume API nswag.json
@RahulNath
@RahulNath Год назад
Was that a question? Hope you liked the video
@Felix-og7pd
@Felix-og7pd Год назад
@@RahulNath Not exactly. Just my notes
Далее
Connect .Net Core to Azure Key Vault in Ten Minutes
10:26
Maybe i need to add instructions @popflexactive
00:14
🤔
00:28
Просмотров 953 тыс.
Brutally honest advice for new .NET Web Developers
7:19
Swagger is Going Away in .NET 9!
10:48
Просмотров 90 тыс.
You don't need a frontend framework
15:45
Просмотров 114 тыс.
.NET Core with Swagger and Angular
17:56
Просмотров 19 тыс.
Forget Controllers and Minimal APIs in .NET!
14:07
Просмотров 60 тыс.
20 июля 2024 г.
0:58
Просмотров 2,5 млн
Шашлык вкусный
0:57
Просмотров 6 млн
20 июля 2024 г.
0:58
Просмотров 2,5 млн