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

custom fields: service methods should know if a field is enabled (not just configured) #362

Open
ppanero opened this issue Jul 20, 2022 · 3 comments

Comments

@ppanero
Copy link
Member

ppanero commented Jul 20, 2022

In CustomFieldsService.exists we need an is_registered method/flag for the fields. To check if it is "configured" or not, not just to check existance in ES, or should it do both?

related to #355

@ppanero ppanero self-assigned this Aug 3, 2022
@ppanero
Copy link
Member Author

ppanero commented Aug 4, 2022

This issue boils down to a persistence problem. We need to store which fields have passed by the invenio-cli custom-fields create... command. We cannot do it in memory, because they would be lost for the following app instantiation (e.g. pod rollup). Options are:

  • DB table. This would allow us to add another command "disable", that would invalidate the field for future records while keeping it in the ones that it's present (potential issues with marshmallow when dumping)
  • Registry. On application start, ES would be checked for fields existence (comparing to the configured custom fields). The mapping type should also be checked, otherwise, it could give a false positive (i.e. a field was auto guessed, the app was restarted and now it seems as if it was enabled).

@ppanero ppanero removed their assignment Aug 4, 2022
@ppanero
Copy link
Member Author

ppanero commented Sep 7, 2022

related to #355
Currently, once the custom field has been configured in the invenio.cfg file it can already be used:

  • The jsonschema wont complain since custom is an object so is a "catch all"
  • Marshmallow will get the schema from the configured field
  • Elasticsearch will auto detect the type of field <-- here is the problem

Since the field was not created using the CLI the mapping type might not be correct, leading to problems (since it cannot be updated)

@ppanero
Copy link
Member Author

ppanero commented Sep 7, 2022

The correct way to fix it would be to have vocabs stored in DB, moving to triage since is not feasible for the mvp of custom fields in V10

@zzacharo zzacharo added this to Triage in InvenioRDM QA via automation Oct 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant