FastEndpoints / FastEndpoints

A light-weight REST API development framework for ASP.NET 6 and newer.
https://fast-endpoints.com
MIT License
4.72k stars 282 forks source link

Questions about model binding from reading the docs #179

Closed Reikooters closed 2 years ago

Reikooters commented 2 years ago

Hi there,

I currently use controllers with the MediatR library. FastEndpoints looks good and I've just read through all the docs 🙂 And I have a couple of questions.

Early in the docs I saw on this page: https://fast-endpoints.com/docs/model-binding

1) With the binding order 1 is JSON Body and 3 is Route Parameters. In the example given in this page, it says Route Parameters is higher priority, but the sentence above the list says that it's in the exact specified order. Is the list of priorities actually numbered from lowest to highest?

2) In the "from json body" section on the same page, "Address" (in the request) maps to "UserAddress" (in the c# class). Is this just a typo or some magic? There's a "mismatch properties" section further down where [JsonPropertyName] is used to correct this - so I am guessing it's just a typo?

Thanks.

dj-nitehawk commented 2 years ago
  1. yes - higher the number, higher the priority. i.e. higher numbers are later stages of binding.
  2. yes that's a typo. thanks for spotting it ;-)