RAML - error


#1

Hi,

I am new to RAML and was trying out simple example but getting error, can you please pointout where am I making mistake?

Error:
Could not find expected ‘:’

Below is the code:

#%RAML 0.8
#baseUri: http://mocksvc.mulesoft.com/mocks/dfc086ce-f9ad-45a9-b466-3a6b1c7ee74d
title: Test API
version: 1.0.0
baseUri:https://sample.s3.amazonaws.com
/orders:
  displayName:Order
  post:
    description: POST operation adds an object to a specified bucket using HTML form.
    body:
      application/x-www-form-urlencoded:
        formParameters:
          AWSAccessKeyID:
            description:AWSAccessKey id of owner
            type: string
          acl:
            description: Specified Amazon S3 access control list.
            type:string
          file:
            - type:string
            description:Text content
            - type: file
              description:file to upload
              
  get:
    description: GET operation returns all s3 buckets in a list
  /{bucket-id}:
    get:
      description:The bucket-id GET operation returns the metadata of a specific bucket.

#2

First, you need to add a space between a key and a value. For example, between baseUri (key) and https://... (value). That seems to go on through your RAML.

Second, the value of a named parameter (eg formParameters) is a map, not a sequence. So the file form parameter contains a sequence (starting with -), but it needs to be a map, and therefore it can’t be two different types. Choose one.

Third, it seems that the parser rejects URI parameter with - in it. So just remove it.

That should be valid now:

#%RAML 0.8
#baseUri: http://mocksvc.mulesoft.com/mocks/dfc086ce-f9ad-45a9-b466-3a6b1c7ee74d
title: Test API
version: 1.0.0
baseUri: https://sample.s3.amazonaws.com
/orders:
  displayName: Order
  post:
    description: POST operation adds an object to a specified bucket using HTML form.
    body:
      application/x-www-form-urlencoded:
        formParameters:
          AWSAccessKeyID:
            description: AWSAccessKey id of owner
            type: string
          acl:
            description: Specified Amazon S3 access control list.
            type: string
          file:
            type: string
            description: Text content
  get:
    description: GET operation returns all s3 buckets in a list
  /{bucketId}:
    get:

#3

Thanks a lot Christian_vogel that cleared some of my basics.