Declarative app/user config
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
Right now appconfig and user app configs are a bit weird to work with. I would like to discuss an idea I have to improve this. From all sides. What I often notice
- the config requires a lot of boilerplate code each time
- we have no default value assigned in a single place
- we have no generic verification mechanism
- we have no typehinting on the accepted and returned data
What I would propose is that we move to a more declarative mechanism. And then generate code. That does what we need to do. (values don't change that often anyway).
In example. We add a file usersettings.json in where we declare in some way that there is a user setting foo that is a bool, a setting bar that is an int and a setting foobar which is a string. We can also define default values just in 1 place.
We can then also set validation functions. There can be default ones (isBool, isIntInRange etc). And custom ones that require more custom logic.
- We can then properly expose this via a generic OCS API (which we already do) but then with this file as backend. So that it flows trough the generic checks etc.
- We can generate PHP code to use this in apps. So that there also the default value is always the same, we have proper types, the same sanity checks.
- We could even create a js package that can work with the definitions. So that you don't set invalid values to begin with and already have client side validation as well that certain parameters need to be a certain type.
CC: @ChristophWurst @skjnldsv @nickvergessen @juliushaertl @danxuliu @kesselb
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by reviewing the current appconfig and user app config implementations and the generic OCS API, then define the declarative schema, validation, defaults, and generated PHP and JavaScript behavior. Done requires an agreed design and implementation scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, php
- Domain
- api, backend, developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100