Skip to content

Update resource model format. - #51

Merged
danielgtaylor merged 3 commits into
developfrom
resource-model-update
Feb 3, 2015
Merged

danielgtaylor merged 3 commits into
developfrom
resource-model-update

Conversation

@danielgtaylor

Copy link
Copy Markdown
Contributor

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
Copy Markdown

Coverage Status

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

Comment thread boto3/resources/factory.py Outdated

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
Contributor

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

@jamesls

jamesls commented Jan 30, 2015

Copy link
Copy Markdown
Member

Overall looks good. Just had a couple questions.

@coveralls

Copy link
Copy Markdown

Coverage Status

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

@danielgtaylor

Copy link
Copy Markdown
Contributor Author

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

@jamesls

jamesls commented Feb 3, 2015

Copy link
Copy Markdown
Member

Any ideas on the coverage drop?

@danielgtaylor

Copy link
Copy Markdown
Contributor 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.

4 participants