Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3b9c7a6
Add basic set up for the new flag with translations by Copilot
sander1095 Feb 12, 2025
734817a
Add conditional logic to use OpenAPI
sander1095 Feb 12, 2025
5be274c
Add OpenAPI test to WebAPIAOT template tests
sander1095 Feb 12, 2025
d8693b2
Fix tests
sander1095 Feb 12, 2025
d0b3ce9
Add missing endif in the csproj
sander1095 Feb 12, 2025
ffee0b2
Add more metadata to get 404 not found in the openapi doc correctly
sander1095 Feb 12, 2025
94e40fd
Also add the 404 metadata to the other file
sander1095 Feb 12, 2025
d918e32
Change elif to else
sander1095 Feb 14, 2025
664bec6
Remove unnecessary 118n changes
sander1095 Feb 14, 2025
e225cc2
Add english translation back
sander1095 Feb 14, 2025
539ba41
Keep the semicolon on the same line as requested by PR review
sander1095 Feb 14, 2025
06112f2
Use TypedResults instead of extension methods and reduce the if else …
sander1095 Feb 14, 2025
8dc2ceb
Add template strings back after running `bash build.sh -test -configu…
sander1095 Feb 14, 2025
98332af
Merge branch 'main' into GH-59564-webapiaot-openapi
sander1095 Mar 3, 2025
a442d80
Add usings for TypedResults and Results/NotFound/Ok etc..
sander1095 Mar 3, 2025
0891a99
Add OpenAPI services to Program.Main.cs
sander1095 Mar 3, 2025
3c4d854
Remove http using because thats already part of the implicit usings
sander1095 Mar 3, 2025
63cf302
TEMP COMMIT - Removing EnableOpenAPI flags to find out why tests fail
sander1095 Mar 4, 2025
9674e32
Revert "TEMP COMMIT - Removing EnableOpenAPI flags to find out why te…
sander1095 Mar 4, 2025
983ec24
Fix assertions where we expected OpenAPI to be enabled for published …
sander1095 Mar 4, 2025
102bbb4
Added consistent indentation in test methods
sander1095 Mar 4, 2025
7cf3a0b
Fix build errors
sander1095 Mar 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Keep the semicolon on the same line as requested by PR review
  • Loading branch information
sander1095 committed Feb 14, 2025
commit 539ba41e599c75d39d654f8a39dc2c1f3a15d65c
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,27 @@ public static void Main(string[] args)
};

var todosApi = app.MapGroup("/todos");
#if (EnableOpenAPI)
todosApi.MapGet("/", () => sampleTodos)
#if (EnableOpenAPI)
.WithName("GetTodos");
#else
;
#endif
#else
todosApi.MapGet("/", () => sampleTodos);
#endif

#if (EnableOpenAPI)
todosApi.MapGet("/{id}", (int id) =>
sampleTodos.FirstOrDefault(a => a.Id == id) is { } todo
? Results.Ok(todo)
: Results.NotFound())
#if (EnableOpenAPI)
.WithName("GetTodoById")
.Produces<Todo>(StatusCodes.Status200OK)
.Produces(StatusCodes.Status404NotFound);
#else
;
#endif
#else
todosApi.MapGet("/{id}", (int id) =>
sampleTodos.FirstOrDefault(a => a.Id == id) is { } todo
? Results.Ok(todo)
: Results.NotFound());
#endif

app.Run();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,27 @@
};

var todosApi = app.MapGroup("/todos");
#if (EnableOpenAPI)
todosApi.MapGet("/", () => sampleTodos)
#if (EnableOpenAPI)
.WithName("GetTodos");
#else
;
#endif
#else
todosApi.MapGet("/", () => sampleTodos);
#endif

#if (EnableOpenAPI)
todosApi.MapGet("/{id}", (int id) =>
sampleTodos.FirstOrDefault(a => a.Id == id) is { } todo
? Results.Ok(todo)
: Results.NotFound())
#if (EnableOpenAPI)
.WithName("GetTodoById")
.Produces<Todo>(StatusCodes.Status200OK)
.Produces(StatusCodes.Status404NotFound);
#else
;
#endif
#else
todosApi.MapGet("/{id}", (int id) =>
sampleTodos.FirstOrDefault(a => a.Id == id) is { } todo
? Results.Ok(todo)
: Results.NotFound());
#endif

app.Run();

Expand Down