0
votes

I am using Mule 4 and Anypoint Studio 7.

I am currently writing RAML and was looking to add a schema (validate) and example (mock response in API console) to a resource in my RAML but I am getting a generic error.

#%RAML 1.0 Trait
responses: 
  200:
    body: 
      application/json:
        schema: mySchema
        example: example/mySchema.json

Is it possible to use both the schema and example against a resource?

Thanks

1
you can add. but what error are you getting ?satish chennupati

1 Answers

1
votes

Here is an example

#%RAML 1.0
version: v1
title: something.raml

mediaType:
  application/json

uses:
  ResultsRS: path/StudentResultRS.raml


/students:
    /results/get:
      post:
        description: get the results of a student
          body:
            application/json:
              type: ResultsRS.tudentResultRS.raml
              examples: !include path/examples/studentresults_RS.raml

you need to make sure that you have properly defined the types and examples.