Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3637

How to pass RAML-trait-parameters for enum values?

$
0
0

I do have a RAML with several traits and resourceTypes. I do use the parameters there quite frequently. However, for one case I can't get it working.

Let's assume the following trait, named "testTrait":

#%RAML 1.0 TraitqueryParameters:  s:    type: array    items:      type: string      enum: <<parameterEnum>>

The enum: <<parameterEnum>> is the important part here.

This is used, beside many other working traits (which I don't mention here to keep the example simple), in the following resourceType (which shouldn't have an influence on the issue, as I do simply pass the parameter through).

#%RAML 1.0 Library...resourceTypes:  item-readonly:      get:        description: |<<descriptionGet>>        is: [          testTrait: {            parameterEnum: <<parameterEnum>>            }]

In this way, the trait "testTrait" is used in the API definition:

#%RAML 1.0.../services/:  /testServiceA/:    type:      ResourceTypes.item-readonly:        descriptionGet: A service to test Enum parameters in RAML.        parameterEnum: ???

What should I fill in for the '???' ?

I tested:

parameterEnum: [key,name]

Which resulted in error:

"Property 'parameterEnum' must be a string"

Changing to:

parameterEnum: "[key,name]"

leads to the error:

"'enum' facet value must be defined by array"

I'm stuck at this point. For other trait-parameters (used in traits for description, for types, etc.) I didn't have any problem.Any advice to point me to the right solution is appreciated.

I use Atom with API Workbench for the API definition.


Viewing all articles
Browse latest Browse all 3637

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>