salesking / json_schema_tools

Tools for building and handling a JSON Schema powered API's
27 stars 9 forks source link

$ref not honoring absolute or relative paths (for files) #16

Open VidurMalik opened 9 years ago

VidurMalik commented 9 years ago

Example:

Directory Structure

  SCHEMA_PATH/v1/child.json
  SCHEMA_PATH/v2/child.json
  SCHEMA_PATH/v2/parent.json

If parent.json references v2/child.json, the current implementation of RefResolver::find_local_file_path will return v1/child.json instead of the expected v2/child.json. It will also return v1/child.json even if the absolute path to v2/child.json is specified in the $ref.

schorsch commented 9 years ago

How is your path in the schema markup? we resolve a path downwards or on the same dir from a current schema. So as far as i see not up an down. Take a look at the specs: https://github.com/salesking/json_schema_tools/blob/master/spec/schema_tools/ref_resolver_spec.rb#L61

or this schema: https://github.com/fidor/fidor_schema/tree/master/schema/v1.0

=> https://github.com/fidor/fidor_schema/blob/master/schema/v1.0/transaction.json