When it comes to defining the return type of an operation, it appears that there are two valid ways to go.
The first is to define a type on the operation, e.g. like so:
{
"path": "/user/login",
"operations": [{
"method": "POST",
"nickname": "login",
"parameters": [],
"type": "User",
"summary": "Log in."
}]
}
The other is to define a responseModel as part of a responseMessage. This could be useful if multiple types of responses are possible. We discuss this in this loopback-explorer issue:
{
"path": "/user/login",
"operations": [{
"method": "POST",
"nickname": "login",
"parameters": [],
"responseMessages": [{
"code": 200,
"message": "Request was successful",
"responseModel": "User"
}],
"summary": "Log in."
}]
}
Which is the preferred style? If it is to use type, and to use responseMessages only for errors, could it be made more clear in the 1.2 spec that type is required?
When it comes to defining the return type of an operation, it appears that there are two valid ways to go.
The first is to define a
typeon the operation, e.g. like so:{ "path": "/user/login", "operations": [{ "method": "POST", "nickname": "login", "parameters": [], "type": "User", "summary": "Log in." }] }The other is to define a
responseModelas part of aresponseMessage. This could be useful if multiple types of responses are possible. We discuss this in this loopback-explorer issue:{ "path": "/user/login", "operations": [{ "method": "POST", "nickname": "login", "parameters": [], "responseMessages": [{ "code": 200, "message": "Request was successful", "responseModel": "User" }], "summary": "Log in." }] }Which is the preferred style? If it is to use
type, and to useresponseMessagesonly for errors, could it be made more clear in the 1.2 spec thattypeis required?