Closed amr closed 10 years ago
Sorry for the delay! I think it will be solved in PR #4, when it gets merged in. As I state there, I think the real issue is to be fixed in the raml-parser module, ie. by allowing you to specify a path when parsing RAML from a string.
Fixed.
Thanks for the heads up, but as you noted in #4, this doesn't fix this issue of including JSON schemas.
Yes, this PR should fix your issue. The other problem is when you import a json-schema from another json-schema.
Raml-parser only allows you to get the json-schema as string and if you want to parse it with another plugin you don't know the path of the file.
But again if the issue is to load a json-schema from a raml file with a relative path should be fixed with the https://github.com/walling/gulp-raml2html/pull/4
@amr, do you have a concrete test case that exhibits the error you are experiencing when including JSON schemas. It should be solved by #4, I think. Please try it out with the latest gulp-raml2html.
@RePoChO, I think you right. Once again, it really should be solved in raml-parser and not in this module, since my only mission is to package raml2html for gulp usage. The issue though is that gulp use virtual files and raml-parser is programmed to work directly with file system or with a string (ignoring the path). There really should be an option to parse a string and providing a path as well. I'm not sure if they have a similar issue regarding JSON schemas, so they need to pass the path to the JSON schema parser, so it can recursively include other JSON schemas. I'm not really into their code base, I'm only hypothesizing here.
I'm going to retest with latest master and update you.
Hi,
I encountered a problem in resolving my
!include
statements. The error:The directory structure is:
In my
spec.raml
file, I include the JSON schema relative to the location of theRAML
file, therefore:!include ../json-schema/account.schema.json
My gulpfile:
It appears to me that the problem is that while processing, the tools involved lose track of the base path to use when resolving includes. A quick & dirty fix I applied is changing the
cwd
manually. The new relevant code ingulpRaml2html
looks like this:That probably is not the right fix, but I'm not able to pin point where the correct fix should go.