快问。是否可以更改 laravel 的 JSON 验证响应?这是我在 Laravel 中构建的自定义 API。
验证过程
$validation = $this->validate(
$request, [
'user_id' => 'required',
]);
Run Code Online (Sandbox Code Playgroud)
响应在 json 中显示如下
{
"message": "The given data was invalid.",
"errors": {
"user_id": [
"The user id field is required."
],
}
}
Run Code Online (Sandbox Code Playgroud)
最好它会变成这样。
{
"common:" [
"status": "invalid",
"message": "Param xxxx is required",
],
}
Run Code Online (Sandbox Code Playgroud)
改变这种情况的最佳方法是什么?有可能吗?
谢谢。
这个问题此刻正在轻轻地杀死我。我正在尝试学习 python、lambda 和 Dynamodb。
Python 看起来棒极了,我能够在使用像 Xampp 这样的普通 MySQL 服务器时连接到 MySQL,目标是学习使用 Dynamodb,但不知何故我无法从 Dynamodb 获取_items。这真的让我很头疼,已经花了我两天的时间了。
观看了大量的 YouTube 电影并阅读了 aws 文档。
任何线索我做错了什么。到目前为止我的代码;
import json
import boto3
from boto3.dynamodb.conditions import Key, Attr
#always start with the lambda_handler
def lambda_handler(event, context):
# make the connection to dynamodb
dynamodb = boto3.resource('dynamodb')
# select the table
table = dynamodb.Table("html_contents")
# get item from database
items = table.get_item(Key={"id": '1'})
Run Code Online (Sandbox Code Playgroud)
我到处都看到我应该这样做。但我不断收到以下错误
{errorMessage=An error occurred (ValidationException) when calling the GetItem operation: The provided key element does not match the …Run Code Online (Sandbox Code Playgroud)