Mulesoft Certified Developer Mcd · Free Practice Question Hard
Question 10
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
- #%RAML 1.0
- title: Books
- types:
- 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
-
B
- #%RAML 1.0title:
- Bookstypes:
- 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
-
C
- #%RAML 1.0title:
- Bookstypes:
- Book: bookDataType.raml
- /books:
- post:
- body:
- application/json:
- type: Book
- examples:
- input: !include bookDataType.raml
- responses:
- 201:
- body:
- application/json:
- example:
- message: Book added
-
D
- #%RAML 1.0title:
- Bookstypes:
- Book: !include bookDataType.raml
- /books:
- post:
- body:
- application/json:
- type: Book
- examples:
- input: !include bookDataType.raml
- responses:
- 201:
- body:
- application/json:
- example:
- message: Book added
Reveal correct answer
Correct answer: A
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 !include like:
types:
Book: !include bookDataType.raml and
examples:
input: !include bookExample.raml
Reference: INCLUDES section under https://medium.com/raml-api/raml-101-libraries-and-datatypes-fragments-1889b2e82c27
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
