-
Notifications
You must be signed in to change notification settings - Fork 2
/
SectionTypes.js
58 lines (54 loc) · 1.63 KB
/
SectionTypes.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const SectionTypes = Object.freeze({
undefined: 'undefined',
resource: 'resource',
resourceGroup: 'resourceGroup',
subGroup: 'subGroup',
dataStructureGroup: 'dataStructureGroup',
schemaStructureGroup: 'schemaStructureGroup',
resourcePrototypes: 'resourcePrototypes',
resourcePrototype: 'resourcePrototype',
MSONNamedType: 'MSONNamedType',
schemaNamedType: 'schemaNamedType',
action: 'action',
namedAction: 'namedAction',
parameters: 'parameters',
parameter: 'parameter',
defaultValue: 'defaultValue',
defaultValueMember: 'defaultValueMember',
sampleValue: 'sampleValue',
sampleValueMember: 'sampleValueMember',
parameterMembers: 'parameterMembers',
parameterMember: 'parameterMember',
enumMember: 'enumMember',
arrayMember: 'arrayMember',
request: 'request',
response: 'response',
body: 'body',
headers: 'headers',
attributes: 'attributes',
schema: 'schema',
msonAttribute: 'msonAttribute',
msonMixin: 'msonMixin',
msonObjectMemberGroup: 'msonObjectMemberGroup',
msonArrayMemberGroup: 'msonArrayMemberGroup',
msonEnumMemberGroup: 'msonEnumMemberGroup',
oneOfType: 'oneOfType',
oneOfTypeOption: 'oneOfTypeOption',
message: 'message',
import: 'import',
/**
* @param {object} node
* @param {Context} context
* @param {array} parsers
* @returns {string}
*/
calculateSectionType(node, context, parsers) {
let result = SectionTypes.undefined;
for (let i = 0; i < parsers.length; i += 1) {
result = parsers[i].sectionType(node, context);
if (result !== SectionTypes.undefined) return result;
}
return result;
},
});
module.exports = SectionTypes;