Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
titleInput Object properties
Property NameValue

Comments

sourcestringWhere the framework should look at the HTTP request for this piece of input. Valid values are path, queryString, and body.
httpMethodsarray of stringsAn array of HTTP methods this input field should be allowed for.
required HttpMethodsrequiredHttpMethodsarray of stringsAn array of HTTP methods this input field must be supplied for.

You might be wondering why the input entity definition has properties around the HTTP methods. Aren't HTTP methods an attribute of the route? They absolutely are part of the route. And the route definition is the only thing that dictates how your endpoint is addressable. However, if you are developing CRUD based endpoints, you will find that the input you expect from your callers is very similar across HTTP methods. For example, POST (create) and PATCH (update) payloads typically only differ in a few minor areas.

  • POST endpoints do not refer to an existing resource, and often require all values to successfully create a resource.
  • PATCH endpoints always refer to an existing resource, and often do not require all values be sent to update a resource.

Being able to describe the HTTP methods the fields are valid / required for allows us to reuse the input entity definition in different endpoints using references.

...