python-hyper / python-hyper/uritemplate
Potential bug/Unspecified behaviour
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 246
- Forks
- 39
- Avg merge
- 13h 38m
- Merged PRs (30d)
- 1
Description
Let's look at a template like this:
http://example.com/dictionary/{term:1}
We have two different behaviours depending upon the value used to expand term.
>>> import uritemplate
>>> u = uritemplate.URITemplate('http://example.com/dictionary/{term:1}')
>>> u.expand(term='foo')
'http://example.com/dictionary/f'
>>> u.expand(term=['foo', 'bar', 'bogus'])
'http://example.com/dictionary/foo,bar,bogus'
A simplified version of this is simply
{term:1}
In other words:
>>> import uritemplate
>>> u = uritemplate.URITemplate('{term:1}')
>>> u.expand(term='foo')
'f'
>>> u.expand(term=['foo', 'bar', 'bogus'])
'foo,bar,bogus'
All versions of uritemplate (and uritemplate.py) exhibit this behaviour and the RFC does not provide clear guidance.
I have not investigated how other implementations in other languages handle this, though. There do not appear to be any examples in the RFC that combine lists with length limitations.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the URITemplate.expand examples in the issue and RFC 6570's prefix modifier rules, then compare scalar and list expansion. The issue does not name repository files or an existing test; done should mean an agreed interpretation of list values and regression coverage for both forms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100