Skip to content

Using relative file paths in refs #202

@dcharkes

Description

@dcharkes

Hey! I love this package, and I've been playing around with it to validate JSONs and schemas.

However, I can't seem to use relative paths in refs.

/// Prepends inherited Uri data to the ref if necessary.
Uri _translateLocalRefToFullUri(Uri ref) {
// TODO: add a more advanced check to find out if the $ref is local.
// Does it have a fragment? Append the base and check if it exists in the _refMap
// Does it have a path? Append the base and check if it exists in the _refMap

It turns _SimpleUri (../../../hook/lib/schema/build_output.schema.json) into _Uri (/hook/lib/schema/build_output.schema.json).

I'm probably holding it wrong. (I don't have $ids for example, and these seem to be used in resolution.) I'm trying to reproduce the behavior I get with the default JSON editor in VSCode, but that seems to work with relative paths in schemas.

Repro:

https://github.com/dart-lang/native/blob/299b683e1c3a8224f2566d803e1431adc3bf37a7/pkgs/code_assets/test/schema/schema_test.dart#L25-L38

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions