RAML 1.0, Map types complex regular expression

非 Y 不嫁゛ 提交于 2020-01-05 11:09:22

问题


In my api, I have a type who contains a map of uuid->Drive. I have used a Map type[1] to define that :

type: object
properties:
  drives:
    required: false
    type: object
    properties:
      [(a-zA-Z0-9-)*] :
         type: Drive

That work but I would like to be more precise on the pattern. However I can't manage to have it working.

  • ["(a-zA-Z0-9){8}-(a-zA-Z0-9){4}-(a-zA-Z0-9){4}-(a-zA-Z0-9){4}-(a-zA-Z0-9){12}"]: Don't seems to be used as regular expression.
  • [(a-zA-Z0-9){8}-(a-zA-Z0-9){4}-(a-zA-Z0-9){4}-(a-zA-Z0-9){4}-(a-zA-Z0-9){12}]: Say Missed comma between flow collection entries

How can I use a complex expession in a Map type with RAML 1.0 ?

(I'm using API Workbench)

[1] http://docs.raml.org/specs/1.0/#raml-10-spec-map-types


回答1:


Using patternProperties instead of the alternative syntax I don't have any errors in my RAML. However it seems that, API Workbench validates nothing.



来源:https://stackoverflow.com/questions/35563875/raml-1-0-map-types-complex-regular-expression

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!