Closed dustinmoris closed 8 years ago
I saw this same issue but because I have always used the media type, I didnt think nothing of it. I see in the spec/examples where it shows that you can avoid using it if you declare the media type like you have, so I assume it should allow what you have here?
I am using the Anypoint platform to document my API. Perhaps it is an issue in the designer, but how can I validate that? What is the official way of validating my RAML?
@dustinmoris,
RAML looks valid according to the spec.
Here is the JSON output of RAML parser for the method:
...
"methods": [
{
"responses": {
"200": {
"code": "200",
"body": {
"application/json": {
"name": "application/json",
"displayName": "application/json",
"type": [
"MyType"
],
"repeat": false,
"required": true
},
"application/xml": {
"name": "application/xml",
"displayName": "application/xml",
"type": [
"MyType"
],
"repeat": false,
"required": true
}
}
}
},
"protocols": [
"HTTPS"
],
"method": "get"
}
],
...
So, this should work.
Checked in latest API Designer, and in the one deployed to Anypoint. Looks working too:
What exactly fails for you and in which tool?
@dustinmoris any news on that, or can i close it?
Yup that can be closed. Worked for me as well. Thank you!
Perfect! thanks!
Hi, I can't seem to get this working.
I have the following default media type at the top of my document:
mediaType: [ application/json, application/xml ]
Then I have a custom type declared:
Now I would like to specify that the response object of an API call will be of that type:
but unfortunately this doesn't seem to get parsed as valid RAML. It seems like I have to place the media type in between the body and type declaration, but that defeats the whole purpose of the default media type at the top. What am I doing wrong?