-
Notifications
You must be signed in to change notification settings - Fork 52
Consistency on array type interpretation #731
Comments
Not sure that I completely missed something but both outputs you posted have |
Right, bad copy paste ;) |
OK if that's the case, I actually think that items should be an So my suggestion is that the outcome should be: "Library": {
"name": "Library",
"displayName": "Library",
"typePropertyKind": "TYPE_EXPRESSION",
"type": [
"object"
],
"properties": {
"id": {},
"books": {
"name": "books",
"displayName": "books",
"typePropertyKind": "TYPE_EXPRESSION",
"type": [
"array"
],
"required": true,
"items": {
"type": "Book"
}
}
}
} |
And in the newer improved schema, that you get calling @ddenisenko we should avoid using |
Note that raml-js-parser-2 has been deprecated, the new official parser is webapi-parser. Feel free to attempt to reproduce this issue with webapi-parser and report any issue you may have on that repository. |
Uh oh!
There was an error while loading. Please reload this page.
Today I stumbled on an issue on
array
type parsing. While using theraml2html
lib that depends on the parser as well as thedatatype-expansion
, I have discovered that the[]
syntax and the array/items notation don't produce the same output out of the parser.Let's take this RAML:
It will produce the following Library type after going through the parser:
But if I use the
[]
notation, with the following RAML:I get the following Library type:
The difference is that in one case, the
items
field is an array and in the other, it is a string.I wouldn't bother having two different syntax, but the issue is that the
datatype-expansion
'scanonicalForm
method doesn't support the array notation:becomes that:
Whereas this (obtained when using the
[]
syntax):Becomes that (which is the expected result):
The text was updated successfully, but these errors were encountered: