-
Notifications
You must be signed in to change notification settings - Fork 64
json-refs v2.0.0 Planning #42
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
Comments
Let me know how I can help. I would be happy to participate/contribute. |
What do you think of supporting a non-standard but pre-compile feature (which leverages the reserved nature of the tilde) to allow for run-time substitutions? One deficiency I've found with JSON references is in handling locales where the exact item to reference is dynamic. Maybe something like jsonRefs.resolveRefs({$ref: '...'}, {substitutions: {var1: 'value1', '=var2': 'value2'}); which could work on {"$ref": "#/some/path/~var1~/~=var2~"} ..and whereby the "=" would add escaping such that, within the "=var2" variable value, any "/" would become " While this does rely on some dynamic properties (by necessity), it still does support the declarative nature of JSON references and produces valid output JSON. And perhaps another method could apply substitutions to create valid JSON references without resolving them. My particular use case is in supporting a work around for the current lack of support for the i18n proposal made at https://github.com/json-schema/json-schema/wiki/multilingual-meta-data-%28v5-proposal%29#user-content-concerns whereby a JSON reference might be structured like {
"localization-strings": {
"en": {
"example": {
"title": "Example schema",
"description": "Example schema description"
}
},
"de": {
"example": {}
}
},
"type": "object",
"$ref": "#/localization-strings/~=lang~/example"
} |
I think we should collapse the What do you think of having a |
I think it is relevant to keep having an API for conveniently distinguishing relative and absolute pointers, both as a utility and as config passed to methods like What did you think of my suggestion (or was the (Btw, it seems like |
I do plan on having a way to distinguish between different pointer types but having a function for each kind doesn't make sense to me. So instead of having a function for local, remote, relative, ..., we'll likely end up with a single function that returns the type so you could do |
As for your idea, it sounds extremely specific and doing this now within your application could be done with a simple preprocessor of the document. I'm hoping that my rewrite of |
I think that should be fine re: As far as my use case, I think variable substitution ought to be a pretty common scenario. And given the lack of i18n currently in JSONSchema, it really would help to have a modular (and hopefully increasingly recognizable) way of embedding locale or other such info where a portion is inevitably going to need to be dynamic (but still readily interpretable in static form). I was hoping json-refs could be the (unfailingly accurate) pre-processor :) Regarding consideraton of the API for variable substitution, although JSON Reference has no formal way of expressing such custom variables, I chose |
I'm not completely against it. Let me think about it a little more. |
I've been working on |
Maybe you could just tag your latest stable version. No big deal either way to me personally though... |
Already done. I tag every release and there were no unreleased changes. |
Hello all.
I would also like to use the same concept for The idea for these changes is to have a clear "local only" option and with consistent naming and then to have a "full fledged" option that will by default resolve all references, again with consistent naming. Of course, Thoughts? |
Your intent could be perhaps be made crystal clear by naming the local functions resolveLocalRefs and findLocalRefs. |
I started down that path and can't remember why I removed it. Maybe that's what I'll do when we have the remote-capable versions available. I'm all ears for other feedback as well. |
Do you think it's important to keep callback support for the asynchronous APIs? Promise-wrapped callbacks can be problematic in that errors thrown in them can never |
I think I'll remove callback support for a simpler API unless someone needs it. |
Haven't yet found time to check the API, but could the callbacks also be required to complete execution before executing the |
|
Ah--fine by me... |
Wouldn't there be a need for callback support for remote refs? Or are you just talking the find/resolveLocalRefs? |
In |
Oh sorry. I missed that. Then yes I would say remove them for clarity. |
Do any of you have a few minutes to join Gitter for a quick chat? |
I think
I will be adding examples to the source code so that the API documentation is updated accordingly. Until then, feel free to look at the unit tests to see how the APIs are used. If I've not heard any objections shortly, I'll likely cut a |
I have updated the API documentation linked above to include examples for all "complex" APIs, including examples of the new/updated |
FWIW, I do plan to take a look, Jeremy, but busy with some other projects ATM... |
Same with me. Will get to it post holiday break. Thanks for all the hard work. |
No rush. I appreciate your feedback. |
Besides the PR and issues just reported, it all looks very good to me. Nice job! And thanks for addressing the desire for the *At retrieval methods. |
Thanks a lot. If I don't hear from anyone else, once I've addressed your issues/PRs, I'll likely cut |
Thanks for all of your feedback and help. Please review the release notes to see how your existing |
Congratulations on the release! Appears nice and robust... |
It's not perfect. I'm sure I'll end up with a few patch releases today as I run into consistency issues now that I'm upgrading sway to use it. Bear with me. |
I think it's time to plan for json-refs v2.0.0. Long story short, json-refs started life really as a utility for swagger-tools. As people have began to use it, we've tacked on new features, fixed bugs and a number of other things...things that were not originally planned. The project has evolved and now we must take a step back and create a release with these features planned in from the beginning. My plan is to start working on this now and update you with the changes that happen. Feel free to request new features/ideas/options/... in this thread.
Initial plans:
#
and that needs to be handled to.)I'm copying all who have filed bug/feature requests and PRs as I think your opinion is invaluable.
@brettz9
@HyperBrain
@ippeiukai
@IvanGoncharov
@mjkaye
@mohsen1
@NadavK
@parky128
@Pharylon
@robotnic
@sacarro
@schrag
The text was updated successfully, but these errors were encountered: