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

Update resource model format. #51

Merged
merged 3 commits into from Feb 3, 2015
Merged

Conversation

danielgtaylor
Copy link
Member

This updates to the latest resource model format, which includes the following
changes:

  1. belongsTo references are now named has
  2. subResources is replaced by two-way has references
  3. Identifier and parameter definitions are refactored:
    • source is now one of name, path or value
    • sourceType is now source
    • A new source of input is added for user-supplied input

Our interface remains the same, but the underlying JSON files have changed
and our factory code and documentation are somewhat simplified. The code
that handles identifiers/parameters is a bit more complex due to having
to check several keys in the dictionary based on the source.

The model still exposes subresources and references as separate concepts.
Due to circular references, resource instances now lazy-load the subresource
class when needed.

Tests and documentation have been updated to reflect these changes.

Note: Before merging, this requires a JMESPath update to support @ as a root selector, which is the format used in the models now.

cc: @jamesls @kyleknap

@danielgtaylor danielgtaylor self-assigned this Jan 29, 2015
@danielgtaylor danielgtaylor added the enhancement This issue requests an improvement to a current feature. label Jan 29, 2015
This updates to the latest resource model format, which includes the following
changes:

1. `belongsTo` references are now named `has`
2. `subResources` is replaced by two-way `has` references
3. Identifier and parameter definitions are refactored:

    * `source` is now one of `name`, `path` or `value`
    * `sourceType` is now `source`
    * A new source of `input` is added for user-supplied input

Our interface remains the same, but the underlying JSON files have changed
and our factory code and documentation are somewhat simplified. The code
that handles identifiers/parameters is a bit more complex due to having
to check several keys in the dictionary based on the source.

The model still exposes subresources and references as separate concepts.
Due to circular references, resource instances now lazy-load the subresource
class when needed.

Tests and documentation have been updated to reflect these changes.
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.04%) to 98.58% when pulling 6b6cf76 on resource-model-update into 59136a4 on develop.

for key, value in identifiers.items():
pargs.append(getattr(self, xform_name(key)))
for identifier, value in build_identifiers(identifiers, self):
pargs.append(value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does pargs stand for?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind I was only looking at the diff. It is positional args

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big deal, but I prefer the vars spelled out to avoid confusion, positional_args would work for me.

@kyleknap
Copy link
Member

It looks good to me. 🚢 Most of my comments were minor: questions and comments on style and tests.

@jamesls
Copy link
Member

jamesls commented Jan 30, 2015

Overall looks good. Just had a couple questions.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.05%) to 98.57% when pulling 3d96f71 on resource-model-update into 59136a4 on develop.

@danielgtaylor
Copy link
Member Author

@jamesls @kyleknap code is updated. Let me know if you have other questions, otherwise I'll merge it in.

@jamesls
Copy link
Member

jamesls commented Feb 3, 2015

Any ideas on the coverage drop?

@danielgtaylor
Copy link
Member Author

Code coverage drop is likely due to removed lines. All new lines are covered, but the few uncovered lines in e.g. boto3/__init__.py are still uncovered and now carry more weight.

danielgtaylor added a commit that referenced this pull request Feb 3, 2015
@danielgtaylor danielgtaylor merged commit ea31a67 into develop Feb 3, 2015
@danielgtaylor danielgtaylor deleted the resource-model-update branch February 3, 2015 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue requests an improvement to a current feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants