You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by Samuel Williams <sp...@gmail.com> on 2012/07/22 10:07:25 UTC

validate_doc_update response?

Hi,

1/ I'm wondering what are valid responses to validate_doc_update? The query
services I've seen return either a hash {forbidden: "message"} or 1

Can I return true rather than 1? Seems more logical..

How do I report multiple failures? e.g. Title required, Author required.

2/ Why is the name "validate_doc_update" so verbose when compared with
"lists", "filters", etc? Why not just "validates"?

Thanks,
Samuel

Re: validate_doc_update response?

Posted by Samuel Williams <sp...@gmail.com>.
Sorry, that is supposed to be:

ddoc = {
validates: [
{
match: function(document) { return document.type == 'user'; }
validate: function(new_doc, old_doc, user_context) {
if (!user_context.admin || old_doc.username == user_context.username)
throw 'forbidden', ...;
}
}
]
}

And you'd go from top to bottom calling match, and if match returned true,
call validate.

Re: validate_doc_update response?

Posted by Samuel Williams <sp...@gmail.com>.
Just as an aside, I was thinking it would be nice to write something like
this:

ddoc = {
validates: {
{
match: function(document) { return document.type == 'user'; }
validate: function(new_doc, old_doc, user_context) {
if (!user_context.admin || old_doc.username == user_context.username)
throw 'forbidden', ...;
}
}
}
}

Not sure what others think, but putting all your validation logic in one
function seems pretty cumbersome. I'm probably going to wrap
validate_doc_update around this structure in my Ruby Query Server.

Does this seem like an interesting approach?

Kind regards,
Samuel

On 22 July 2012 21:14, Samuel Williams <sp...@gmail.com>wrote:

> I see, so the specification for design doc was made before that patch, so
> the patch had to follow the specification of the design doc for
> consistency, yet the naming seems pretty horrible in contrast to all the
> other dispatch table verbs :(
>
> Oh well, thats the way it is then. Perhaps the ddoc API can be refactored
> for CouchDB v2.0 with better consistency and efficiency, personally I'd
> like to see a simplified design document API, from the POV of implementing
> a query server.
>
> Right now it feels like lots of different mechanisms all mixed up together
> (e.g. stateful add_fun vs non-stateful ddoc).
>
> I guess I'd need to come up with a good alternative with significant
> improvements to warrant the change right? Are any other people thinking
> about this?
>
> Kind regards,
> Samuel
>
> On 22 July 2012 21:06, Alexander Shorin <kx...@gmail.com> wrote:
>
>> > I couldn't see any reason why the name was changed..?
>>
>> Because validate function stored at "validate_doc_update" field within
>> ddoc, not "validate", so ddoc subcommand have to be same named.
>> Leaving subcommand as "validate" would break backward compatibility in
>> this case.
>>
>> --
>> ,,,^..^,,,
>>
>>
>> On Sun, Jul 22, 2012 at 1:02 PM, Samuel Williams
>> <sp...@gmail.com> wrote:
>> > I can't see why "validate" is a problem, I checked the patch which
>> changed
>> > the name:
>> >
>> >
>> https://github.com/apache/couchdb/commit/ea3b1153e52ac1513da4d634eedefb05c261039c
>> >
>> > I couldn't see any reason why the name was changed..?
>> >
>> > Kind regards,
>> > Samuel
>> >
>> > On 22 July 2012 20:52, Alexander Shorin <kx...@gmail.com> wrote:
>> >
>> >> Hi again(: No problems.
>> >>
>> >> On Sun, Jul 22, 2012 at 12:48 PM, Samuel Williams
>> >> <sp...@gmail.com> wrote:
>> >> > Regarding the "1" result, I'm surprised that it isn't 'true', since
>> that
>> >> > would seem far more logical and match the rest of the protocol, e.g.
>> >> > 'reset', and various other commands.
>> >>
>> >> I suppose main decision was about how to easily understand what
>> >> response received for what command, but I could be wrong there.
>> >>
>> >> > I'm not sure I understand the motivation behind going from
>> "validate" to
>> >> > "validate_doc_update" - was it renamed to avoid collisions with
>> something
>> >> > else?
>> >>
>> >> You just need once to take a look at how ddoc command been processed
>> >> to figure "why so"(:
>> >> https://github.com/apache/couchdb/blob/master/share/server/loop.js#L69
>> >>
>> >> --
>> >> ,,,^..^,,,
>> >>
>> >>
>> >> On Sun, Jul 22, 2012 at 12:48 PM, Samuel Williams
>> >> <sp...@gmail.com> wrote:
>> >> > Thanks again Alex, you are always so helpful - and the references you
>> >> > provide are really great.
>> >> >
>> >> > Regarding the "1" result, I'm surprised that it isn't 'true', since
>> that
>> >> > would seem far more logical and match the rest of the protocol, e.g.
>> >> > 'reset', and various other commands.
>> >> >
>> >> > I'm not sure I understand the motivation behind going from
>> "validate" to
>> >> > "validate_doc_update" - was it renamed to avoid collisions with
>> something
>> >> > else?
>> >> >
>> >> > On 22 July 2012 20:40, Alexander Shorin <kx...@gmail.com> wrote:
>> >> >
>> >> >> Hi Samuel!
>> >> >>
>> >> >> > 1/ I'm wondering what are valid responses to validate_doc_update?
>> The
>> >> >> query
>> >> >> > services I've seen return either a hash {forbidden: "message"} or
>> 1
>> >> >> >
>> >> >> > Can I return true rather than 1? Seems more logical..
>> >> >>
>> >> >> You could, but this would be invalid output. See for details:
>> >> >>
>> >> >>
>> >>
>> https://github.com/apache/couchdb/blob/master/src/couchdb/couch_query_servers.erl#L230
>> >> >>
>> >> >>
>> >> >> > 2/ Why is the name "validate_doc_update" so verbose when compared
>> with
>> >> >> > "lists", "filters", etc? Why not just "validates"?
>> >> >>
>> >> >> Initially it was "validate" command, but since any ddoc subcommand
>> is
>> >> >> a ddoc field, it eventually renamed to validate_doc_update.
>> >> >> See first commit about it:
>> >> >>
>> >> >>
>> >>
>> https://github.com/apache/couchdb/commit/9044fc0234ed65056f087a86c7c117922f2a2c75
>> >> >>
>> >> >> --
>> >> >> ,,,^..^,,,
>> >> >>
>> >> >>
>> >> >> On Sun, Jul 22, 2012 at 12:07 PM, Samuel Williams
>> >> >> <sp...@gmail.com> wrote:
>> >> >> > Hi,
>> >> >> >
>> >> >> > 1/ I'm wondering what are valid responses to validate_doc_update?
>> The
>> >> >> query
>> >> >> > services I've seen return either a hash {forbidden: "message"} or
>> 1
>> >> >> >
>> >> >> > Can I return true rather than 1? Seems more logical..
>> >> >> >
>> >> >> > How do I report multiple failures? e.g. Title required, Author
>> >> required.
>> >> >> >
>> >> >> > 2/ Why is the name "validate_doc_update" so verbose when compared
>> with
>> >> >> > "lists", "filters", etc? Why not just "validates"?
>> >> >> >
>> >> >> > Thanks,
>> >> >> > Samuel
>> >> >>
>> >>
>>
>
>

Re: validate_doc_update response?

Posted by Samuel Williams <sp...@gmail.com>.
I see, so the specification for design doc was made before that patch, so
the patch had to follow the specification of the design doc for
consistency, yet the naming seems pretty horrible in contrast to all the
other dispatch table verbs :(

Oh well, thats the way it is then. Perhaps the ddoc API can be refactored
for CouchDB v2.0 with better consistency and efficiency, personally I'd
like to see a simplified design document API, from the POV of implementing
a query server.

Right now it feels like lots of different mechanisms all mixed up together
(e.g. stateful add_fun vs non-stateful ddoc).

I guess I'd need to come up with a good alternative with significant
improvements to warrant the change right? Are any other people thinking
about this?

Kind regards,
Samuel

On 22 July 2012 21:06, Alexander Shorin <kx...@gmail.com> wrote:

> > I couldn't see any reason why the name was changed..?
>
> Because validate function stored at "validate_doc_update" field within
> ddoc, not "validate", so ddoc subcommand have to be same named.
> Leaving subcommand as "validate" would break backward compatibility in
> this case.
>
> --
> ,,,^..^,,,
>
>
> On Sun, Jul 22, 2012 at 1:02 PM, Samuel Williams
> <sp...@gmail.com> wrote:
> > I can't see why "validate" is a problem, I checked the patch which
> changed
> > the name:
> >
> >
> https://github.com/apache/couchdb/commit/ea3b1153e52ac1513da4d634eedefb05c261039c
> >
> > I couldn't see any reason why the name was changed..?
> >
> > Kind regards,
> > Samuel
> >
> > On 22 July 2012 20:52, Alexander Shorin <kx...@gmail.com> wrote:
> >
> >> Hi again(: No problems.
> >>
> >> On Sun, Jul 22, 2012 at 12:48 PM, Samuel Williams
> >> <sp...@gmail.com> wrote:
> >> > Regarding the "1" result, I'm surprised that it isn't 'true', since
> that
> >> > would seem far more logical and match the rest of the protocol, e.g.
> >> > 'reset', and various other commands.
> >>
> >> I suppose main decision was about how to easily understand what
> >> response received for what command, but I could be wrong there.
> >>
> >> > I'm not sure I understand the motivation behind going from "validate"
> to
> >> > "validate_doc_update" - was it renamed to avoid collisions with
> something
> >> > else?
> >>
> >> You just need once to take a look at how ddoc command been processed
> >> to figure "why so"(:
> >> https://github.com/apache/couchdb/blob/master/share/server/loop.js#L69
> >>
> >> --
> >> ,,,^..^,,,
> >>
> >>
> >> On Sun, Jul 22, 2012 at 12:48 PM, Samuel Williams
> >> <sp...@gmail.com> wrote:
> >> > Thanks again Alex, you are always so helpful - and the references you
> >> > provide are really great.
> >> >
> >> > Regarding the "1" result, I'm surprised that it isn't 'true', since
> that
> >> > would seem far more logical and match the rest of the protocol, e.g.
> >> > 'reset', and various other commands.
> >> >
> >> > I'm not sure I understand the motivation behind going from "validate"
> to
> >> > "validate_doc_update" - was it renamed to avoid collisions with
> something
> >> > else?
> >> >
> >> > On 22 July 2012 20:40, Alexander Shorin <kx...@gmail.com> wrote:
> >> >
> >> >> Hi Samuel!
> >> >>
> >> >> > 1/ I'm wondering what are valid responses to validate_doc_update?
> The
> >> >> query
> >> >> > services I've seen return either a hash {forbidden: "message"} or 1
> >> >> >
> >> >> > Can I return true rather than 1? Seems more logical..
> >> >>
> >> >> You could, but this would be invalid output. See for details:
> >> >>
> >> >>
> >>
> https://github.com/apache/couchdb/blob/master/src/couchdb/couch_query_servers.erl#L230
> >> >>
> >> >>
> >> >> > 2/ Why is the name "validate_doc_update" so verbose when compared
> with
> >> >> > "lists", "filters", etc? Why not just "validates"?
> >> >>
> >> >> Initially it was "validate" command, but since any ddoc subcommand is
> >> >> a ddoc field, it eventually renamed to validate_doc_update.
> >> >> See first commit about it:
> >> >>
> >> >>
> >>
> https://github.com/apache/couchdb/commit/9044fc0234ed65056f087a86c7c117922f2a2c75
> >> >>
> >> >> --
> >> >> ,,,^..^,,,
> >> >>
> >> >>
> >> >> On Sun, Jul 22, 2012 at 12:07 PM, Samuel Williams
> >> >> <sp...@gmail.com> wrote:
> >> >> > Hi,
> >> >> >
> >> >> > 1/ I'm wondering what are valid responses to validate_doc_update?
> The
> >> >> query
> >> >> > services I've seen return either a hash {forbidden: "message"} or 1
> >> >> >
> >> >> > Can I return true rather than 1? Seems more logical..
> >> >> >
> >> >> > How do I report multiple failures? e.g. Title required, Author
> >> required.
> >> >> >
> >> >> > 2/ Why is the name "validate_doc_update" so verbose when compared
> with
> >> >> > "lists", "filters", etc? Why not just "validates"?
> >> >> >
> >> >> > Thanks,
> >> >> > Samuel
> >> >>
> >>
>

Re: validate_doc_update response?

Posted by Alexander Shorin <kx...@gmail.com>.
> I couldn't see any reason why the name was changed..?

Because validate function stored at "validate_doc_update" field within
ddoc, not "validate", so ddoc subcommand have to be same named.
Leaving subcommand as "validate" would break backward compatibility in
this case.

--
,,,^..^,,,


On Sun, Jul 22, 2012 at 1:02 PM, Samuel Williams
<sp...@gmail.com> wrote:
> I can't see why "validate" is a problem, I checked the patch which changed
> the name:
>
> https://github.com/apache/couchdb/commit/ea3b1153e52ac1513da4d634eedefb05c261039c
>
> I couldn't see any reason why the name was changed..?
>
> Kind regards,
> Samuel
>
> On 22 July 2012 20:52, Alexander Shorin <kx...@gmail.com> wrote:
>
>> Hi again(: No problems.
>>
>> On Sun, Jul 22, 2012 at 12:48 PM, Samuel Williams
>> <sp...@gmail.com> wrote:
>> > Regarding the "1" result, I'm surprised that it isn't 'true', since that
>> > would seem far more logical and match the rest of the protocol, e.g.
>> > 'reset', and various other commands.
>>
>> I suppose main decision was about how to easily understand what
>> response received for what command, but I could be wrong there.
>>
>> > I'm not sure I understand the motivation behind going from "validate" to
>> > "validate_doc_update" - was it renamed to avoid collisions with something
>> > else?
>>
>> You just need once to take a look at how ddoc command been processed
>> to figure "why so"(:
>> https://github.com/apache/couchdb/blob/master/share/server/loop.js#L69
>>
>> --
>> ,,,^..^,,,
>>
>>
>> On Sun, Jul 22, 2012 at 12:48 PM, Samuel Williams
>> <sp...@gmail.com> wrote:
>> > Thanks again Alex, you are always so helpful - and the references you
>> > provide are really great.
>> >
>> > Regarding the "1" result, I'm surprised that it isn't 'true', since that
>> > would seem far more logical and match the rest of the protocol, e.g.
>> > 'reset', and various other commands.
>> >
>> > I'm not sure I understand the motivation behind going from "validate" to
>> > "validate_doc_update" - was it renamed to avoid collisions with something
>> > else?
>> >
>> > On 22 July 2012 20:40, Alexander Shorin <kx...@gmail.com> wrote:
>> >
>> >> Hi Samuel!
>> >>
>> >> > 1/ I'm wondering what are valid responses to validate_doc_update? The
>> >> query
>> >> > services I've seen return either a hash {forbidden: "message"} or 1
>> >> >
>> >> > Can I return true rather than 1? Seems more logical..
>> >>
>> >> You could, but this would be invalid output. See for details:
>> >>
>> >>
>> https://github.com/apache/couchdb/blob/master/src/couchdb/couch_query_servers.erl#L230
>> >>
>> >>
>> >> > 2/ Why is the name "validate_doc_update" so verbose when compared with
>> >> > "lists", "filters", etc? Why not just "validates"?
>> >>
>> >> Initially it was "validate" command, but since any ddoc subcommand is
>> >> a ddoc field, it eventually renamed to validate_doc_update.
>> >> See first commit about it:
>> >>
>> >>
>> https://github.com/apache/couchdb/commit/9044fc0234ed65056f087a86c7c117922f2a2c75
>> >>
>> >> --
>> >> ,,,^..^,,,
>> >>
>> >>
>> >> On Sun, Jul 22, 2012 at 12:07 PM, Samuel Williams
>> >> <sp...@gmail.com> wrote:
>> >> > Hi,
>> >> >
>> >> > 1/ I'm wondering what are valid responses to validate_doc_update? The
>> >> query
>> >> > services I've seen return either a hash {forbidden: "message"} or 1
>> >> >
>> >> > Can I return true rather than 1? Seems more logical..
>> >> >
>> >> > How do I report multiple failures? e.g. Title required, Author
>> required.
>> >> >
>> >> > 2/ Why is the name "validate_doc_update" so verbose when compared with
>> >> > "lists", "filters", etc? Why not just "validates"?
>> >> >
>> >> > Thanks,
>> >> > Samuel
>> >>
>>

Re: validate_doc_update response?

Posted by Samuel Williams <sp...@gmail.com>.
I can't see why "validate" is a problem, I checked the patch which changed
the name:

https://github.com/apache/couchdb/commit/ea3b1153e52ac1513da4d634eedefb05c261039c

I couldn't see any reason why the name was changed..?

Kind regards,
Samuel

On 22 July 2012 20:52, Alexander Shorin <kx...@gmail.com> wrote:

> Hi again(: No problems.
>
> On Sun, Jul 22, 2012 at 12:48 PM, Samuel Williams
> <sp...@gmail.com> wrote:
> > Regarding the "1" result, I'm surprised that it isn't 'true', since that
> > would seem far more logical and match the rest of the protocol, e.g.
> > 'reset', and various other commands.
>
> I suppose main decision was about how to easily understand what
> response received for what command, but I could be wrong there.
>
> > I'm not sure I understand the motivation behind going from "validate" to
> > "validate_doc_update" - was it renamed to avoid collisions with something
> > else?
>
> You just need once to take a look at how ddoc command been processed
> to figure "why so"(:
> https://github.com/apache/couchdb/blob/master/share/server/loop.js#L69
>
> --
> ,,,^..^,,,
>
>
> On Sun, Jul 22, 2012 at 12:48 PM, Samuel Williams
> <sp...@gmail.com> wrote:
> > Thanks again Alex, you are always so helpful - and the references you
> > provide are really great.
> >
> > Regarding the "1" result, I'm surprised that it isn't 'true', since that
> > would seem far more logical and match the rest of the protocol, e.g.
> > 'reset', and various other commands.
> >
> > I'm not sure I understand the motivation behind going from "validate" to
> > "validate_doc_update" - was it renamed to avoid collisions with something
> > else?
> >
> > On 22 July 2012 20:40, Alexander Shorin <kx...@gmail.com> wrote:
> >
> >> Hi Samuel!
> >>
> >> > 1/ I'm wondering what are valid responses to validate_doc_update? The
> >> query
> >> > services I've seen return either a hash {forbidden: "message"} or 1
> >> >
> >> > Can I return true rather than 1? Seems more logical..
> >>
> >> You could, but this would be invalid output. See for details:
> >>
> >>
> https://github.com/apache/couchdb/blob/master/src/couchdb/couch_query_servers.erl#L230
> >>
> >>
> >> > 2/ Why is the name "validate_doc_update" so verbose when compared with
> >> > "lists", "filters", etc? Why not just "validates"?
> >>
> >> Initially it was "validate" command, but since any ddoc subcommand is
> >> a ddoc field, it eventually renamed to validate_doc_update.
> >> See first commit about it:
> >>
> >>
> https://github.com/apache/couchdb/commit/9044fc0234ed65056f087a86c7c117922f2a2c75
> >>
> >> --
> >> ,,,^..^,,,
> >>
> >>
> >> On Sun, Jul 22, 2012 at 12:07 PM, Samuel Williams
> >> <sp...@gmail.com> wrote:
> >> > Hi,
> >> >
> >> > 1/ I'm wondering what are valid responses to validate_doc_update? The
> >> query
> >> > services I've seen return either a hash {forbidden: "message"} or 1
> >> >
> >> > Can I return true rather than 1? Seems more logical..
> >> >
> >> > How do I report multiple failures? e.g. Title required, Author
> required.
> >> >
> >> > 2/ Why is the name "validate_doc_update" so verbose when compared with
> >> > "lists", "filters", etc? Why not just "validates"?
> >> >
> >> > Thanks,
> >> > Samuel
> >>
>

Re: validate_doc_update response?

Posted by Alexander Shorin <kx...@gmail.com>.
Hi again(: No problems.

On Sun, Jul 22, 2012 at 12:48 PM, Samuel Williams
<sp...@gmail.com> wrote:
> Regarding the "1" result, I'm surprised that it isn't 'true', since that
> would seem far more logical and match the rest of the protocol, e.g.
> 'reset', and various other commands.

I suppose main decision was about how to easily understand what
response received for what command, but I could be wrong there.

> I'm not sure I understand the motivation behind going from "validate" to
> "validate_doc_update" - was it renamed to avoid collisions with something
> else?

You just need once to take a look at how ddoc command been processed
to figure "why so"(:
https://github.com/apache/couchdb/blob/master/share/server/loop.js#L69

--
,,,^..^,,,


On Sun, Jul 22, 2012 at 12:48 PM, Samuel Williams
<sp...@gmail.com> wrote:
> Thanks again Alex, you are always so helpful - and the references you
> provide are really great.
>
> Regarding the "1" result, I'm surprised that it isn't 'true', since that
> would seem far more logical and match the rest of the protocol, e.g.
> 'reset', and various other commands.
>
> I'm not sure I understand the motivation behind going from "validate" to
> "validate_doc_update" - was it renamed to avoid collisions with something
> else?
>
> On 22 July 2012 20:40, Alexander Shorin <kx...@gmail.com> wrote:
>
>> Hi Samuel!
>>
>> > 1/ I'm wondering what are valid responses to validate_doc_update? The
>> query
>> > services I've seen return either a hash {forbidden: "message"} or 1
>> >
>> > Can I return true rather than 1? Seems more logical..
>>
>> You could, but this would be invalid output. See for details:
>>
>> https://github.com/apache/couchdb/blob/master/src/couchdb/couch_query_servers.erl#L230
>>
>>
>> > 2/ Why is the name "validate_doc_update" so verbose when compared with
>> > "lists", "filters", etc? Why not just "validates"?
>>
>> Initially it was "validate" command, but since any ddoc subcommand is
>> a ddoc field, it eventually renamed to validate_doc_update.
>> See first commit about it:
>>
>> https://github.com/apache/couchdb/commit/9044fc0234ed65056f087a86c7c117922f2a2c75
>>
>> --
>> ,,,^..^,,,
>>
>>
>> On Sun, Jul 22, 2012 at 12:07 PM, Samuel Williams
>> <sp...@gmail.com> wrote:
>> > Hi,
>> >
>> > 1/ I'm wondering what are valid responses to validate_doc_update? The
>> query
>> > services I've seen return either a hash {forbidden: "message"} or 1
>> >
>> > Can I return true rather than 1? Seems more logical..
>> >
>> > How do I report multiple failures? e.g. Title required, Author required.
>> >
>> > 2/ Why is the name "validate_doc_update" so verbose when compared with
>> > "lists", "filters", etc? Why not just "validates"?
>> >
>> > Thanks,
>> > Samuel
>>

Re: validate_doc_update response?

Posted by Samuel Williams <sp...@gmail.com>.
Thanks again Alex, you are always so helpful - and the references you
provide are really great.

Regarding the "1" result, I'm surprised that it isn't 'true', since that
would seem far more logical and match the rest of the protocol, e.g.
'reset', and various other commands.

I'm not sure I understand the motivation behind going from "validate" to
"validate_doc_update" - was it renamed to avoid collisions with something
else?

On 22 July 2012 20:40, Alexander Shorin <kx...@gmail.com> wrote:

> Hi Samuel!
>
> > 1/ I'm wondering what are valid responses to validate_doc_update? The
> query
> > services I've seen return either a hash {forbidden: "message"} or 1
> >
> > Can I return true rather than 1? Seems more logical..
>
> You could, but this would be invalid output. See for details:
>
> https://github.com/apache/couchdb/blob/master/src/couchdb/couch_query_servers.erl#L230
>
>
> > 2/ Why is the name "validate_doc_update" so verbose when compared with
> > "lists", "filters", etc? Why not just "validates"?
>
> Initially it was "validate" command, but since any ddoc subcommand is
> a ddoc field, it eventually renamed to validate_doc_update.
> See first commit about it:
>
> https://github.com/apache/couchdb/commit/9044fc0234ed65056f087a86c7c117922f2a2c75
>
> --
> ,,,^..^,,,
>
>
> On Sun, Jul 22, 2012 at 12:07 PM, Samuel Williams
> <sp...@gmail.com> wrote:
> > Hi,
> >
> > 1/ I'm wondering what are valid responses to validate_doc_update? The
> query
> > services I've seen return either a hash {forbidden: "message"} or 1
> >
> > Can I return true rather than 1? Seems more logical..
> >
> > How do I report multiple failures? e.g. Title required, Author required.
> >
> > 2/ Why is the name "validate_doc_update" so verbose when compared with
> > "lists", "filters", etc? Why not just "validates"?
> >
> > Thanks,
> > Samuel
>

Re: validate_doc_update response?

Posted by Alexander Shorin <kx...@gmail.com>.
Hi Samuel!

> 1/ I'm wondering what are valid responses to validate_doc_update? The query
> services I've seen return either a hash {forbidden: "message"} or 1
>
> Can I return true rather than 1? Seems more logical..

You could, but this would be invalid output. See for details:
https://github.com/apache/couchdb/blob/master/src/couchdb/couch_query_servers.erl#L230


> 2/ Why is the name "validate_doc_update" so verbose when compared with
> "lists", "filters", etc? Why not just "validates"?

Initially it was "validate" command, but since any ddoc subcommand is
a ddoc field, it eventually renamed to validate_doc_update.
See first commit about it:
https://github.com/apache/couchdb/commit/9044fc0234ed65056f087a86c7c117922f2a2c75

--
,,,^..^,,,


On Sun, Jul 22, 2012 at 12:07 PM, Samuel Williams
<sp...@gmail.com> wrote:
> Hi,
>
> 1/ I'm wondering what are valid responses to validate_doc_update? The query
> services I've seen return either a hash {forbidden: "message"} or 1
>
> Can I return true rather than 1? Seems more logical..
>
> How do I report multiple failures? e.g. Title required, Author required.
>
> 2/ Why is the name "validate_doc_update" so verbose when compared with
> "lists", "filters", etc? Why not just "validates"?
>
> Thanks,
> Samuel