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

Feature request: deprecations #9

Closed
tigris opened this issue May 8, 2018 · 7 comments
Closed

Feature request: deprecations #9

tigris opened this issue May 8, 2018 · 7 comments

Comments

@tigris
Copy link
Contributor

tigris commented May 8, 2018

It'd be super cool if I could just set deprecated: true on an attribute/component.

Or alternatively set it to a "deprecation_message" rather than just a boolean.

But it'd be nice if you could do this at a component level, as well as individual attributes.

One would have to ask for these deprecations manually, after the config was loaded. E.g. config.deprecations.each{|key, message| logger.warn("DEPRECATED: #{key} - #{message}") }

Since the config struct itself has no concept of a logger, or what might happen with deprecations, it simply needs the ability to mark a particular thing as deprecated, and a means to access all that info.

Let me know if you'd be interested in something like this at the global layer, otherwise I'll hack something for our specific needs.

@mdub
Copy link
Owner

mdub commented May 8, 2018

Hmm, interesting. It's almost like config_errors, yeah, but more config_warnings. I wonder if there's a way to integrate them?

@tigris
Copy link
Contributor Author

tigris commented May 8, 2018

config_warnings was my first idea too, then realised i wanted it just for deprecations in this instance

but yeah, if a component had a way of defining config_warnings method, it could introspect itself to see if any of the deprecated attributes are set, as well as deprecate itself if need be.

not quite as nice as a simple deprecated: "message here" on the element definition, but a fair bit more flexible and way easier to implement

@mdub
Copy link
Owner

mdub commented May 8, 2018

Could do both; surface config_warnings, and implement deprecated sugar that ends up generating warnings.

I reckon one could generate warnings on use of the deprecated setter/getter method, rather than based on what attributes ended up populated.

I imagine renaming of attributes is a common case, so perhaps explicit support for deprecating older names would be handy, e.g.

attribute :orientation, :formerly_known_as => :facing

component :position, :formerly_known_as => :pos do ...

@tigris
Copy link
Contributor Author

tigris commented May 8, 2018

Ok, i got a start master...tigris:config_warnings

However, I can't make components deprecate easily. They're always set to an empty class.

@mdub
Copy link
Owner

mdub commented Jan 31, 2020

Ever get anywhere with this, @tigris?

@tigris
Copy link
Contributor Author

tigris commented Jan 31, 2020

Sorry @mdub - no further than in that branch.

Unless I can make kubernetes know about ConfigMapper, I can't see myself extending on it much further :/

When will :k8s: get include support! Happy to close this issue if you wish.

@mdub
Copy link
Owner

mdub commented Feb 1, 2020

Yep, closing for now.

@mdub mdub closed this as completed Feb 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants