Skip to content

$ref works with external files? #41

@maurogeorge

Description

@maurogeorge

Hi guys,

I think I found a issue, with a response:

{"name":1,"description":"Description 1"}

And passing the file

{
  "properties": {
    "name": {
      "$ref": "test/support/schemas/custom/show.json#/properties/name"
    },
    "description": {
      "$ref": "test/support/schemas/custom/show.json#/properties/description"
    }
  }
}
# test/support/schemas/custom/show.json

{
  "properties": {
    "name" : { "type" : "string" },
    "description" : { "type" : "string" }
  }
}

This is valid on json_schema, as you can see the name on response is a integer and in the schema is a string. If I change the schema to this:

{
  "properties": {
    "name" : { "type" : "string" },
    "description": {
      "$ref": "test/support/schemas/custom/show.json#/properties/description"
    }
  }
}

I got the expected error.

After some debug if I change the $ref to non existent files, it is still considered a valid response:

{
  "properties": {
    "name": {
      "$ref": "foo"
    },
    "description": {
      "$ref": "bar"
    }
  }
}

I only got a error RuntimeError: RuntimeError: #: "test/support/schemas/custom/show.json#/properties" is not a valid schema. when I change the schema to this:

{
  "properties": {
    "$ref": "test/support/schemas/custom/show.json#/properties"
  }
}

If I change the value to /test/support/schemas/custom/show.json#/properties, /custom/show.json#/properties or custom/show.json#/properties always I got the error, never is found the file.

Thanks for the working on the project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions