MuleSoft
MCD-LEVEL-1 · Question #187
A company has defined two RAML fragments, Book Data Type and Book Example to be used in APIs. What would be valid RAML to use these fragments ? A. 1. #%RAML 1.0 2. title: Books 3. types: 4. Book…
The correct answer is D. 1. #%RAML 1.0 2. title: Books 3. Book: !include bookDataType.raml 4. /books: 5. post: 6. body: 7. application/json: 8. type: Book 9. examples: 10. input: !include bookExample.raml 11. responses: 12. 201: 13. body: 14. application/json: 15. example: 16. message: Book added. RAML file contains lot of information that could be considered as "not API-describing". Sort of "economy-class" members. Equally important, but not necessarily part of the main RAML file. Through !includes, RAML allows us to build file-distributed API definitions, which is not…
API Design
Question
A company has defined two RAML fragments, Book Data Type and Book Example to be used in APIs. What would be valid RAML to use these fragments ? A. 1. #%RAML 1.0 2. title: Books 3. types: 4. Book: ABC/Examples/bookDataType.raml 5. /books: 6. post: 7. body: 8. application/json: 9. type: Book 10. examples: 11. input: ABC/Examples/bookExample.raml 12. responses: 13. 201: 14. body: 15. application/json: 16. example: 17. message: Book added B. 1. #%RAML 1.0 2. title: Books 3. Book: !include bookDataType.raml 4. /books: 5. post: 6. body: 7. application/json: 8. type: Book 9. examples: 10. input: !include bookExample.raml 11. responses: 12. 201: 13. body: 14. application/json: 15. example: 16. message: Book added C. 1. #%RAML 1.0 2. title: Books 3. Book: bookDataType.raml 4. /books: 5. post: 6. body: 7. application/json: 8. type: Book 9. examples: 10. input: bookExample.raml 11. responses: 12. 201: 13. body: 14. application/json: 15. example: 16. message: Book added D. 1. #%RAML 1.0 2. title: Books 3. Book: bookDataType.raml 4. /books: 5. post: 6. body: 7. application/json: 8. type: Book 9. examples: 10. input: bookExample.raml 11. responses: 12. 201: 13. body: 14. application/json: 15. example: 16. message: Book added
Options
- A
- #%RAML 1.0
- title: Books
- types:
- Book: ABC/Examples/bookDataType.raml
- /books:
- post:
- body:
- application/json:
- type: Book
- examples:
- input: ABC/Examples/bookExample.raml
- responses:
- 201:
- body:
- application/json:
- example:
- message: Book added
- B
- #%RAML 1.0
- title: Books
- Book: !include bookDataTy
- /books:
- post:
- body:
- application/json:
- type: Book
- examples:
- input: !include bookExample.raml
- responses:
- 201:
- body:
- application/json:
- example:
- message: Book added
- C
- #%RAML 1.0
- title: Books
- Book: bookDataType.raml
- /books:
- post:
- body:
- application/json:
- type: Book
- examples:
- input: bookExample.raml
- responses:
- 201:
- body:
- application/json:
- example:
- message: Book added
- D
- #%RAML 1.0
- title: Books
- Book: !include bookDataType.raml
- /books:
- post:
- body:
- application/json:
- type: Book
- examples:
- input: !include bookExample.raml
- responses:
- 201:
- body:
- application/json:
- example:
- message: Book added
How the community answered
(27 responses)- A11% (3)
- B4% (1)
- C4% (1)
- D81% (22)
Explanation
- RAML file contains lot of information that could be considered as "not API-describing". Sort of "economy-class" members. Equally important, but not necessarily part of the main RAML file. * Through !includes, RAML allows us to build file-distributed API definitions, which is not only useful to encourage code reuse but also improves readability. * We can create RAML fragments with such code and then include them in main RAML project using Book: !include bookDataType.raml and input: !include bookExample.raml * Additionally for -------------------------------------------------------------------------------------------------------------------------------------- datatypes-fragments-1889b2e82c27
Topics
#RAML#!include directive#data types#fragments
Community Discussion
No community discussion yet for this question.