-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix(sdk): update v2 yaml format #6661
Conversation
Skipping CI for Draft Pull Request. |
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.
Looking much better!
try: | ||
from typing import ForwardRef | ||
except ImportError: | ||
from typing import _ForwardRef as ForwardRef |
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.
You can use from pydantic.typing import ForwardRef
. That will probably solve your Python3.6 issues.
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.
Seems like it leads to another error. Tried and realize the pure " "
works better than ForwardRef(" ")
input_name: str = pydantic.Field(alias='inputValue') | ||
|
||
class Config: | ||
allow_population_by_field_name = True |
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.
nit: I think you could add the config in the base class BasePlaceholder
so that you don't need to repeat it in the sub-classes. If you need this for all classes, consider create a base model: https://pydantic-docs.helpmanual.io/usage/model_config/#change-behaviour-globally
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.
Thanks! Used the global base class.
b22bc0d
to
7128973
Compare
v1_component = _components._load_component_spec_from_component_text( | ||
component_yaml) | ||
return cls.from_v1_component_spec(v1_component) | ||
except: |
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.
nit: can we except on a specific exception?
try: | ||
from typing import OrderedDict | ||
except: | ||
from typing import MutableMapping as OrderedDict |
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.
This might not be a good idea. Python caches imports, even outside this function, the import still exists in some system module dict, it could potentially conflicts with collections.OrderedDict
if it was imported as a class (though importing class instead of module is discourage).
If there's no easy way to address this, maybe we just use MutableMapping
, and leave a comment above saying we should update this once we drop Python 3.6 or something.
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.
I used Dict for now and add a comment :) Thanks!
@ji-yaqi: The following test failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/lgtm Thanks! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: chensun The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Description of your changes:
InputValuePlaceholder
,OutputPathPlaceholder
,IfpresentPlaceholder
and etc. to containinput_name
andoutput_name
with aliasing to YAML.annotations
andlabels
from Spec.