-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Conversation
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.
3574b5b
to
6b6cf76
Compare
for key, value in identifiers.items(): | ||
pargs.append(getattr(self, xform_name(key))) | ||
for identifier, value in build_identifiers(identifiers, self): | ||
pargs.append(value) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
It looks good to me. 🚢 Most of my comments were minor: questions and comments on style and tests. |
Overall looks good. Just had a couple questions. |
Any ideas on the coverage drop? |
Code coverage drop is likely due to removed lines. All new lines are covered, but the few uncovered lines in e.g. |
Update resource model format.
This updates to the latest resource model format, which includes the following
changes:
belongsTo
references are now namedhas
subResources
is replaced by two-wayhas
referencessource
is now one ofname
,path
orvalue
sourceType
is nowsource
input
is added for user-supplied inputOur 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