0

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

Rizwan Shakoor
  • 63
  • 3
  • 10
  • Do you mean having a Data type of type example? – aled Sep 24 '21 at 21:24
  • Or how to use an example inside a DataType definition? – aled Sep 24 '21 at 21:35
  • @aled I meant DataType of example ( normally I try with Json and Xml but I want a way to define it like proper example dataType. as mentioned here. file:///var/folders/y5/9zqmn74j5dzdz3g7_b569gb00000gp/T/TemporaryItems/NSIRD_screencaptureui_ealFNK/Screenshot%202021-09-27%20at%2012.13.35%20AM.png – Rizwan Shakoor Sep 26 '21 at 19:15
  • I don't think you can attach a screenshot to comments, and it is a bad practice to use screenshots for source code, in stack overflow. The right way is to edit your question and add the snippets as text. – aled Sep 26 '21 at 20:59
  • @aled yes right. Actually I tried to paste link in comment but It didn't work. Now I have pasted screenshot. – Rizwan Shakoor Sep 27 '21 at 10:51

1 Answers1

0

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.

aled
  • 21,330
  • 3
  • 27
  • 34