Concrete example of RAML 1.0 Example DataType

798 views Asked by At

I didn't found any suitable example where Example is being used as DataType properly inside main RAML file. Mostly it's being used as .json/.xml file. Is there any proper detail or reference where I could find that. Using AnyPoint Platform design center to build RAML.

Below pasting screenshot of selection point where we can select Example as DataType.

enter image description here

1

There are 1 answers

0
aled On

There is a page dedicated to ways of defining examples in the documentation (Guide to Defining Examples in RAML 1.0). I guess that what are asking for is a sample of how to use NamedExample:

api.raml:

#%RAML 1.0
title: test
types:
  A:
    properties:
      givenName: string
      familyName: string
    examples: !include fragment.raml

fragment.raml:

#%RAML 1.0 NamedExample
fullName:
  givenName: ”Chiaki”
  familyName: "Mukai"

otherFullName:
  givenName: "Kyung-won"
  familyName: "Park"

I recommend to also read the page Common Problems Found in RAML 1.0 API Specifications that also describes some common mistakes when trying to use examples incorrectly and how to solve them.