raml-java-parser icon indicating copy to clipboard operation
raml-java-parser copied to clipboard

Optional response codes are not supported

Open alex-semenk opened this issue 8 years ago • 3 comments

RAML 0.8 specification (https://github.com/raml-org/raml-spec/blob/master/versions/raml-08/raml-08.md#optional-properties) allows to append a question mark ("?") suffix to the name of any non-scalar property to define it as optional in traits and types.

But currently raml parser treat optional response codes as invalid.

Example:

#%RAML 0.8
title: Example of API
traits:
  - SomeTraitName:
      responses:
        200?:
          description: Returned in the case of success.

Actual Result: validation error "Unexpected key '200?'. Options are : /<<(.+?)>>/ or Integer". Expected Result: valid RAML.

Note: Issue present for both 0.8 and 1.0 RAML versions.

Aha! Link: https://mulesoft-roadmap.aha.io/features/APIRAML-105

alex-semenk avatar Jan 16 '17 08:01 alex-semenk

Hi @AlexSemenk In Raml 0.8 is correct when defining RESOURCE TYPES and TRAITS

But in raml 1.0 this changed and it is only supported when you defining methods https://github.com/raml-org/raml-spec/blob/master/versions/raml-10/raml-10.md/#declaring-http-methods-as-optional

eleonoraortega avatar Feb 01 '17 15:02 eleonoraortega

This bug is resolved in snapshot versions? In our projects we used ? symbol. How to read raml 0.8 with optional responses?

RenatEskenin avatar Jun 19 '18 13:06 RenatEskenin

Hi, I also would need to have this fixed. Any plans?

mzampare avatar Dec 17 '18 16:12 mzampare