Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support specifying a base URI explicitly to the CLI #669

Closed
koteez opened this issue Mar 20, 2020 · 2 comments
Closed

Support specifying a base URI explicitly to the CLI #669

koteez opened this issue Mar 20, 2020 · 2 comments
Labels
Enhancement Some new desired functionality

Comments

@koteez
Copy link

koteez commented Mar 20, 2020

Hi,

I have a json schema that depends on other files that are located in the same directory. Running the CLI I got an issue because the resolver is trying to load the file from the same URI as my main script. As I am working locally I didn't have a server serving the schemas and thus the resolution fails.

{
 "ArrayA":{
    "type": "array",
     "items": {
	  "$ref": "common.json#/definitions/ObjectB"
      }
   }
} 

Using file: require to put the absolute path which is a non-sense inside the schema definition.
What could be intesting to do is having a parameter to the CLI so that we can override the base_uri with $PWD value which will work.

Thanks & regards

K

@Julian Julian added the Enhancement Some new desired functionality label Mar 28, 2020
@Julian Julian changed the title Override the base_uri for external file resolver Support specifying a base URI explicitly to the CLI Mar 29, 2020
Julian added a commit that referenced this issue Oct 15, 2020
@sirosen
Copy link
Member

sirosen commented Feb 21, 2022

I believe -- I'm not totally certain -- that the local file resolution behavior used in check-jsonschema would fit this.
When a local schemafile is used, it sets the resolver to use a base-ref pointed at the filename.

I'm aware this issue is pretty old, but I'd love to hear from the OP if this works.

I am the author of check-jsonschema and we are currently discussing making it the official CLI for jsonschema. For details, you can follow #910. If check-jsonschema has a behavior which you believe should be changed to handle your use-case, please open an issue!

@sirosen
Copy link
Member

sirosen commented May 24, 2022

We're going to move forward and begin calling check-jsonschema the official CLI. I'm therefore closing this as a wontfix. I believe that the behavior in check-jsonschema is sufficient. If not, I'm happy to take a bug report on that repo.

@sirosen sirosen closed this as not planned Won't fix, can't repro, duplicate, stale May 24, 2022
Julian added a commit that referenced this issue Apr 25, 2023
6afa9b38d Merge pull request #664 from santhosh-tekuri/empty-tokens
e4bceb1ad Bump the python-jsonschema version used for the sanity check.
8025fc0d5 Merge pull request #128 from iainbeeston/foundations-of-json-schema-paper
cf7677078 Make all root $ids absolute URIs
07fd389a3 Added test cases from Foundations of JSON Schema research paper
1008edcee ref: test empty tokens in json-pointer
9beb3cfba Merge pull request #627 from json-schema-org/ether/output-readme-fixes
f2b0490ba minor edit to trigger gh action
c305ce54f Merge pull request #669 from hauner/typo
5e2845c1e Merge pull request #668 from hauner/if-without-then-else-creates-annotations
2f1df2293 typo
c1fae0022 test unevaluated* can see annotations from if without then/else
987a4c8fc Merge pull request #666 from json-schema-org/gregsdennis/file-refs
90b2a58ce fix *nix uris
68d18c6ac rename tests to fix sanity check
e9166bcbe fix indentation
1d1ec749a add file-id ref tests
fb60ed17c Merge pull request #663 from json-schema-org/ether/restore-format-tests
f32cd8b80 Revert "Revert "by default, "format" only annotates, not validates""
47958f82d Merge pull request #654 from santhosh-tekuri/output-escape
5262997e1 Merge pull request #661 from santhosh-tekuri/2019-output
ce2c16573 output-tests: correct 2019 output-schema.json
c9d943856 output: ensure ~ and / are escaped in json-pointer
f6b2324bf minor spelling and markdown formatting fixes; `valid` has also been removed from the tests

git-subtree-dir: json
git-subtree-split: 6afa9b38d84d45550ec703123eb4e8ec67a8ae75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Some new desired functionality
Projects
None yet
Development

No branches or pull requests

3 participants