Skip to content
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

Allow Mockgun to apply schema modifications #198

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Ahuge
Copy link

@Ahuge Ahuge commented May 3, 2019

This PR is designed to add additional schema support for Mockgun allowing me to alter the schema and save out the schema modifications

I do this by implementing the schema_field_create/update/delete methods

I have also updated the SchemaFactory with new methods to allow writing out a schema from memory.

This is my second PR to shotgunsoftware the last one had issues with a missing tests/config file...
This one will have the same issue until I figure out what is needed with that in #197

Thanks

Alex added 2 commits May 3, 2019 14:40
This works opposite to the get_schemas function
We implement the create and update using a new internal helper called `_set_property`.
This new method will recursively search the passed current property dictionary and attempt to find all keys matching the key you pass in and update it's value to the value you have passed in.

If it cannot find the value in the current dictionary but it does find a "properties" dictionary, it will add a new entry in the "properties" dictionary.
This "properties" dictionary appears to only exist on the root of the properties dictionary.

A `schema_field_update` does a deep copy of the properties before updating them whereas the `schema_field_create` method starts from a base schema_field dictionary and updates it with what you pass in.

This does not deal with setting "editable" values in each of these keys. We are assuming, in Mockgun, that you are allowed to change anything in the schema.
Perhaps someone from the team at Shotgun will have some clear logic that will allow us to implement that.
@pscadding pscadding added the Logged logged to jira label May 17, 2019
@Ahuge Ahuge force-pushed the feature/ah/mockgun_set_schema branch from b85a3e3 to 43c519e Compare May 21, 2019 20:00
@Ahuge Ahuge force-pushed the feature/ah/mockgun_set_schema branch from bc26495 to 43c519e Compare May 21, 2019 20:17
@Ahuge
Copy link
Author

Ahuge commented Jun 20, 2019

Bump?

@pscadding
Copy link
Contributor

Hi Sorry we've not got back to you yet on this. We really appreciate you submitting it, but its going to be a little while before we can get to properly looking at this.

@Ahuge
Copy link
Author

Ahuge commented Jun 21, 2019

Sounds good thanks for the update

@fabiangeisler
Copy link

Just leaving my +1 here for this pull request, as this would help me as well at the moment. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Logged logged to jira
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants