Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Jeremy Whitlock
    @whitlockjc
    The release notes will be updated before release and I'll be adding documentation on exactly how resolution works.
    Do you use options.relativeBase?
    Jarred Filmer
    @BrighTide
    Nope
    Jeremy Whitlock
    @whitlockjc
    I've added options.location that renders it useless.
    Was going to remove support for it.
    That's a breaking change for sure, requiring code changes by the user. But the new approach is better.
    Not required for use, just better.
    Jarred Filmer
    @BrighTide
    Anyway to translate between the two?
    Jeremy Whitlock
    @whitlockjc
    Maybe but the idea is if you tell me the location of what you're processing when not using an *At API, I use that to compute where to resolve relatives from.
    But there is a feature request to have a search path like what we have now but that wasn't its intent.
    Jeremy Whitlock
    @whitlockjc
    I'm going to bed. Let me know if you find anything that isn't working like you expect/want or you know is busted.
    Jarred Filmer
    @BrighTide
    :thumbsup:
    Jeremy Whitlock
    @whitlockjc
    I'm really excited.
    Jeremy Whitlock
    @whitlockjc
    I cannot guarantee it's not got any bugs but based on the test suite, everything works as expected. Performance was also a huge improvement.
    Brett Zamir
    @brettz9
    🎉 Look forward to a chance to check it out!
    Jeremy Whitlock
    @whitlockjc
    I just compared json-refs to a similar library and here are the results:
    Time spent (name-omitted): 43544 ms
    Time spent (json-refs): 831 ms
    That's only ~53 times faster.
    Brett Zamir
    @brettz9
    Excellent!
    Jeremy Whitlock
    @whitlockjc
    I'll be working on sway next.
    Since there are no rewrites, only updating deps and fixing bugs/features, it should be a much quicker cycle.
    I hope this is the last time I rewrite the json-refs resolver. ;)
    I do have to say the results are awesome. I'm not saying there won't be bugs or feature requests but it's the fastest, most accurate resolver json-refs has ever had.
    vaishnavi prasad
    @vaishnaviprasad
    Hi,
    Is anybody here?
    Im currently working on Swagger Spec(Its of JSON format)
    I was loooking to solve cicular references in it
    Will this npm module be of help?
    Could someone please suggest the right way to solve circular references in the swagger file and then parse it?
    @whitlockjc could you please help me /
    *?
    Jeremy Whitlock
    @whitlockjc
    json-refs@3.0.0+ support circular references.
    vaishnavi prasad
    @vaishnaviprasad
    Hi
    @whitlockjc
    can I get the ref pointers that contain circular reference?
    Jeremy Whitlock
    @whitlockjc
    Yep. Whenever you resolve references, the reference metadata will contain whether or not the reference is circular. Here is the API documentation: https://github.com/whitlockjc/json-refs/blob/master/docs/API.md#jsonrefsresolvedrefdetails--unresolvedrefdetails
    Paul Bryan
    @pbryan
    Hi!
    Jeremy Whitlock
    @whitlockjc
    Hey Bryan!
    Thank you for taking the time.
    Paul Bryan
    @pbryan
    No problem.
    Jeremy Whitlock
    @whitlockjc
    Long story short, json-refs is an NPM module for supporting JSON Pointers and JSON References. It was originally part of an OpenAPI/Swagger library but broken out into its own project for easier reuse.
    Paul Bryan
    @pbryan
    Alright, makes sense.
    Jeremy Whitlock
    @whitlockjc
    While working on OpenAPI tooling and even some direct consumers, it has been requested the ability to merge values resolved via $ref. Simple merging would mean allowing neighboring properties beside the $ref and merging the properties of the JSON Reference object and the resolved object. That use case seems simple, of course some ruling for conflicts where both have the same property.
    But I could see more complex use cases where the JSON Reference object had some excludes/includes capability and/or other things giving the author more control over the resulting object.
    Instead of doing this in a vacuum, I figured I'd reach out.
    Paul Bryan
    @pbryan
    Hmm, seems like semantically, would be better to have a "merge" operation take a JSON document as an argument (or $ref if external) and apply a merge.
    So, something like JSON Patch, but with somewhat different rules, such as how to handle conflicts, for example.
    Jeremy Whitlock
    @whitlockjc
    That's what I was thinking but couldn't the input be the $ref container itself? That's the use case first requested by customers.
    Paul Bryan
    @pbryan
    $ref was always intended to be, well, just a reference to some (often external) JSON document. The semantics were pretty much: treat this $ref as the referenced document itself.