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

Follow HTML standards for query string List #393

Closed
vincentsarago opened this issue Oct 21, 2021 Discussed in #349 · 1 comment
Closed

Follow HTML standards for query string List #393

vincentsarago opened this issue Oct 21, 2021 Discussed in #349 · 1 comment
Labels
breaking change enhancement New feature or request help wanted Extra attention is needed resolved-by-pr

Comments

@vincentsarago
Copy link
Member

Discussed in #349

Originally posted by vincentsarago July 28, 2021
ref: #347, #262 (comment)

Problem description

Historically we choose to allow passing list values (bidx, bands, assets) as comma delimited value encoded in string (e.g bidx=1,2,3), which is then decoded to list

class BidxParams(DefaultDependency):
"""Band Indexes parameters."""
bidx: Optional[str] = Query(
None, title="Band indexes", description="comma (',') delimited band indexes",
)
def __post_init__(self):
"""Post Init."""
if self.bidx is not None:
self.kwargs["indexes"] = tuple(
int(s) for s in re.findall(r"\d+", self.bidx)
)

This works fine BUT is not standard.

Breaking change

this will be a breaking change but I feel it's better to follow standard.

@vincentsarago vincentsarago added enhancement New feature or request help wanted Extra attention is needed breaking change labels Oct 21, 2021
@vincentsarago
Copy link
Member Author

vincentsarago commented Oct 21, 2021

In next titiler version (0.4) we will update all the dependencies to follow HTML standards

When list is required, the use will have to pass the argument multiple times: indexes=1&indexes=2&indexes=3 (before it was bidx=1,2,3

Open Question

In new rio-tiler (3.0) we need asset_expression and asset_indexes to be dictionaries (e.g asset_expression={"asset1": "b1*2"} . Sadly there is no standard ways to represent dictionaries/object in query strings, and starlette don't support it.

I'm quite fond of the mydict[mykey]=value notation (e.g asset_expression[asset1]=b1*2)

Note: seems that the notation refers to deepObject in OpenAPI3.0.1

ref:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change enhancement New feature or request help wanted Extra attention is needed resolved-by-pr
Projects
None yet
Development

No branches or pull requests

1 participant