-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Enhancement: Option for single-entry data files #406
Labels
Comments
Named the new property Example configuration: {
"frontMatter.data.files": [
{
"id": "singleEntry",
"title": "Single entry",
"file": "[[workspace]]/data/single-entry.json",
"labelField": "name",
"singleEntry": true,
"schema": {
"title": "Test Files",
"type": "object",
"properties": {
"name": {
"title": "Entry Name",
"type": "string"
},
"example": {
"title": "Example data",
"type": "string"
}
}
}
}
],
"frontMatter.data.folders": [
{
"id": "Testable",
"path": "[[workspace]]/data/tests",
"labelField": "name",
"singleEntry": true,
"schema": {
"title": "Test Files",
"type": "object",
"properties": {
"name": {
"title": "Entry Name",
"type": "string"
},
"example": {
"title": "Example data",
"type": "string"
}
}
}
}
]
} PS: Available to test out in the latest beta version. |
@estruyf tested on my primary site and it works a treat! |
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
Some of the data in my site is organized into folders where each file is a different object. I do this because each object can be fairly large on its own, and I find this easier to reason about/review/track. The data dashboard only allows me to define data files that are arrays of the defined type.
Take for example this configuration (simplified, my actual schema and data is longer):
And the data file I want:
Describe the solution you'd like
I would like an additional key, perhaps
flat
(to not conflict with the existingsingle
for strings) which would mark a data folder (or file) as a single object, not an array of objects.For example:
Describe alternatives you've considered
Instead of requiring an additional key, omitting
labelField
could mark a file as being flat/a single object. I like this less since it isn't as clear/explicit and could be confusing for users.It could also be implemented to require that data files define their schema as an array of objects, but that would break backwards compatibility and be worse DevX I think, since the list behavior is probably the default expectation.
Additional context
Another use case for this, beyond my specific data files, would be configuration files. Config files are typically single objects too. That would allow me to schematize and provide a UI for updating the configuration files in my project.
The text was updated successfully, but these errors were encountered: