You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
such that "/api/v1/foo/<string:name>/detail/<string:param>" would be reported as ".../api/v1/foo/${name}/detail/${param}".
The client has to remove/substitute the templates then and I figured that wasn't very generic. I didn't really want to make it so Javascript-specific, either, and Javascript will only do that sort of substitution in literal template strings (backticked), so far as I can tell; although it's just a .replace away, it's not quite that neat.
Anyway, just letting it append the username to the end of the URI seemed easiest, at least for now.
I guess I was proposing two things:
make the URI available as a template
make it easy for the client to fill in the template (which is why I offered JS syntax)
It doesn't have to be Javascript format, but I'll point out that that format also works for shell, so it's not exactly JS-specific. ;-) We could use %s instead of ${...}, but I opted for the latter because it provides semantic information.
It's true that the client will likely need to have some foreknowledge in order to fill in the template, but it will need to have even closer coupling to produce the URI if we just lop it off at the first parameter. Providing a template removes the need for some of that coupling.
portante
changed the title
I guess I was proposing two things:
Report the template string with JS template arguments in pbench server config API
Mar 26, 2021
Originally posted by @webbnh in #2024 (comment)
Would it be more useful to report the template string with JS template arguments in it? E.g.,
such that
"/api/v1/foo/<string:name>/detail/<string:param>"
would be reported as".../api/v1/foo/${name}/detail/${param}"
.The client has to remove/substitute the templates then and I figured that wasn't very generic. I didn't really want to make it so Javascript-specific, either, and Javascript will only do that sort of substitution in literal template strings (backticked), so far as I can tell; although it's just a
.replace
away, it's not quite that neat.Anyway, just letting it append the username to the end of the URI seemed easiest, at least for now.
I guess I was proposing two things:
It doesn't have to be Javascript format, but I'll point out that that format also works for shell, so it's not exactly JS-specific. ;-) We could use
%s
instead of${...}
, but I opted for the latter because it provides semantic information.It's true that the client will likely need to have some foreknowledge in order to fill in the template, but it will need to have even closer coupling to produce the URI if we just lop it off at the first parameter. Providing a template removes the need for some of that coupling.
Apparently there is a (proposed) IETF standard for URI templates.
The text was updated successfully, but these errors were encountered: