QuestionQ56

VerifiedDesign and implement API-led integrations

Refer to the exhibit.

This RAML fragment defines a Book data type used in a RAML API specification. An API implementation is created for that RAML API specification.

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

Question Image

Explanation

In RAML 1.0, object properties are required by default; a trailing ? in a property declaration (here ID? and publisher?) marks that property as optional. A valid Book instance must therefore supply title (string), author (string), year (integer), and the explicitly required ISBN (string). A JSON object containing exactly ISBN, year, title, and author with correctly typed values satisfies the type. The ? suffix is declaration syntax only — the actual JSON keys for the optional properties are ID and publisher, so keys written literally as "ID?" or "publisher?" do not match those declarations, and objects that omit required properties or contain malformed syntax (missing commas, unkeyed nested objects) are not valid input.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!