-
Notifications
You must be signed in to change notification settings - Fork 57
Support allow_free_text in extended metadata controlled vocab attributes #2451
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
58267e4
9dee27a
a1e197a
b742837
fc06f54
da05b60
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -31,6 +31,9 @@ | |||||||
| "description": { | ||||||||
| "type": ["string", "null"] | ||||||||
| }, | ||||||||
| "allow_free_text": { | ||||||||
| "type": "boolean" | ||||||||
| }, | ||||||||
|
||||||||
| "allow_free_text": { | |
| "type": "boolean" | |
| }, |
Outdated
Copilot
AI
Dec 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The allow_free_text property is defined for all types in this schema variant, including "Linked Extended Metadata" and "Linked Extended Metadata (multiple)" types where free text doesn't apply (these link to other metadata structures, not controlled vocabularies). While this may be intentionally permissive, consider whether allow_free_text should only be applicable to "Controlled Vocabulary" and "Controlled Vocabulary List" types in the enum on lines 60-65.
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
.present?to check for a boolean attribute is non-idiomatic. While it works in this case (becausefalse.present?returnsfalse, so it defaults tofalse), it's clearer to use.key?to check for the attribute's existence. Consider:allow_cv_free_text: attr.key?('allow_free_text') ? attr['allow_free_text'] : false. This makes the intent clearer and handles bothtrueandfalsevalues explicitly. Note that line 65 has the same pattern for therequiredattribute.