Exam MCD - Level 1 All QuestionsBrowse all questions from this 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?

    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
AntarJalilOption: A

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.

ExamDevOption: A

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

I agree. Good observation regarding the "?"