-
Notifications
You must be signed in to change notification settings - Fork 52
Counterpart of dereferenceSchemas
in raml-js-parser-2 ?
#598
Comments
There is currently no way to join all JSON schemas into a single big file. Why do you need it? Maybe there is some other way to achieve the goal? |
We are building new API definitions with RAML, but those APIs use well-established JSON Schema models that are used throughout all of our systems (mostly in async event communications, not in RPC-style). API consumers are not very familiar with those models and while I agree that JSON Schema is not a very good format to document the model, it is the best what we have now. For this case, navigating nested schemas is awkward (as it is not supported by generated documentation). Essentially, JSON schemas are opaque blobs for RAML and that limits the integrations that we would like to do. Ideally, I would like to have a datatype that is defined as JSON Schema (possible today) and can also be referenced by JSON Schema id. In the other datatype or method body definitions that use JSON Schema, parser would extract nested $refs and backreference them to corresponding data types. For example:
Now, in generated API documentation I would be able to navigate to User and Account from Transaction. This functionality is implemented for RAML 1.0 data types, but we can't move all our data model definitions to RAML for multiple reasons. I believe that such integration will be appealing for many people who use JSON Schema as there are no good tools for generating documentation from schemas on the market, and for RAML tooling its just an incremental step that (in my opinion) brings an enormous value. |
I'm also waiting for some JSON schema parsing functionality. Having to manually dereference schemas and figure out where everything goes adds a lot of mess to the code since we're going back and forth between the raw spec and parsed result. |
@cascer1 Were you able to figure out how to dereference the schemas manually? It seems that some support for that was added ( I'm using api-console to render RAML and it is still not clear to me how dereferencing should happen. Api-console uses However, approaching this in RAML parser is intimidating. There's very little useful documentation. What's the difference between |
As we can see from the descriptuon of the methods,
Documentation of Api type. As we can see right in the top of the documentation screen, Regarding the dereferencing: the dereferencing itself can be done by calling the All in all, which format do you use: top-level or JSON, and what do you want to get as a result? |
Thank you! I have seen these links, but the information there is not self-explanatory for an outsider person like me. For example, it is not clear to me what is the Typed fragment. I suspect it is Further, the
Yes I meant by that an actual [recursive] substitution of $refs with JSON blobs. I don't need to reference RAML types from JSON Schemas.
I simply want JSON Schemas to be expanded so that a reader does not need to manually chase ref links to understand the schema, exactly the sam as it was done by Edit: I did find the https://github.com/raml-org/raml-js-parser-2/blob/master/documentation/GettingStarted.md that I missed initially , and it is a much better tool to get some basic API understanding. |
Typed fragments are a part of RAML language. Here are more details in the spec: Typed fragments
Good catch, I actually provided you with the link for 0.8 version of
As I said, it is not supported at the moment. It looks like more and more people ask for it, though, so we'll see what we can do. |
ok, looking forward to the solution. |
Hiya. I'm new to using this code, and would also find it useful to have what @tfayruzov describes. Did it ever get added? |
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. |
I want to expand json schema definitions with refs similarly to what have been done in 0.8 parser with
dereferenceSchemas
flag. Is there a counterpart in 1.0 parser?I tried to look at the options, but it does not seem to have what I need.
The text was updated successfully, but these errors were encountered: