Skip to content

Commit 37cff9a

Browse files
committed
update API documentation and fix spelling
1 parent 5c4dc46 commit 37cff9a

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

db/import.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,11 +552,11 @@ func (db *DatabaseCollectionWithUser) ImportFilterDryRun(ctx context.Context, do
552552
var shouldImport bool
553553
if importFn == "" {
554554
importFilter := db.importFilter()
555-
ouput, err := importFilter.EvaluateFunction(ctx, doc, true)
555+
output, err := importFilter.EvaluateFunction(ctx, doc, true)
556556
if err != nil {
557557
return false, &base.ImportFilterDryRunError{Err: err}
558558
}
559-
shouldImport = ouput
559+
shouldImport = output
560560
} else {
561561
jsTimeout := time.Duration(base.DefaultJavascriptTimeoutSecs) * time.Second
562562
importRunner, err := newImportFilterRunner(ctx, importFn, jsTimeout)

docs/api/paths/diagnostic/keyspace-import_filter.yaml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,31 @@
77
# the file licenses/APL2.txt.
88
parameters:
99
- $ref: ../../components/parameters.yaml#/keyspace
10-
get:
10+
- $ref: ../../components/parameters.yaml#/doc_id
11+
post:
1112
summary: Run a doc body through the Import filter and return results.
1213
description: |-
13-
Run a document body through the import filter and return whether its imported or not, and any error messages.
14+
Runs a document body through the import filter and return whether its
15+
imported or not, and any error messages. If no custom import filter is
16+
provided in the request body, the default or user-defined import filter
17+
is used.
18+
1419
* Sync Gateway Application Read Only
1520
requestBody:
1621
content:
1722
application/json:
1823
schema:
19-
$ref: ../../components/schemas.yaml#/Document
24+
type: object
25+
properties:
26+
import_filter:
27+
description: |-
28+
A JavaScript function that all imported documents in the
29+
default scope and collection are ran through in order to filter
30+
out what to import and what not to import.
31+
type: string
32+
example: 'function(doc) { if (doc.type != ''mobile'') { return false; } return true; }'
33+
doc:
34+
$ref: ../../components/schemas.yaml#/Document
2035
responses:
2136
'200':
2237
description: Document Processed by import filter successfully

0 commit comments

Comments
 (0)