2013-06-21 1 views
1

JSON 스키마의 "설명"필드의 목적이 무엇인지 잘 모르겠습니다. 이 필드는 논평 할 공간으로 사용됩니까? 해당 필드가 ID 역할을합니까? id 또는 type있는 그대로 그냥 다른 필드의,JSON 스키마의 "설명"필드의 목적은 무엇입니까?

{ 
    "id": "http://www.noodle.org/entry-schema#", 
    "schema": "http://json-schema.org/draft-04/schema#", 
    "description": "schema for online courses", 
    "type": "object", 
    "properties": { 
     "institution": { 
      "type": "object", 
      "$ref" : "#/definitions/institution" 
     }, 
     "person": { 
      "type": "object", 
      "items": { 
       "type": "object", 
       "$ref": "#/definitions/person" 
      } 
    "definitions": {   
     "institution": { 
      "description": "University", 
      "type": "object", 
      "properties": { 
       "name":{"type":"string"}, 
       "url":{ 
        "format": "uri", 
        "type": "string" 
       }, 
       "descriptionofinstitution":{"type":"string"}, 
       "location": { 
        "description": "location", 
       "type": "string", 
       "required": true 
       } 
     } 

} JSON 모든 것을에서

+0

예를 게시 할 수 있습니까? –

답변

0

데이터, 그래서 description라는 필드에 특별한 아무것도 없다.

물론 description은 도메인에서 특별한 의미가있을 수 있지만, JSON에 관한 한 다른 속성 일뿐입니다.

1

id가 충분하지 않은 경우 특정 항목과 관련된 지식을 향상시키기 위해 추가 설명이 필요할 수 있습니다. 물론 코드 자체의 코드 동작에 영향을주지 않습니다.

14

JSON 스키마 사양 (http://json-schema.org/latest/json-schema-validation.html#anchor98)에 따르면 "설명"(및 "제목") 필드의 목적은 사용자 인터페이스 이 사용자 인터페이스에서 생성 된 데이터에 대한 정보 타이틀은 바람직하게는 짧을 것이고, 설명은이 스키마에 의해 기술 된 인스턴스의 목적에 대한 설명을 제공 할 것이다.

+0

또한 json-schema 파일에서 직접 문서를 생성 할 때 매우 편리 할 수 ​​있습니다! –

+5

이것은 정답입니다. 그러나 나는 받아 들인 것을 변경할 수 없습니다. –