Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RAML 0.8: optional resourceTypes methods support #101

Closed
alvassin opened this issue Apr 17, 2016 · 1 comment
Closed

RAML 0.8: optional resourceTypes methods support #101

alvassin opened this issue Apr 17, 2016 · 1 comment

Comments

@alvassin
Copy link

alvassin commented Apr 17, 2016

Following code with raise error InvalidParameterError: Response code '200?' must be an integer representing an HTTP code.:

resourceTypes:
  - base:
      get?:
        responses:
          200?:
            description: "The request has succeeded."

Also, if i would have both optional & required responses codes, i will get following error:

  File "/usr/local/lib/python3.5/site-packages/ramlfications/parser.py", line 561, in wrap
    responses=responses(data),
  File "/usr/local/lib/python3.5/site-packages/ramlfications/parser.py", line 457, in responses
    return sorted(response_objects, key=lambda x: x.code)
TypeError: unorderable types: int() < str()

Optional resource response codes are officially supported in RAML 0.8 as described:

When defining resource types and traits, it can be useful to capture patterns that manifest several levels below the inheriting resource or method, without requiring the creation of the intermediate levels. For example, a resource type definition may describe a body parameter that will be used if the API defines a post method for that resource, but the processing application should not create the post method itself.

To accommodate this need, a resource type or trait definition MAY append a question mark ("?") suffix to the name of any non-scalar property that should not be applied if it doesn't already exist in the resource or method at the corresponding level. This optional structure key indicates that the value of the property should be applied if the property name itself (without the question mark) is already defined (whether explicitly or implicitly) at the corresponding level in that resource or method.

Could you please fix that?

@econchick
Copy link
Contributor

Hey @alvassin ! Good catch, yes - this issue is already filed in #43 and is in the backlog for the 0.2.0 release. I'm going to go ahead and close as a duplicate, but let me know if anything else comes up!

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants