dstandish commented on pull request #13209:
URL: https://github.com/apache/airflow/pull/13209#issuecomment-792881023
@mik-laj @ianstanton after taking another look at this i thought that
adding the namedtuple in this case was maybe a little overkill / confusing
because the elements are never accessed it's just a way constructing a key in
the dict for the URL lookup, given the two components -- api version and kind.
can you please take a look and let me know what you think of this perhaps
simpler (though less explicit) alternative.
and maybe you have a better suggestion.
```python
crd_lookup = {
'keda.sh/v1alpha1::ScaledObject':
'https://raw.githubusercontent.com/kedacore/keda/v2.0.0/config/crd/bases/keda.sh_scaledobjects.yaml',
}
...
def get_schema_crd(api_version, kind):
url = crd_lookup.get(f"{api_version}::{kind}")
if not url:
return None
response = requests.get(url)
yaml_schema = response.content.decode('utf-8')
schema = yaml.safe_load(StringIO(yaml_schema))
return schema
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]