Skip to content
This repository has been archived by the owner on Mar 5, 2020. It is now read-only.

Add singleton file_path method to contents resolved by include #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

polmiro
Copy link
Contributor

@polmiro polmiro commented Mar 30, 2015

I have my RAML splitted into multiple files and my schemas also using the $ref to be able to re-use and share JSON schemas across different endpoints. An example of these would be:

{
  "$schema": "http://json-schema.org/draft-04/schema",
  "type": "array",
  "title": "Devices",
  "description": "List of devices",
  "maxItems": 1,
  "items": {
    "$ref": "./model.json"
  }
}

The relative referenced file "model.json" is currently used in other schemas. This is something that I think happens too with the raml-js-parser. The issue comes up when the RAML parser resolves the !include reference to the schema. The "relativeness" of the internal "./model.json" path is lost when this happens, because there is no way to know where the schema was living before it was read.

This topic has a few threads open, but I haven't been able to yet find a clear solution for the implementation.

This is definitely not ideal, but the solution I have found, is to add an instance method to the eigen class of the value that holds the schema. This way the location from where it was included can be recovered.

If you have any other ideas on how to approach this I'm more than happy to give it a shot.

@polmiro
Copy link
Contributor Author

polmiro commented Mar 30, 2015

Maybe @sichvoge would have some ideas?

@sichvoge
Copy link

I don't have an answer right now - give me some time and I come back to you ;)

@polmiro
Copy link
Contributor Author

polmiro commented Apr 7, 2015

any news on this @sichvoge ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants