How to Implement API Versioning for Minimal APIs | ASP.NET Core 8

  Рет қаралды 18,611

Milan Jovanović

Milan Jovanović

Күн бұрын

Пікірлер: 83
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
Want to master Clean Architecture? Go here: bit.ly/3PupkOJ Want to unlock Modular Monoliths? Go here: bit.ly/3SXlzSt
@codeme8016
@codeme8016 10 ай бұрын
Very clear. Some tutorials aren't but this one was outstanding. Thank you!
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
Glad you enjoyed it! When you say "Some tutorials aren't" - do you mean on my channel? I'd appreciate any feedback, if you're keen on sharing.
@stratvids
@stratvids 14 күн бұрын
We use a url version number and actually build each major version of the api as a separate container, this really keeps the services from becoming a mess of multiple versions mixed together and you can update/deploy them independently
@MilanJovanovicTech
@MilanJovanovicTech 12 күн бұрын
Nice strategy
@developmentroselino
@developmentroselino 6 ай бұрын
milan saved the day once again
@MilanJovanovicTech
@MilanJovanovicTech 6 ай бұрын
Happy to help! 😁
@alexmadnix
@alexmadnix 10 ай бұрын
Great video as always!
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
I appreciate that
@XelleczixTV
@XelleczixTV 10 ай бұрын
Love your videos! A little tip: you should increase the volume of your mic 😊 Have to turn up quite a lot to hear you clearly.
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
Thank you! Will do!
@kyamcollados8538
@kyamcollados8538 10 ай бұрын
hey man, i tried to follow your tutorial and i got stuck in the swagger ui page. i could not see the v2 in the dropdown. anything i missed?
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
Register the Minimal API endpoints before configuring Swagger options?
@xentricator
@xentricator 10 ай бұрын
@MilanJovanovicTech how would you implement this kind of versioning when the seperate versions have a different contract (which is usually the reason why you would create another version, due to it being a different contract often results in breaking changes). Currently in your example you are always routing to the same implementation with the same contract whether it's v1 or v2.
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
You can define two request contracts, and expose each one on the respective endpoint V1 or V2
@10Totti
@10Totti 10 ай бұрын
Nice tutorial thanks!
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
You're welcome!
@sunzhang-d9v
@sunzhang-d9v 10 ай бұрын
CreateUser API, there is only one V1 version, but the V2 version of SwaggerUI also appears, how to make the V2 version not displayed?
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
Nope, both V1 and V2 were configured for all APIs
@heischono4917
@heischono4917 3 ай бұрын
Thanks for this video. I miss the case when I wish to go over from a MVC Api (v1) to Minimal Api (v2). Is it simple to mix these 2 kinds of Api or should I use a more simple approach with manually define v2 in the routes?
@MilanJovanovicTech
@MilanJovanovicTech 3 ай бұрын
Haven't thought of that. Makes me wonder if the routes will conflict in any way, but I assume not.
@MrNobody-f8f
@MrNobody-f8f 9 ай бұрын
hey milan thanks. did you try with version 8.1.0? it will say that the swagger endpoint is not found
@MilanJovanovicTech
@MilanJovanovicTech 9 ай бұрын
No, I did not. But I'll check it out and see why that could be
@andyhb1970
@andyhb1970 9 ай бұрын
When using the version number as part of the route can you still use Postman to import the OpenAPI as I'm only seeing the v1 assuming it was part of the same issue as the swagger UI I tried adding the swagger gen option configuration elements but it still only returns version 1?
@MilanJovanovicTech
@MilanJovanovicTech 9 ай бұрын
The v2 is a different Open API document - so you'd have to import both
@andyhb1970
@andyhb1970 9 ай бұрын
@@MilanJovanovicTech ah yes of course, sorry I have become used to copying and pasting the OpenAPI link I didn't pay the version part of the route any attention, infact in postman if you paste the link it auto submits it! Thanks for your prompt response.
@FungoTech
@FungoTech 3 ай бұрын
Thanks, great example of configuration.
@MilanJovanovicTech
@MilanJovanovicTech 3 ай бұрын
Glad it was helpful!
@pa1kota
@pa1kota 2 ай бұрын
Great Tutorial and would love to see if this also included how to default to v1 when v2 is introduced so that Postman call doesn't have to change. This would be a good example where legacy clients can continue without change of url.
@MilanJovanovicTech
@MilanJovanovicTech 2 ай бұрын
With URI versioning, I don't think it can be done since the version is "hard-coded" on the calling side
@pa1kota
@pa1kota 2 ай бұрын
@@MilanJovanovicTech Yes right. Thank you :-)
@Midicifu
@Midicifu Ай бұрын
Can't be this done with a middleware or a proxy (yarp or code) with transforms and with white list to the break changes?
@vishalpawarsblogs8077
@vishalpawarsblogs8077 9 ай бұрын
when we define route with `v{v:apiVersion}/controller` , how default version will work? how AssumeDefaultVersionWhenUnspecified will work in such case?
@MilanJovanovicTech
@MilanJovanovicTech 9 ай бұрын
You're going to configure one of the API versions as "default": 4:35
@kien-dang
@kien-dang 9 ай бұрын
Hey Milan, how can you implement API versioning to work with Carter? I use vertical slide architecture with the implementation of ICarterModule and AddRoutes separately in individual classes. I don't want to declare NewApiVersionSet repeatedly in many AddRoutes(IEndpointRouteBuilder app). Thanks
@MilanJovanovicTech
@MilanJovanovicTech 9 ай бұрын
Doesn't Carter have an abstraction for something like that? I would be surprised that it's not supported
@kien-dang
@kien-dang 9 ай бұрын
I've been searching around but it seems doesn't have something for that. I might have to implement an extension myself. Thanks for the video and that would be great if you can find another way to work with Carter for this matter.
@Yehor-Lesnevych
@Yehor-Lesnevych 10 ай бұрын
Hey! I have an issue with swagger and api versioning. I did all the steps in the video but calling app.DescribeApiVersions() throws exception "System.FormatException: 'Input string was not in a correct format.'"
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
Did you configure the required services?
@Yehor-Lesnevych
@Yehor-Lesnevych 10 ай бұрын
​@@MilanJovanovicTech yes, I did. builder.Servises.ConfigureOptions()
@Yehor-Lesnevych
@Yehor-Lesnevych 10 ай бұрын
​@@MilanJovanovicTechyes, I did everything in video
@andyhb1970
@andyhb1970 9 ай бұрын
Is it possible that there is an issue when using Carter to register map the endpoints, I have setup a Test endpoint with 2 versions and when I call it I get... System.InvalidOperationException: Duplicate endpoint name 'Testing' found on 'HTTP: GET api/v{apiVersion:apiVersion}/auth/testing => Logout' and 'HTTP: GET api/v{apiVersion:apiVersion}/auth/testing => Logout'. Endpoint names must be globally unique.
@andyhb1970
@andyhb1970 9 ай бұрын
Just realized the error message was referring to the Name which you aren't setting in your example which seems to have resolved things 👍
@MilanJovanovicTech
@MilanJovanovicTech 9 ай бұрын
Glad you fixed it 😁
@salmanshafiq8151
@salmanshafiq8151 10 ай бұрын
Very informative❤ What is customresults here?
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
From here: kzbin.info/www/bejne/j3OuamadoKyFoJo
@jithin.johnson
@jithin.johnson 7 ай бұрын
when using Carter, how to implement versioning?
@MilanJovanovicTech
@MilanJovanovicTech 6 ай бұрын
Version on the route group, or when mapping the endpoint
@TheScriptPunk
@TheScriptPunk 10 ай бұрын
Now this is a valuable video
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
Glad you think so 😁
@abhikr_1997
@abhikr_1997 10 ай бұрын
Content of the video is too good and I always learn something new from your videos but you haven’t talk about the breaking changes in this video. Is there a new video coming for breaking changes or missed it if I missed that concept can you please provide the timestamp. Thanks 😊
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
Yeah, it kind of went over the top of my head 😅 Check this out for more info: www.milanjovanovic.tech/blog/api-versioning-in-aspnetcore
@abhikr_1997
@abhikr_1997 10 ай бұрын
@@MilanJovanovicTech Thanks will have a look ☺️
@raiscl
@raiscl 5 ай бұрын
Could we all as a group drop the X on custome headers? It's been more than a decade that this is not mandatory anymore and it is actually advised against! Besides, just polute code on FE and BE.... a part of that. Amazing tutorial!!
@MilanJovanovicTech
@MilanJovanovicTech 5 ай бұрын
I don't know about that. I know it's not required. But I simply like having the X- prefix to denote custom headers. Also makes it easier for me to find them in source code with search.
@chrissu9354
@chrissu9354 9 ай бұрын
hi,good vid, there's a little question which is the theme was? really awesome theme plz name for me~ thx.
@MilanJovanovicTech
@MilanJovanovicTech 9 ай бұрын
It's ReSharper syntax highlighting
@Megha-f7d
@Megha-f7d 10 ай бұрын
I didn't see much about the vlogs of the day in the life of dotnet developers, How much they can make, what kind of companies require them and future of dotnet. Please you make
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
I doubt it
@Paul-uo9sv
@Paul-uo9sv 10 ай бұрын
Can we have one vid for non minimal apis?
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
Sure :)
@ferventurart
@ferventurart 9 ай бұрын
When a video about how add open api summary, description, params and responses (documenting our endpoints)
@MilanJovanovicTech
@MilanJovanovicTech 9 ай бұрын
That's a great idea!
@aamirali8114
@aamirali8114 9 ай бұрын
why dont you provide code to learn your one concept we have fill up the blank of incomplete code which take more time and we move to another syllabus and forget why we started this thing
@MilanJovanovicTech
@MilanJovanovicTech 9 ай бұрын
I do - except it's on Patreon
@YehorBachurinDev
@YehorBachurinDev 10 ай бұрын
Thanks!
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
You're welcome! :)
@JedaiasRodrigues7
@JedaiasRodrigues7 6 ай бұрын
Thanks a lot! 👊
@MilanJovanovicTech
@MilanJovanovicTech 6 ай бұрын
You bet
@sunzhang-d9v
@sunzhang-d9v 10 ай бұрын
Not being able to have XML comments like controllers, unhappy
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
Not a deal breaker for me
@javidibra6786
@javidibra6786 10 ай бұрын
das ist fantastic🤩
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
Thanks a lot! :)
@sunzhang-d9v
@sunzhang-d9v 10 ай бұрын
good job
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
Thanks!
@whosgotrythm
@whosgotrythm 7 ай бұрын
Good video. Can you controllers in your videos as that is what commercial applications use. Still this is great info
@MilanJovanovicTech
@MilanJovanovicTech 6 ай бұрын
Explained here: www.milanjovanovic.tech/blog/api-versioning-in-aspnetcore
@sunzhang-d9v
@sunzhang-d9v 10 ай бұрын
There is only one API with V1 and V2 versions, so SwaggerUI has them all
@MilanJovanovicTech
@MilanJovanovicTech 10 ай бұрын
You can also deprecate a V1 endpoint, and it'll be greyed out in SwaggerUI
Fix Your Controllers By Refactoring To Minimal APIs
14:56
Milan Jovanović
Рет қаралды 46 М.
Implementing Modern API Versioning in .NET
13:29
Nick Chapsas
Рет қаралды 70 М.
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 30 МЛН
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН
How to treat Acne💉
00:31
ISSEI / いっせい
Рет қаралды 108 МЛН
Правильный подход к детям
00:18
Beatrise
Рет қаралды 11 МЛН
Automatically Register Minimal APIs in ASP.NET Core | REPR Pattern
11:55
Milan Jovanović
Рет қаралды 16 М.
Elegant API Versioning in ASP.NET Core (Web API)
21:27
Nick Chapsas
Рет қаралды 96 М.
Zed Text Editor. A VSCode alternative?
15:51
Infralovers GmbH
Рет қаралды 10 М.
Implementing the Transactional Outbox Pattern from Scratch
24:27
Milan Jovanović
Рет қаралды 12 М.
Forget Controllers and Minimal APIs in .NET!
14:07
Nick Chapsas
Рет қаралды 79 М.
Global Error Handling in C# Minimal APIs
13:59
IAmTimCorey
Рет қаралды 17 М.
.NET Aspire for Beginners - Full Series
1:28:16
dotnet
Рет қаралды 17 М.
The Honey Scam: Explained
10:53
Marques Brownlee
Рет қаралды 3,8 МЛН
Implementing JWT Authentication in ASP.NET Core
23:51
Nick Chapsas
Рет қаралды 47 М.
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 30 МЛН