나는 raml 문서를 가지고 있으며 해당 API에 새 API 문서를 추가하려고합니다.램 리소스에 대한 일반적인 응답을 포함하는 방법
기본 RAML 문서를 살펴 보았습니다.
나는 raml 파일을 가지고 있습니다.
#Filename: base.raml
title: Test RAML
documentation:
- title: Test RAML docs first time :)
content: This is RAML testing
baseUri: https://myportal.com/{version}/scriptmanagement
version: v1.0
mediaType: application/json
protocols: [ HTTPS ]
/test:
!include raml/test.raml
는 실제 raml 콘텐츠 RAML, 400
위에서
#Filename: test.raml
displayName: Test RAML Inheritance
description: Testing for RAML inheritance for responses.
get:
description: Get all TEST
headers:
name:
description: name required in each request
example: testname
required: true
responses:
200:
description: SUCCESS
body:
application/json:
example: |
{}
400:
description: BAD REQUEST
body:
application/json:
example: |
{"error": "Bad Request"}
500:
description: INTERNAL ERROR
body:
application/json:
example: |
{"error": "Internal Error"}
post:
description: Get all TEST
headers:
name:
description: name required in each request
example: testname
required: true
responses:
200:
description: SUCCESS
body:
application/json:
example: |
{"message": "Created"}
400:
description: BAD REQUEST
body:
application/json:
example: |
{"error": "Bad Request"}
500:
description: INTERNAL ERROR
body:
application/json:
example: |
{"error": "Internal Error"}
/{test_id}:
description: TEST DETAILS
get:
description: Retrieve resource own by x-user-name
headers:
name:
description: name required in each request
example: testname
required: true
responses:
200:
description: SUCCESS
body:
application/json:
example: |
{"message": "Details"}
400:
description: BAD REQUEST
body:
application/json:
example: |
{"error": "Bad Request"}
500:
description: INTERNAL ERROR
body:
application/json:
example: |
{"error": "Internal Error"}
test.raml
이고 500
응답이 일반적이고, name
헤더가 일반적이다.
한 번 작성하고 모든 리소스를 추가하려면 어떻게해야합니까? 나는 traits
과 <<:
모두 작동하지 않았다.
특징은 나를 위해 작동합니다! – Sachin
@Sachin은 답안에서'trait' 예제를 줄 수 있습니까? – Nilesh