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

empty/presence type #2705

Closed
markus2330 opened this issue May 19, 2019 · 7 comments
Closed

empty/presence type #2705

markus2330 opened this issue May 19, 2019 · 7 comments
Assignees
Labels

Comments

@markus2330
Copy link
Contributor

Does the type plugin still support empty? I could not find it in the docu of the type plugin but it is still in the description of [type] in METADATA.ini.

At least [binary] in METADATA.ini still uses empty.

@kodebach
Copy link
Member

I removed empty because the README of the old plugin said it is deprecated and regex should be used. Although I already noticed that this creates an awkward situation, since the string type only matches non-empty values.

IMO we should probably add the empty type again for cases where only the presence of a key is important and also allow empty values for type string, because any would allow binary data as well.

@markus2330
Copy link
Contributor Author

also allow empty values for type string

Yes, without sum types we need to do that.

because any would allow binary data as well

Yes.

For the specification, however, it would be good to have a special type which indicates the presence of a key. While "any" would be okay, it somehow does not reflect the purpose. Or alternatively: we get rid of these presence keys and make the boolean (with "false" as default on absence).

@kodebach
Copy link
Member

For the specification, however, it would be good to have a special type which indicates the presence of a key.

Do you mean for the specification of an applications config, or for our METADATA.ini specification?

@kodebach
Copy link
Member

For application specification there technically is this:

libelektra/doc/METADATA.ini

Lines 611 to 623 in 4a3c163

[require]
type = boolean
status = unclear
description = See spec plugin
[required]
type = range
usedby/plugin = required
status = unclear
description = See spec plugin
for _ as basename as array. Otherwise the presence determines
if a key is required.
In process of being replaced in favor of require.

Although even there it is stated that the status is unclear....

Fixing/implementing require in spec is something I might do, since it would be useful for LCDproc. Also I would like to add a constant metakey that has the same functionality as default, but also marks the key as read-only.

@markus2330
Copy link
Contributor Author

Do you mean for the specification of an applications config, or for our METADATA.ini specification?

Ideally, the types for specifications and meta-specifications (METADATA.ini) are the same. Until now this was the case for the CORBA types. It seems like they are now out-of-sync, hence this issue.

Although even there it is stated that the status is unclear....

In this issue, I did not want to raise the problem how to require a key (we already have #1024 for this. It would be great if you can clean this mess up. I am not sure if we need it for LCDproc, though. I think it would be better to have defaults everywhere.)

Instead, it is about to find the proper CORBA type to indicate that (meta-)keys are empty and only the presence of the (meta-)key is relevant.

Although even there it is stated that the status is unclear....

Fixing/implementing require in spec is something I might do, since it would be useful for LCDproc. Also I would like to add a constant metakey that has the same functionality as default, but also marks the key as read-only.

readonly metadata already exists. What are you missing there? (Please create a new issue for discussion.)

@kodebach
Copy link
Member

readonly metadata already exists.

I can't find it in METADATA.ini

@markus2330
Copy link
Contributor Author

I answered it in #2706.

So maybe migrating everything to boolean is the best way? "kdb setmeta" needs a meta-value anyway. And configuration files are of course free to render the booleans differently (also without values).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants