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

$RefParser.Options type info doesn't support custom resolvers #151

Closed
chriswa opened this issue Feb 12, 2020 · 3 comments
Closed

$RefParser.Options type info doesn't support custom resolvers #151

chriswa opened this issue Feb 12, 2020 · 3 comments

Comments

@chriswa
Copy link

chriswa commented Feb 12, 2020

$RefParser.Options.parse has [key: string], but $RefParser.Options.resolve does not.
The result is that and usage of custom resolvers will result in problems being reported by code intel and linting unless the user adds linting exceptions.

@chriswa
Copy link
Author

chriswa commented Feb 12, 2020

@chriswa
Copy link
Author

chriswa commented Feb 12, 2020

Code demonstrating problem:
await parser.bundle(inputFilepath, { resolve: { myResolver } })

@ahsan-babar
Copy link

ahsan-babar commented Jan 1, 2021

@chriswa I'm not sure about how to use Custom Resolver while dereferencing. The example provided is not sufficient.
Do I have to make a pull request of my Custom Resolver? Or I can keep the Custom Resolver Locally somewhere in my code base.

My problem is:
I have a JSON schema having two different Http Server URLs as $ref. Both URLs/hosts(http://192.168.10.1:9200/data1, http://192.168.10.2:9200/data2) need separate Http Request headers for Authorization.

dereference only supports single header type field and applies same headers to all the $ref URLs. I want to make a custom resolver that take key-value pair of headers against URLs as argument and decides which headers should be used against the $ref URL.

const JSONSchema = { "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "data1": { "$ref": "http://192.168.10.1:9200/data1", "title": "data1" }, "data2": { "$ref": "http://192.168.10.2:9200/data2", "title": "data2" }, }, "required": ["data1", "data2"], "title": "data", "type": "object" };

I'll be grateful for your help.

@jonluca jonluca closed this as completed Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants