/
RedirectRequestSchema.js
41 lines (38 loc) · 1.19 KB
/
RedirectRequestSchema.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
'use strict';
const makeSchema = require('../utils/makeSchema');
const FlatObjectSchema = require('./FlatObjectSchema');
module.exports = makeSchema(
{
id: '/RedirectRequestSchema',
description:
'A representation of a HTTP redirect - you can use the `{{syntax}}` to inject authentication, field or global variables.',
type: 'object',
properties: {
method: {
description: 'The HTTP method for the request.',
type: 'string',
default: 'GET',
enum: ['GET'],
},
url: {
description:
'A URL for the request (we will parse the querystring and merge with params). Keys and values will not be re-encoded.',
type: 'string',
},
params: {
description:
'A mapping of the querystring - will get merged with any query params in the URL. Keys and values will be encoded.',
$ref: FlatObjectSchema.id,
},
},
additionalProperties: false,
examples: [{ method: 'GET', url: 'https://google.com' }],
antiExamples: [
{
example: { method: 'POST', url: 'https://google.com' },
reason: 'Invalid value for key: method',
},
],
},
[FlatObjectSchema]
);