-
Notifications
You must be signed in to change notification settings - Fork 8
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
fix: resolve crash in TransformModuleFilesToModel
if regular schema file passed instead
#386
Conversation
…mModuleFilesToModel, it would crash.
@elbuo8 - Hi, would it be possible to have a review on this? It's impacting our production code and I rather not deploy a patched version, so would love having this fixed upstream. Thanks! |
@fsedano - do you require an error? What do you think about returning a transformation with the module name empty? In general OpenFGA treats type defs with module name as an empty string as having no module attached What if we validate that if there is metadata set, the schema version is the same as the one passed in? So if you are passing in |
TransformModuleFilesToModel
if regular schema file passed instead
@rhamzeh In general I'd prefer to have an error, since this is most probably a input error. If the user wants to accept both it could catch the error and use the regular API for that. If we just hide the error it will go unnoticed and it might have unexpected side effects. The way this was caught in prod is because somebody by mistake commited the wrong file as a module. I rather error out to point the user about the mistake. |
Thanks for elaborating, will approve this to unblock you, and in the future we'll add options to allow this use-case. May I ask if you can also add the JS fix so that this passes the tests and we can merge? The one I currently forsee is allowing folks to run and test and transform their module without worrying about the module file and then a separate platform process does the combining - but as that is not a current use-case, it shouldn't be a blocker. Also can I ask how are you consuming this? Is it by calling it directly or through the CLI? (to see if we need to spin up a new CLI release that contains this fix to unblock you) |
Thanks @rhamzeh - Just fixed also the JS one, thanks for letting me know. Thanks again! |
TransformModuleFilesToModel
if regular schema file passed insteadTransformModuleFilesToModel
if regular schema file passed instead
Thanks @rhamzeh - Is there anything else I have to do to have this merged or will it happen automagically? Thanks, |
Was waiting for all the tests to pass, just added it to the queue. Thanks for the fix! |
Description
The change checks the metadata for the module, if it's null it returns the proper error.
References
Fixes #384
Review Checklist
main