Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
IT NachrichtenHere’s the Samsung Galaxy Buds On and Their Features(01.10.2026 um 02:41 Uhr)
••••
Hacking & PentestingAlbert Hacker - Nachrichten & Infos - Basketball - Eurosport(30.09.2026 um 14:22 Uhr)
•
AI & KI NachrichtenElon Musk’s Grokipedia has a ‘newly refreshed’ design(01.10.2026 um 02:23 Uhr)
•••••
IT NachrichtenHere’s the Samsung Galaxy Buds On and Their Features(01.10.2026 um 02:41 Uhr)
••••
Hacking & PentestingAlbert Hacker - Nachrichten & Infos - Basketball - Eurosport(30.09.2026 um 14:22 Uhr)
•
AI & KI NachrichtenElon Musk’s Grokipedia has a ‘newly refreshed’ design(01.10.2026 um 02:23 Uhr)
•••••
Intelligence View
⚡ tsecurity.de Intelligence

Display and test openapi.yaml file

From a partner company I got a openapi.yaml file to evaluate their api for our use cases. Mostly I know those files from working with ASP.NET Core Apis +…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!

From a partner company I got a openapi.yaml file to evaluate their api for our use cases. Mostly I know those files from working with ASP.NET Core Apis + Swagger UI, but this time it was just a standalone file.



I got the file and an api key for the sandbox.






Did not work: Use via ASP.NET Core swagger



The first thing I was trying was to use the already known swagger ui as it's the same format.



So:




  1. Setting up a new ASP.NET Core Api project in Visual Studio

  2. Including the latest Swashbuckle.AspNetCore nuget

  3. Putting the openapi.yaml file in thewwwroot` folder

  4. Setting up the Program.cs



`cs

var builder = WebApplication.CreateBuilder(args);

var app = builder.Build();



app.UseHttpsRedirection();



// Allow to serve the unknown-by-default file type .yaml

var provider = new FileExtensionContentTypeProvider();

provider.Mappings[".yaml"] = "application/yaml";



app.UseStaticFiles(new StaticFileOptions

{

ContentTypeProvider = provider,

});



app.UseSwaggerUI(c =>

{

c.SwaggerEndpoint("/openapi.yaml", "Imported API");

c.RoutePrefix = "swagger";

});



app.Run();

`




  1. Accessing the api via https://localhost:7298/swagger



This worked almost, but then CORS came around :-(




Access to fetch at 'https://sandbox.***.com/api/...' from origin 'https://localhost:7298' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.




The problem seems to be the browser, so let's look for a non-browser-solution.






Did work: Import in Postman



Then I noticed that Postman got the functionality to import openapi spec files:



Importing openapi spec in Postman



From here it's possible to simulate the api requests just as good (or better?) as in swagger UI.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Display and test openapi.yaml file

Thematisch verwandte Begriffe: Display, test, openapiyaml, file · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag