Using the API Schema Schema

We want to use the API project with the schema. Let's say we want to indicate that the PUT for the resource accepts the Account in the payload and the GET on the same resource returns the account payload. Therefore, I need to indicate that the account is used in GET and PUT, and I need to specify the account itself. I donโ€™t know where to indicate it, what is the canonical way? Unfortunately, I could not find it in the examples.

+4
source share
1 answer

Reusing a single message payload in multiple actions is where the concept of a resource model can be used.

Just define the account model and then reuse it as follows:

# Account [/account] + Model (application/json) + Body { ... } + Schema { ... } ## Retrieve an Account [GET] + Response 200 [Account][] ## Update an Account [PUT] + Request [Account][] + Response 204 
+4
source

Source: https://habr.com/ru/post/1502822/


All Articles