Giter VIP home page Giter VIP logo

Comments (6)

mnot avatar mnot commented on August 29, 2024

? indicates form-style query expansion, and non-matching query parameters are unordered (i.e., the forms above are all considered equivalent).

Perhaps you're reading too much into the example variable name 'list' in the spec?

from uritemplate-test.

awwright avatar awwright commented on August 29, 2024

@mnot But what about in the / operator in that test? It permits either /person or /albums to be first.

Meanwhile, none of the examples in spec-examples.json permit reordering, e.g.:

["{/list*}", "/red/green/blue"],

I'm researching the reversible subset of URI Templates, and this inconsistency means I can't get both tests to pass.

from uritemplate-test.

mnot avatar mnot commented on August 29, 2024

OK, so I think this is more about the explode modifier (*), which says:

An explode modifier applied to a list variable causes the expansion to iterate over the list's member values.

... So on the face of it, the options starting with /albums/person should be removed.

@damnhandy, you added these in #5. Any thoughts? It would be interesting to see if any implementations broke if we moved these into negative-tests.json...

from uritemplate-test.

mk-pmb avatar mk-pmb commented on August 29, 2024

I as well expect order to be kept. Otherwise it would totally break paths, and also elements from a listbox form element whose ordering users have chosen carefully.

from uritemplate-test.

damnhandy avatar damnhandy commented on August 29, 2024

@mnot I think I agree with you here. I can probably test this out later in the week. I suspect a lot of implementations would maintain declaration order so I don't think there'd be a lot of breakage. This would need some more testing beyond a single implementation.

@awwright for years, I've had a feature request for my implementation to do reverse matching. It's issues like this one that made it more effort that it was probably worth to invest time into. The more complicated the template, the tougher the match. Had there been more specifics around ordering, it might have been easier to implement.

from uritemplate-test.

awwright avatar awwright commented on August 29, 2024

@damnhandy Yeah, as far as I can tell, the ordering is the final problem for reversing URI templates. Certain features are difficult to implement (re-using a variable increases the computational complexity from linear to exponential) or impossible (substrings). But for the most part, it's entirely possible, so long as it's deterministic (either everything needs to be an unordered set, or it needs to preserve the list ordering).

from uritemplate-test.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.