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

[dev.icinga.com #13141] Object types oddities #4774

Closed
icinga-migration opened this issue Nov 10, 2016 · 3 comments
Closed

[dev.icinga.com #13141] Object types oddities #4774

icinga-migration opened this issue Nov 10, 2016 · 3 comments
Labels
no-issue Better asked in one of our support channels

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/13141

Created by nlm on 2016-11-10 14:29:14 +00:00

Assignee: (none)
Status: New
Target Version: (none)
Last Update: 2016-11-10 14:29:14 +00:00 (in Redmine)

Icinga Version: 2.5.4-1
Backport?: Not yet backported
Include in Changelog: 1

I was coding some functions in my icinga2 configuration, when I remarked that there are some oddities in object types:

  • most objects have a type field (Object, User, Type, ...)
  • Array has a type ("Array")
  • Dictionnary has a type field but a null type (null)
  • Number, String have no type field

=> Type.type
"Type"
=> Object.type
"Type"
=> Object().type
"Object"
=> User().type
"User"
=> UserGroup().type
"UserGroup"
=> [].type
"Array"
=> {}.type
null
=> {test = 123}.type
null
=> Dictionary().type
null
=> 0.type

Invalid field access (for value of type 'Number'): 'type'
=> Number().type
^
Invalid field access (for value of type 'Number'): 'type'
=> "Hello".type

Invalid field access (for value of type 'String'): 'type'

It seems it's not intentional

@icinga-migration icinga-migration added bug Something isn't working libbase labels Jan 17, 2017
@gunnarbeutner
Copy link
Contributor

Maybe we should just remove the .type attribute because there's no way we can make it work for the Dictionary class.

@Al2Klimov
Copy link
Member

I'd not remove it as that would be a breaking change, but I'd throw it out of the docs.

There's literally no use case for this – we have typeof() after all.

@Al2Klimov
Copy link
Member

Wait as sec... there isn't anything to throw out as the doc only mentions #type for Object and the config objects, but not for any "JSON type". IMO it's not too bad that there are non-intentionally exposed things as long as they're not documented.

@Al2Klimov Al2Klimov added question and removed bug Something isn't working labels Mar 11, 2019
@dnsmichi dnsmichi added no-issue Better asked in one of our support channels and removed question labels May 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-issue Better asked in one of our support channels
Projects
None yet
Development

No branches or pull requests

4 participants