documentOperationResponses method Null safety

  1. @override
Map<String, APIResponse> documentOperationResponses(
  1. APIDocumentContext context,
  2. Operation operation

Returns a map of possible responses for operation.

To provide documentation for an operation, you must override this method and return a map of possible responses. The key is a String representation of a status code (e.g., "200") and the value is an APIResponse object.


Map<String, APIResponse> documentOperationResponses(
    APIDocumentContext context, Operation operation) {
  return {
    "200": APIResponse.schema(
        "Successfully exchanged credentials for token",
          "access_token": APISchemaObject.string(),
          "token_type": APISchemaObject.string(),
          "expires_in": APISchemaObject.integer(),
          "refresh_token": APISchemaObject.string(),
          "scope": APISchemaObject.string()
        contentTypes: ["application/json"]),
    "400": APIResponse.schema("Invalid credentials or missing parameters.",
        APISchemaObject.object({"error": APISchemaObject.string()}),
        contentTypes: ["application/json"])