JSON тестинг HELP

CB
На сайте с 11.01.2017
Offline
0
894

Есть вот такая беда

Example Request:

GET /shipping/shipment/failed/987324 HTTP/1.1

Host: www.example.com

Accept: application/json

GEOClient: website/createshipment

GEOSession: 1234567890ABCDEFGHIJ

И вот такаяя

URL Schema:

{

"$schema":"http://json-schema.org/draft-04/schema#",

"title":"GET:/shipping/shipment/failed/[shipmentId]",

"type":"object",

"properties":{

"resourceParameters":{

"type":"object",

"properties":{

"shipmentId":{

"minimum" : "1",

"maximum" : "99",

"type" : "integer"

}

}

},

"urlParameters":{

"type":"object",

"properties":{

}

}

}

}

Задача - найти как можно больше ошибок. Один знакомый QA сказал, что URL Schema это как спецификация, а пример - то, в чем ошибки искать. Но я в JSON не сильно шарю, не в синтаксисе, не в корректности. Помогите разобраться.

Aisamiery
На сайте с 12.04.2015
Offline
311
#1

Это на собеседование что ли?

В самом JSON нет ошибок (синтаксисе), формат то примитивный. В данном случае используется валидация документа по конкретным правилам. Схема есть в самом ответе JSON по которой валидировать, а пример того как это делать на том же сайте

Если вы думаете что кто то это сделает за вас, ну хз хз :) Хотя судя по всему там и куча валидаторов

Разработка проектов на Symfony, Laravel, 1C-Bitrix, UMI.CMS, OctoberCMS
S
На сайте с 13.10.2014
Offline
171
#2

Count_Barkov,

json валидный по 3м стандартам

{

"$schema": "http://json-schema.org/draft-04/schema#",
"title": "GET:/shipping/shipment/failed/[shipmentId]",
"type": "object",
"properties": {
"resourceParameters": {
"type": "object",
"properties": {
"shipmentId": {
"minimum": "1",
"maximum": "99",
"type": "integer"
}
}
},
"urlParameters": {
"type": "object",
"properties": {}
}
}
}

Собно ничего сложного нет

"Variable":"value"

если энкодится объект, то немного сложнее, так как туда добавляется еще и описание объекта

---------- Добавлено 12.01.2017 в 01:48 ----------

Aisamiery, опередили

CB
На сайте с 11.01.2017
Offline
0
#3
silicoid:
Count_Barkov,
json валидный по 3м стандартам
{

"$schema": "http://json-schema.org/draft-04/schema#",
"title": "GET:/shipping/shipment/failed/[shipmentId]",
"type": "object",
"properties": {
"resourceParameters": {
"type": "object",
"properties": {
"shipmentId": {
"minimum": "1",
"maximum": "99",
"type": "integer"
}
}
},
"urlParameters": {
"type": "object",
"properties": {}
}
}
}

Собно ничего сложного нет
"Variable":"value"
если энкодится объект, то немного сложнее, так как туда добавляется еще и описание объекта

---------- Добавлено 12.01.2017 в 01:48 ----------

Aisamiery, опередили

Нет, мне нужно понять что с примером запроса не так относительно этой схемы, насколько я понял. Есть еще вот что

Response Schema:

{

"$schema":"http://json-schema.org/draft-04/schema#",

"title":"GET:/shipping/shipment/failed/[shipmentId]",

"type":"object",

"properties":{

"error":{

"type" : ["array","null"],

"items": {

"type" : "object",

"properties":{

"errorCode":{

"enum" : ["1000","1001", "1004", "1006", "1007", "1018", "1026", "1027", "1028", "1029", "1030", "1031", "1032","1033", "1034", "1035", "1037"],

"type" : "string"

},

"errorType":{

"enum" : ["business rules", "object error", "validation error", "resource error", "application error", "rule error", "server side error", "business rule error"],

"type" : "string"

},

"errorMessage":{

"type" : "string"

},

"errorAction":{

"type" : "string"

},

"errorObj":{

"type" : "string"

}

},

"required": ["errorCode","errorType","errorMessage","errorAction","errorObj"]

}

},

"data":{

"type" : ["object", "null"],

"properties":{

"shipment":{

"type" : "object",

"properties":{

"collectionDate":{

"type" : ["string"], "format": "date"

},

---------- Добавлено 12.01.2017 в 00:55 ----------

Count_Barkov:
Нет, мне нужно понять что с примером запроса не так относительно этой схемы, насколько я понял. Есть еще вот что
Response Schema:

{
"$schema":"http://json-schema.org/draft-04/schema#",
"title":"GET:/shipping/shipment/failed/[shipmentId]",
"type":"object",
"properties":{
"error":{
"type" : ["array","null"],
"items": {
"type" : "object",
"properties":{
"errorCode":{
"enum" : ["1000","1001", "1004", "1006", "1007", "1018", "1026", "1027", "1028", "1029", "1030", "1031", "1032","1033", "1034", "1035", "1037"],
"type" : "string"
},
"errorType":{
"enum" : ["business rules", "object error", "validation error", "resource error", "application error", "rule error", "server side error", "business rule error"],
"type" : "string"
},
"errorMessage":{
"type" : "string"
},
"errorAction":{
"type" : "string"
},
"errorObj":{
"type" : "string"
}
},
"required": ["errorCode","errorType","errorMessage","errorAction","errorObj"]
}
},
"data":{
"type" : ["object", "null"],
"properties":{
"shipment":{
"type" : "object",
"properties":{
"collectionDate":{
"type" : ["string"], "format": "date"
},

И к нему это

Example Response:

HTTP/1.1 200 OK

Content-Type: application/json

Content-Length: 6002

{

"error":null,

"data":{

"shipment":{

"collectionDate":"2014-12-31",

"consignment":{

"auditInfo":{

"createdDate":"2014-10-30 13:00:00",

"ownerRecord":null,

"updatedDate":"2014-10-30 14:00:00"

},

"collectionDetails":{

"address":{

"countryCode":"GB",

"countryName":"United Kingdom",

"organisation":"GeoPostUK Ltd",

"postcode":"B66 1BY",

"street":"Roebuck Lane",

"locality":"Smethwick",

"town":"Birmingham",

"county":"West Midlands"

},

"contactDetails":{

"contactName":"Mr David Smith",

"telephone":"07927123456"

}

},

"consignmentNumber":"8512345678",

"consignmentRef":"8522345678",

"customsValue":5.99,

"deliveryDetails":{

"address":{

"countryCode":"GB",

"countryName":"United Kingdom",

"organisation":"GeoPostUK Ltd",

"postcode":"B66 1BY",

"street":"Roebuck Lane",

"locality":"Smethwick",

"town":"Birmingham",

"county":"West Midlands"

},

"contactDetails":{

"contactName":"Mr David Smith",

"telephone":"07927123456"

},

"notificationDetails":{

"email":"david.smith@dpdgroup.co.uk",

"mobile":"07929123456"

}

},

"deliveryInstructions":"Please place parcel in the porch",

"liability":false,

"liabilityValue":11.00,

"networkCode":"1^12",

"numberOfParcels":1,

"parcel":[{ "auditInfo":{

"createdDate":"2014-10-30 13:00:00",

"ownerRecord":null,

"updatedDate":"2014-10-30 14:00:00"

},

"isVoided":false,

"labelNumber":"0B661BY159760000000008128269",

"packageNumber":1,

"parcelnetBarcode":"",

"parcelnetData":"",

"parcelnetLabelNumber":"",

"parcelNumber":"15501234567890",

"parcelProduct":[{ "numberOfItems":1,

"productCode":"PC:20435",

"productFabricContent":"",

"productHarmonisedCode":"",

"productItemsDescription":"",

"productTypeDescription":"",

"unitValue":10.00,

"unitWeight":5.0,

"auditInfo":{

"createdDate":"2014-10-30 13:00:00",

"ownerRecord":null,

"updatedDate":"2014-10-30 14:00:00"

}

}]

}],

"parcelDescription":"Shoes",

"shippingRef1":"PurchaseOrder:12345",

"shippingRef2":"InvoiceNo:23451",

"shippingRef3":"OID:8709",

"totalWeight":5

},

"isPrinted":false,

"isVoided":false,

"manifestId":873247,

"shipmentId":987324,

"shipmentType":0,

"userId":980324,

"failure_details":{

"originalFilename":"import.txt",

"row":0,

"lineData":01,shippingRef1,B69 4DA,

"failureReasons":[""],

"status":""

}

}

}

}

Задача найти эрроров побольше.А вот на что в первую очередь обратить внимание - вот это вопрос, уважаемые.

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий