-
Notifications
You must be signed in to change notification settings - Fork 127
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
Exportable schema #266
base: master
Are you sure you want to change the base?
Exportable schema #266
Conversation
Apologies for the messy diff - I thought I skipped those hunks when adding, but I guess not. On that thought - @neumino, would you be open to a PR that cleans up the code a bit? I.e. trims whitespace, adds missing semicolons, etc? |
Hello @davewasmer I actually don't remember what the use case for exporting schema was. Why do you need to be able to export a schema? Your PR currently seems to export a human readable schema, but doesn't export more properties like the maximum length, if the field is required or not etc. |
My use case is primarily around reflection. I'm trying to serialize a Thinky model into different JSON formats, without hardcoding per-model serializers. So having the ability to export the schema provides me a way to inspect the model's schema at runtime and dynamically serialize it. If there is a better approach here that I'm missing, let me know 😄 Right now, yes, the export is human-readable. Like I mentioned, this is just a proof of concept, it should be easy to modify the |
The basic implementation seems reasonable to me. There's also a need to import the schema after that :) |
One more use case would be to assist building GraphQL schema. |
Any chance to see that PR merged ? |
This PR is kind of incomplete. I'll comment more on the issue. |
+1 - this is also super important for us |
@contra -- what is it for? |
@neumino Generating redux api actions on the front-end + form validation etc. |
How does this deal with relationships? It would be super helpful if those were also part of the export |
This is an initial pass at exportable schema (see #234). I fully expect that this will not cover all edge cases, but I just wanted to get something up to start the discussion / iterate from. @neumino - does this seem like a good approach? Anything you'd like to see changed?
I'd personally also like to see the ability to export relationships (I'm fine if that's independent of exporting schema), but I'll address that in a separate PR most likely.