Should the ? symbol be considered part of the property name?


#1

IMHO this is a parser bug in app-workbench 0.8.28. I accidentally left a ? at the end of myProp and now the parser wants the example to say “myProp?”:“somevalue” instead of “myProp”:“somevalue”, otherwise it says “unknown property:myProp”.

#%RAML 1.0
mediaType: application/json
title: Test RAML
types:
  myClass:
    type: object
    properties: 
      myProp?:
        type: string 
        required: false
    example: 
      {
        "myProp?": "somevalue" 
      }

#2

Why would you put a ‘?’ in the property name? Are you trying to specify that it’s a query property? I don’t think it’s necessary. There’s a RAML directive called “queryParameters” for that. For query parameters, there is a ‘?’ at the beginning of the list of query params, and then they’re separated by ‘&’, so in any case the ‘?’ should not be at the end of the param.


#3

A ‘?’ in a property is short form for ‘required: false’.


#4

Hi, in RAML 1.0 (since RC2) its possible to have a question mark being part of the property name. That’s why you see that behaviour. The question mark only gets recognized as part of the name when you explicitly define required.


#5

Hi Christian,

Thanks for your response. If that’s the case then the parser is correct. I wonder who would intentionally want a question mark as part of a property name. Maybe property names with UTF-8 symbols might require ‘?’, but I can’t imagine occidental alphabet use cases.

Regards


#6

Agree :slight_smile: