apply(__MODULE__, operation, [])
end
- @spec index_operation() :: Operation.t()
- def index_operation do
- %Operation{
- tags: ["Applications"],
- summary: "List applications",
- description: "List the OAuth applications for the current user",
- operationId: "AppController.index",
- responses: %{
- 200 => Operation.response("Array of App", "application/json", array_of_apps())
- }
- }
- end
-
@spec create_operation() :: Operation.t()
def create_operation do
%Operation{
operationId: "AppController.create",
requestBody: Helpers.request_body("Parameters", create_request(), required: true),
responses: %{
- 200 => create_response(),
+ 200 => Operation.response("App", "application/json", App),
422 =>
Operation.response(
"Unprocessable Entity",
}
}
end
-
- defp create_response do
- Operation.response("App", "application/json", App)
- end
-
- defp array_of_apps do
- %Schema{type: :array, items: App, example: [App.schema().example]}
- end
end