양봉장 : JSON 응답 필드가 무엇인지 문서화 할 수 있습니까?
-
21-12-2019 - |
문제
실제 JSON 필드가 나타내는 것을 문서화하고 싶습니다.
i GET 문 및 매개 변수를 문서화했지만 사용자에게 제공하는 완벽한 문서를 작성하지는 않습니다.
그래서, 아래의 예에서 "다른 필드"에 대한 의견을 추가 할 수 있습니다.이게 지원됩니까?또는 다른 곳에서는 동반자 문서를 만들어야합니까?
## View Applications [/cat{?sort}{&order}{&page}]
### List all Applications
### Get List of Applications [GET]
+ Parameters
+ sort (optional, string) ... `sort` parameter is used to specify which criteria to use for sorting. One of the following strings may be used:
`"NAME",
"RATING", "QUALITY" ,
"RISKLEVEL", `
+ order (optional, string) ... `order` parameter is used to specify which order to use if sorting is used. One of the following strings may be used:
`"ASC",
"DESC"`
+ page (optional, int ) ... `page` parameter is used to request subsequent catalog pages.
+ Response 200 (application/json)
{
"Catalog" : {
"Page" : 0,
"Count" : 6,
"Applications" : [{
"UID" : "6882e96a-5da1-11e3-1111-3f24f45df3ad"
"OtherFields: ""
}]
}}
. 해결책
업데이트 : MSON 구문 를 사용하여 속성 설명의 베타를 방금 출시 해 왔습니다.
원래 페이로드는
로 설명 될 수 있습니다.### Get List of Applications [GET]
+ Response 200 (application/json)
+ Attributes
+ Catalog (object)
+ Page: 0 (number) - Number of the page
+ Count: 6 (number) - Count of *Lorem Ipsum*
+ Applications (array) - Some array of something
+ (object)
+ UID: `6882e96a-5da1-11e3-1111-3f24f45df3ad`
+ OtherFields
+ Body
{
"Catalog" : {
"Page" : 0,
"Count" : 6,
"Applications" : [{
"UID" : "6882e96a-5da1-11e3-1111-3f24f45df3ad"
"OtherFields": ""
}]
}
}
.
Body의 명시 적 JSON은 중복이며 완전히 건너 뛸 수 있습니다.API 청사진 사양 - 속성 자세한 내용은
다른 팁
아직 지원되지 않는다고 생각하지 않습니다.
I GET 요청 라인 위의 설명을 바로 위에 테이블을 넣어 테이블을 내 프로젝트 에서이 문제를 해결했습니다.귀하의 경우에는 다음과 같이 보일 수 있습니다 :
### List all Applications
| Field | Description |
|----------------------------------|---------------------------|
| Catalog.Applications.OtherFields | Documentation goes here.. |
### Get List of Applications [GET]
.
Markdown 테이블 생성기 Markdown Tables 생성기를 사용할 수 있습니다.
테이블 생성기에서는 테이블 정의를 파일에 저장할 수 있으므로 다음에 테이블을 편집 해야하는 테이블에서 시작할 수있는 테이블을 편집해야합니다.
제휴하지 않습니다 StackOverflow