Skip to content

How we check if a schema is local or online #138

@ghost

Description

From #137

The change to if schema_url.startswith("http") needs to be carried over. It's necessary to "fix(custom_jsonref_jsonloader): Read from filesystem if schema_url is a file path", because lib-cove has already messed around with the uri value by this point (IIRC), and checking schema_url directly is the only way to know if the URL is a file path or not.

Edit: Indeed - uri is parsed, and then uri is set to uri = urljoin(schema_url, ...). So, if schema_url is a file path, then "http" in uri_info.scheme will be True, even though the subsequent GET request will use a value of uri that's prefixed with a file path (i.e. no scheme). So, it's necessary to check schema_url instead of uri. This is more correct, even if this particular test doesn't need it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions