-
Notifications
You must be signed in to change notification settings - Fork 25.3k
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
Minimal API /3 #22941
Minimal API /3 #22941
Conversation
aspnetcore/tutorials/min-web-api.md
Outdated
* Select the **Project** checkbox in the right pane and then select **Install**. | ||
* Follow the preceding instructions to add the following packages: | ||
* `Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore` | ||
* `MinimalValidation` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure we want to show this in the tutorial? Do we @LadyNaggaga @DamianEdwards? Maybe we should show fluent validation instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These aren't in the box yet so, let's remove them. @DamianEdwards am I wrong ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @davidfowl says we could decide to show how to use FluentValidation or I could do some work on MinimalValidation and release that as a 1.0 and we could use that. Or we don't talk about validation at all in the tutorial as it's not something we provide in the box today. We know people will ask about it but we also know putting things in the tutorial is in ways an implicit blessing/statement of what we recommend. Likely requires more thought/discussion.
|
||
Examine the `app.MapPut("/todoitems/{id}", ...` method: | ||
|
||
[!code-csharp[](min-web-api/samples/6.x/todo/Program.cs?name=snippet_put)] |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
EDIT I've decided to keep Swagger and the weather forecast controller, then remove them in the next step @rafikiassumani-msft @davidfowl @LadyNaggaga @DamianEdwards I suggest for this onboarding tutorial I have then uncheck Enable OpenAPI support. Otherwise the generated code goes from 4 lines to 43 lines. I think we should focus on minimal APIs and refer them to Swagger in a follow up tutorial. |
@rafikiassumani-msft I'm merging this at EOD unless you have changes. cc @LadyNaggaga |
aspnetcore/tutorials/min-web-api.md
Outdated
- No support for binding from forms. This includes binding <xref:Microsoft.AspNetCore.Http.IFormFile>. We plan to add support for `IFormFile` in the future. | ||
- No built-in support for validation. i.e. <xref:Microsoft.AspNetCore.Mvc.ModelBinding.Validation.IModelValidator> | ||
- No support for [application parts](xref:mvc/advanced/app-parts) or the [application model](xref:mvc/controllers/application-model). There's no way to apply or build your own conventions. | ||
- No built-in view rendering support. We recommend using Razor Pages for rendering views. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link to the razor pages article
@serpent5 please review on Monday but not before then. |
Made requested changes and asked for new review last week
@rafikiassumani-msft @LadyNaggaga @captainsafia I'm merging this EOD Monday. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know if you want me to turn down the verbosity for the next review. 😅
aspnetcore/tutorials/min-web-api.md
Outdated
## Differences between minimal APIs and APIs with controllers | ||
|
||
- No support for filters: For example, no support for <xref:Microsoft.AspNetCore.Mvc.Filters.IAsyncAuthorizationFilter>, <xref:Microsoft.AspNetCore.Mvc.Filters.IAsyncActionFilter>, <xref:Microsoft.AspNetCore.Mvc.Filters.IAsyncExceptionFilter>, <xref:Microsoft.AspNetCore.Mvc.Filters.IAsyncResultFilter>, and <xref:Microsoft.AspNetCore.Mvc.Filters.IAsyncResourceFilter> | ||
- No support for model binding. i.e. <xref:Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinderProvider>, <xref:Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder>. Support can be added with a custom binding shim. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Support can be added with a custom binding shim.
Is there somewhere we can send the reader to learn more about what this means?
- | ||
## Use JsonOptions | ||
|
||
The following code uses <xref:Microsoft.AspNetCore.Http.Json.JsonOptions>: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of thoughts here:
- The code that follows doesn't actually mention
JsonOptions
. - The section doesn't have much context. Should we call out that it's showing how to customise the JSON response, for example?
Co-authored-by: Kirk Larkin <[email protected]>
Co-authored-by: Kirk Larkin <[email protected]>
Fixes #22942
Internal review URL