Error while parsing RAML file : Unexpected key 'enum'


#1

Hi Team,

I am new to RAML.

I am facing an issue while parsing the RAML file with the following snippet in it. Also, the same snippet is showing error when the RAML file is imported to Intellij IDEA.

  allowed_shared_link_access_levels:
    description: 'Access level settings for shared links set by administrator. Can be collaborators, open, or company.'
    type: array
    items:
      type: string
    enum:
      - collaborators
      - open
      - company
    required: false

The below is the error (in BOLD) I am getting when parsing the RAML file or importing it to Intellij IDEA. And to be precise, the error is occuring at the enum declaration in the above RAML snippet.

Unexpected key ‘enum’. Options are : “default” or “description” or “displayName” or “example” or “examples” or “facets” or “items” or “maxItems” or “minItems” or “required” or “uniqueItems” or “usage” or “xml” or /((.+))/ or Any of :“type”,“schema”

Could you please let me know what could be the cause for this error OR Is the field ‘allowed_shared_link_access_levels’ not properly defined as per RAML specification 1.0 which is causing it to fail?

My many thanks in advance.

Warm regards,
Raman Palikala.


#2

I think what you want is to set your enum inside the items property definition. I.e.

  allowed_shared_link_access_levels:
    description: 'Access level settings for shared links set by administrator. Can be collaborators, open, or company.'
    type: array
    items:
      type: string
      enum:
        - collaborators
        - open
        - company
    required: false

#3

Hi Jonathan,

Thank you very much for your response.
I did the change as you suggested and I am able to parse the RAML file.
Once again my many thanks to you.

Warm regards,
Raman Palikala.