forked from vfxetc/sgschema
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
210 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,22 @@ | ||
|
||
- Public API: | ||
|
||
Schema.is_variable_len(spec) -> can it return non-one results? | ||
|
||
Schema.resolve_entity(xxx) -> list of entity types | ||
Schema.resolve_one_entity(xxx) -> one entity type or ValueError | ||
|
||
Schema.resolve_field(entity_type, field_spec) -> list of fields for entity_type | ||
Schema.resolve_one_field(...) -> one field or ValueError | ||
|
||
|
||
- Create a standard-ish set of tags and aliases: | ||
$parent pointing to typical parent | ||
|
||
- Include inverse_association (from private schema) | ||
|
||
- Schema.resolve_one -> error if there isn't just one | ||
|
||
- *type -> explicit prefix matching | ||
|
||
- basic key/value metadata store | ||
- sgactions:ticket_project: 66 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
import os | ||
from unittest import TestCase | ||
|
||
from sgschema import Schema | ||
|
||
|
||
def load_schema(name='mikeboers', raw=False): | ||
path = os.path.abspath(os.path.join(__file__, '..', 'schema', name + ('.raw' if raw else '') + '.json')) | ||
schema = Schema() | ||
if raw: | ||
schema.load_raw(path) | ||
else: | ||
schema.load(path) | ||
return schema | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
import argparse | ||
import urlparse | ||
import os | ||
|
||
import shotgun_api3 | ||
|
||
import sgschema | ||
|
||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument('-n', '--name') | ||
parser.add_argument('base_url') | ||
parser.add_argument('script_name') | ||
parser.add_argument('api_key') | ||
args = parser.parse_args() | ||
|
||
|
||
shotgun = shotgun_api3.Shotgun(args.base_url, args.script_name, args.api_key) | ||
schema = sgschema.Schema() | ||
schema.read(shotgun) | ||
|
||
|
||
if not args.name: | ||
parsed = urlparse.urlparse(args.base_url) | ||
args.name = parsed.netloc.split('.')[0] | ||
|
||
here = os.path.dirname(__file__) | ||
|
||
schema.dump(os.path.join(here, args.name + '.raw.json'), raw=True) | ||
schema.dump(os.path.join(here, args.name + '.json')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters