libreant
libreant copied to clipboard
validate new items submission with respect to preset schema.
we need to use Preset.validate()
in upload()
function.
we need to use
Preset.validate()
inadd()
function.
in the upload()
one, actually
Now we have presets related code inside webant, but the validation of volumes should be done in archivant in order to be used by cli, api, webant, etc... Should we move presets code inside archivant?
On Sat, Jun 27, 2015 at 10:08:03AM -0700, ael wrote:
Now we have presets related code inside webant, but the validation of volumes should be done in archivant in order to be used by cli, api, webant, etc... Should we move presets code inside archivant?
nope! presets are about the generation of forms, while archivant is elasticsearch+fsdb.
presets should be usable in the CLI even without moving them inside archivant, am I wrong?
BoySka
On 06/28/2015 12:05 PM, BoySka wrote:
On Sat, Jun 27, 2015 at 10:08:03AM -0700, ael wrote:
Now we have presets related code inside webant, but the validation of volumes should be done in archivant in order to be used by cli, api, webant, etc... Should we move presets code inside archivant?
nope! presets are about the generation of forms, while archivant is elasticsearch+fsdb.
presets should be usable in the CLI even without moving them inside archivant, am I wrong?
Maybe I didn't explain it well. We have a package (/presets) that deals with presets managment. So we can invoke and use it in standalone mode.
At the moment we use that module inside webant to render the upload form. The next step is to implement the validation of volumes in the upload procedure, in order to accept/decline new elements according to their belonging preset. The problem is that we expose the upload through cli, rest api and web interface and we need to validate volumes in all these different procedures. The common gate is the add_volume function inside archivant, so I was wondering about implementing the validation steps in there.
tommy.ael gpg key: 0xEBD8B3682C4C4645
On Sun, Jun 28, 2015 at 06:19:29AM -0700, ael wrote:
On 06/28/2015 12:05 PM, BoySka wrote:
On Sat, Jun 27, 2015 at 10:08:03AM -0700, ael wrote:
Now we have presets related code inside webant, but the validation of volumes should be done in archivant in order to be used by cli, api, webant, etc... Should we move presets code inside archivant?
nope! presets are about the generation of forms, while archivant is elasticsearch+fsdb.
Maybe I didn't explain it well.
I understood. Still I am convinced that archivant shouldn't be "all of libreant logic", otherwise we would have called it "libreant".
At the moment we use that module inside webant to render the upload form. The next step is to implement the validation of volumes in the upload procedure, in order to accept/decline new elements according to their belonging preset. The problem is that we expose the upload through cli, rest api and web interface and we need to validate volumes in all these different procedures. The common gate is the add_volume function inside archivant, so I was wondering about implementing the validation steps in there.
That's why I believed that putting all the application logic inside webant and using webant for the gui was meaningful. We decided the other way round, which is perfectly fine, but then we have two choices:
- code duplication
- writing a common library containing all of libreant logic Code duplication is the easy one, common library is the longterm one. I don't know if there is any other possibility
For reference: yes, it's possible to submit whatever you like, basically ignoring validation, with something as simple as
curl localhost:5000/add -d _preset=book -d _language=it -d field_category=cicciopanza -d field_title=tip0wno
where the book
preset should enforce a enum
for the category
field.