spring_validation/postman/Spring Validation.postman_collection.json

109 lines
3.4 KiB
JSON
Raw Normal View History

2024-11-04 12:17:41 +03:00
{
"info": {
"_postman_id": "bb233500-0318-496e-9882-071ee5de34a0",
"name": "Spring Validation",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "16442716"
},
"item": [
{
"name": "Person",
"item": [
{
"name": "Create Person",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 400\", function () {",
" pm.response.to.have.status(400);",
"});",
"",
"pm.test(\"violations is not null\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.violations).is.not.null;",
" pm.expect(jsonData.violations[0].fieldName).to.be.oneOf([\"numberBetweenOneAndTen\", \"ipAddress\", \"name\"])",
" pm.expect(jsonData.violations[1].fieldName).to.be.oneOf([\"numberBetweenOneAndTen\", \"ipAddress\", \"name\"])",
" pm.expect(jsonData.violations[2].fieldName).to.be.oneOf([\"numberBetweenOneAndTen\", \"ipAddress\", \"name\"])",
" pm.expect(jsonData.violations[0].message).to.be.oneOf([\"Не соответствует формату IP адреса\", \"должно быть не больше 10\", \"не должно быть пустым\"])",
" pm.expect(jsonData.violations[1].message).to.be.oneOf([\"Не соответствует формату IP адреса\", \"должно быть не больше 10\", \"не должно быть пустым\"])",
" pm.expect(jsonData.violations[2].message).to.be.oneOf([\"Не соответствует формату IP адреса\", \"должно быть не больше 10\", \"не должно быть пустым\"])",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"name\": null,\n \"numberBetweenOneAndTen\": 20,\n \"ipAddress\": \"15434.250.124.\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8080/api/person",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"api",
"person"
]
}
},
"response": []
},
{
"name": "Get Person",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"Status code is 400\", function () {",
" pm.response.to.have.status(400);",
"});",
"",
"pm.test(\"violations is not null\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.violations).is.not.null;",
" pm.expect(jsonData.violations[0].fieldName).to.be.eq(\"getById.personId\")",
" pm.expect(jsonData.violations[0].message).to.be.eq(\"должно быть не меньше 0\")",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://localhost:8080/api/person/-1",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"api",
"person",
"-1"
]
}
},
"response": []
}
]
}
]
}