Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Middleware.PathParams: add OpenAPI params
Tesla.Middleware.PathParams has been extended to support OpenAPI style parameters in addition to the existing Phoenix style parameters. - Phoenix parameters begin with `:` and a letter (`a-zA-Z`) and continue to the next non-word character (not `a-zA-Z0-9_`). Examples include `:id`, `:post_id`, `:idPost`. - OpenAPI parameters are contained in braces (`{}`), must begin with a letter (`a-zA-Z`) and may contain word characters and hyphens (`-a-zA-Z0-9_`). Examples inlucde `{id}`, `{post_id}`, `{IdPost}`. Parameter value objects may be provided as maps with atom or string keys, keyword lists, or structs. During path resolution, to avoid potential atom exhaustion, the parameter value object is transformed to a string-keyed map. Parameter values that are `nil` or that are not present in the value object are not replaced; all other values are converted to string (with `to_string`) and encoded with `application/x-www-form-urlencoded` formatting. If the value does not implement the `String.Chars` protocol, it is the caller's responsibility to convert it to a string prior to passing it to the Tesla client using this middleware. Execution time is determined by the number of parameter patterns in the path. Closes: #566
- Loading branch information