MCD - Level 1 Exam QuestionsBrowse all questions from this exam

MCD - Level 1 Exam - Question 154


Refer to the exhibit. This RAML fragment defines a Book data type that is used in a RAML API specification.

An API implementation is created for this RAML API specification.

What is valid JSON input for a request from a web client to an implementation of this RAML API specification?

Show Answer
Correct Answer: A

The valid JSON input must include all required properties specified in the RAML fragment and may optionally include the optional properties. According to the RAML fragment, 'ID' and 'publisher' are optional because they have a question mark (?, meaning they can be omitted). However, 'ISBN', 'title', 'author', and 'year' are mandatory fields. Option A includes all required properties ('ISBN', 'title', 'author', and 'year') correctly, making it the valid JSON input.

Discussion

2 comments
Sign in to comment
ExamDevOption: A
Jan 24, 2024

The correct answer is A. CANNOT SEND "id?" or any kind of "?propName" like that. Also publisher and id are not required so no need to send them

Alandt
Feb 6, 2024

I agree. Good observation regarding the "?"

AntarJalilOption: A
Jan 28, 2024

Correct answer “A” As per the RAML specification, the question mark denotes that a property is optional in this context. To illustrate, consider the example: ID?: integer. # optional property; equivalent to -> # ID: # type: integer # required: false Moreover, in question #94, a valid example is presented for the same type. It's worth noting that in that example, the ID and publisher lack a trailing question mark (?) as seen on the right.