I think I’ve found a bug with the jsonapi-rust crate and am looking for guidance and input. I believe the issue is a recursion problem when building a hash map of the attributes with relationships. When attempting to run this test in model_test.rs a runtime stack overflow error occurs.
I’m not exactly certain how to go about tackling this bug and am looking for input, guidance or example code from other Rust projects. Thanks in advance!
I’m looking for help and assistance with this GitHub issue.
In the comment you’ll see that I’ve got a WIP branch that I believe resolves the stack overflow bug. However I’m not really happy with the function names and expressing the concepts that is being done to build the models. Any suggestions on making this code better would greatly be appreciated.
@ttdonovan, don’t want to leave you hanging so here’s a bit of unsolicited advice when asking for help: try to provide concrete things you need advice on, possibly minimized and reproduced in a playground. A github repo or PR can be useful for some background but people are unlikely to just go off and try to understand everything there. So:
Like what? Give concrete examples of which ones you’re unhappy with.
Similarly, what specifically bothers you?
There’s a bit of skill in knowing how to ask for help in an online setting. But once you put in the little bit of time and effort to get that right, you’ll have a better experience.
Thanks for the feedback. You are right I am having a hard time “knowing how to ask right questions” online. Couple of things that are bothering me.
I’m certain this is a bug in the crate but have yet to receive any confirmation from the maintainer or anyone else. The example test in the
master branch does not demonstrate the problem in the function
JsonApiModel::resource_to_attrs so I created a pull request that raises the stack overflow error. It would be appreciated if someone could take a minute to review my pull request and confirm that it’s an actual issue with the Crate by replying to the GitHub Issue.
In my WIP branch where I believe the reported issue is resolved I have this large recursive function
extract_relationships_attrs that is used to build the relational attrs for the model. My thought is this function is doing to much and am having a hard time conveying the concepts of the work needed to be done in handling the recursive nature of the function or maybe my approach to resolve the issue is naive and could be done in a better way.