incubator-couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Shorin <kxe...@gmail.com>
Subject Re: validate_doc_update response?
Date Sun, 22 Jul 2012 08:52:50 GMT
Hi again(: No problems.

On Sun, Jul 22, 2012 at 12:48 PM, Samuel Williams
<space.ship.traveller@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
<space.ship.traveller@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 <kxepal@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
>> <space.ship.traveller@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
>>

Mime
View raw message