Closed xaka closed 8 years ago
Actually, RAML spec does not say that API has "relativeUriPathSegments" property. But I do not see any reasons for not introducing it for sake of compatibility.
I am wondering how that get introduced in 0.8? @xaka
this discussion is completely unnecessary.
the fact that the object returned by the raml parser includes any arbitrary property not defined in the raml spec hasn't got anything to do with the correctness of the parser:
RAML -> [ parser ] -> arbitrary representation of raml input
it's very likely that some of the properties will be there just for convenience and historical reasons. The objective of this task is to achieve as much compatibility with the output of the old parser in order to reuse existing tooling in the platform
with this new perspective, could you add the requested property?
@fmezas Sure, we'll add it.
@fmezas I d get your point, but failure in the past sometimes led us to decisions that no body understood. Someone looking at the spec and comparing it with the output WILL wonder why that is in. So what is the rationality to have it? What is this used for?
Not saying that I am against it, but just making decisions because it was there before does not get us anywhere if the thing that was there before is actually unnecessary. That would just lead us repeating the mistakes again. That is what I want to clarify here.
@xaka Do I understand it correct, that expected relativeUriPathSegments
is as follows:
/
as relative URI it's an empty arrayrealtiveUri.substring(1).split('/')
(I take .substring(1)
as relative uri always starts with /
by convention)?
Here is what we do in raml-js-parser:
pathParts = resource.relativeUri.split('\/');
while (!pathParts[0] && pathParts.length) {
pathParts.shift();
}
resource.relativeUriPathSegments = pathParts;
As you can see, we remove all empty segments, not only the first one.
Great, thanks!
RAML 0.8:
RAML 1.0: