#%RAML 0.8
---
title: My Sample App
baseUri: http://somwhere.really.cool/{version}/
version: v1
protocols: [HTTPS]
mediaType: application/json
resourceTypes:
- member:
usage: This resourceType should be used for any member of collection.
get:
responses:
200:
body:
schema: <<resourcePathName | !singularize>>
example: <<exampleGetResponse>>
patch?:
body:
example: <<examplePatchRequest>>
responses:
201:
headers:
location:
type: string
example: /<<resourcePathName>>/1
/organizations:
/{id}:
type:
member:
exampleGetResponse: !include examples/organizations/response-get.json
examplePatchRequest: !include examples/organizations/request-patch.json
patch:
When the YAML file generated and a JSON is produced, the media type is not present for the method patch for path /organizations/{id}. If I remove the ?, the application/json appears in the parsed content:
Honestly, I really do not know exactly what I did there but it changed the parsed result in a way that the bodies now contain the default media type from the main RAML document when none are specified in my optional resources.
Hi there,
I think I discovered an issue.
Having the following:
When the YAML file generated and a JSON is produced, the media type is not present for the method
patch
for path/organizations/{id}
. If I remove the?
, the application/json appears in the parsed content:Incorrect
Correct
During my experimentation, I went to modify this file: https://github.com/raml-org/raml-js-parser/blob/master/src/resourceTypes.coffee#L54-L55
before
after
Honestly, I really do not know exactly what I did there but it changed the parsed result in a way that the bodies now contain the default media type from the main RAML document when none are specified in my optional resources.