-
Notifications
You must be signed in to change notification settings - Fork 24
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
Implement path rewriting #54
Comments
Thanks for posting this issue and sorry it's taken me so long to even respond :-/ This is something that would benefit from a solution to #30, but I think it's already possible. For example, if you wanted to add rewriting to the JSON plugin, you could do something like this:
Would that accomplish some of your goals here? It wouldn't help you pre-populate property accessors, and really this might not be the best use of Fermata anyway. What I mean is, Fermata is designed to make nearly "direct" use of an API and its documentation possible. For a plugin to do small helpful stuff like auto-generating a base URL or including some special header or opt into OAuth or whatnot is "normal" and fits this design. So would a "generic" mapping of any XML response from the API into some standard object shape. What's not really a great fit for Fermata plugins is things like URL rewriting, or converting objects differently in all sorts of special cases. The reason being, now you have to document all these special rules and cases. In a situation like this, I think you'd be better off writing a wrapper for your server's API. (I'd be honored if you chose to use I hope this helps you or someone else encountering the problem! I'm going to close but feel free to re-open if you have followup questions or want to push back that this is something Fermata should support. Thanks again! |
Ideally this would be a module, though it seems that would require a change in the module api. Currently I'm modifying the fermata wrapper post-initialization.
or
This is especially useful for APIs that have url patterns that are awkward or incompatible with property accessors:
Furthermore, this would allow pre-populating of property accessors in instances where the Proxy api is not available.
The text was updated successfully, but these errors were encountered: