json 스키마가 처음인데 내 문제의 해결책을 찾는 데 어려움을 겪고 있습니다. 아래 표시된 스키마를 사용하여 서버가 json 편집기로 보낸 데이터를 채워야합니다.Json 스키마의 동적 값 채우기
참고 : 이것은 스키마의 조각 일뿐입니다. 나는이처럼 보이는 JSON 스키마를 가지고 :
{
"id": "#ProcessApplicationList",
"type": "array",
"title":"ProcessApplicationList",
"description":"List of process application.",
"items": {
"id": "#ProcessApplication",
"type": "object",
"required":[
"ProcessId",
"InputParameter"
],
"title":"ProcessApplication",
"description":"Process application.",
"properties": {
"ProcessId":{
"id":"#ProcessId",
"type":"string",
"title":"Identification code of process",
"description":"e.g. 'process#01'"
},
"InputParameter": {
"id": "#InputParameter",
"type": "object",
"additionalProperties": {
"anyOf": [
{ "type": "string" },
{ "type": "number" },
{ "type": "boolean"}
]
}
}
}
}
}
이 서버에서 샘플 응답입니다.
{
"Acceptability" : {
"ProcessList" : [
{
"ProcessId" : "process#01",
"ProcessName" : "sign",
"ProcessDescription":"sign your plug-in by using signature",
"ProcessAvailability" : true,
"ProcessParameterSchema" : {
"\"$schema\":\"http://json-schema.org/draft-04/schema#\",
\"sign_type\":{
\"id\":\"#sign_type\",
\"type\":\"string\",
\"title\":\"sign_type\"}
},
{
"ProcessId" : "process#02",
"ProcessName" : "encryption",
"ProcessDescription":"encrypt your plug-in by using key",
"ProcessAvailability" : true,
"ProcessParameterSchema" : {
"\"$schema\":\"http://json-schema.org/draft-04/schema#\",
\"enc_type\": {
\"id\":\"#enc_type\",
\"type\":\"string\",
\"title\":\"enc_type\"
}
}
}
]
}
}
json으로 편집기의 출력 결과는 아래와 같습니다 :! [IMG] http://i61.tinypic.com/2r61r0k.png
내가 "ProcessParameterSchema"에서 "InputParameter"의 값을 넣어해야합니다. "ProcessApplicationList"의 모든 요소에 대해 "InputParameter"를 업데이트해야합니다. "ProcessApplicationList"가 배열이기 때문에 업데이트하는 방법을 모르겠습니다. 감사합니다.
귀하의 의도를 조금 더 설명해주십시오. Json-schema를 사용하면 스키마에 대해 json의 유효성을 검사 할 수 있습니다. 스키마 유효성 검사를 위해 응답을 적용 하시겠습니까? 응답에서 스키마의 변경을 수행하고 결과 스키마를 사용하여 유효성을 검사하고 있습니까? – jruizaranguren
@jruizaranguren : 추가 질문을 위해 질문을 업데이트했습니다. 예, 새로운 응답을받을 때마다 json 스키마를 업데이트하고 싶습니다. "ProcessPlameterSchema"의 스키마가 JSON 편집기에 표시되도록 "ProcessApplicationList"의 모든 요소에 대해 "InputParameter"를 업데이트해야합니다. 고맙습니다. – user3916984
가능한 모든 "ProcessParameterSchema"를 미리 검색 할 수 있습니까? – jruizaranguren