부모 json 스키마에서 하위 스키마를 참조하려고합니다. 다음은 child.json이라는 하위 스키마입니다.JSON 스키마 : 로컬 하위 스키마 참조
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Child",
"description": "Child schema",
"type": "object",
"properties": {
"name": {"type": "string"},
"age": {"type": "integer"}
}}
이며 여기에는 parent.json이라는 상위 스키마가 있으며 두 파일은 모두 같은 폴더에 있습니다. 자식 스키마를 참조하고 싶습니다. 다음과 같이합니다.
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Parent",
"description": "Parent schema",
"type": "object",
"properties": {
"allOf": [
{
"$ref": "file://child.json"
}
],
"adresse": {"type": "string"}
}}
child.json 파일을 찾을 수 없다는 오류가 발생했습니다. 나는 많은 소리를 테스트했지만 아무도 일하고 있지 않습니다.
도움을 주셔서 감사합니다.
사용하는 라이브러리에 따라 다를 수 있습니다. Json-schema는 ref 값을 유효한 URI로 사용합니다. "child.json"또는 "file : child.json"으로 시도해 보셨습니까? 어떤 라이브러리를 사용하고 있으며 스키마를 어떻게로드합니까? – jruizaranguren