@gitbook/react-openapi 1.2.1 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/OpenAPICodeSample.jsx +7 -4
  3. package/dist/OpenAPIDisclosure.d.ts +1 -0
  4. package/dist/OpenAPIDisclosure.jsx +6 -3
  5. package/dist/OpenAPIDisclosureGroup.jsx +16 -15
  6. package/dist/OpenAPIRequestBody.jsx +7 -2
  7. package/dist/OpenAPIRequestBodyHeaderType.d.ts +8 -0
  8. package/dist/OpenAPIRequestBodyHeaderType.jsx +25 -0
  9. package/dist/OpenAPIResponse.d.ts +1 -1
  10. package/dist/OpenAPIResponse.jsx +20 -4
  11. package/dist/OpenAPIResponseExample.jsx +15 -3
  12. package/dist/OpenAPIResponses.jsx +6 -1
  13. package/dist/OpenAPISchema.d.ts +9 -2
  14. package/dist/OpenAPISchema.jsx +87 -91
  15. package/dist/OpenAPISchemaName.d.ts +1 -1
  16. package/dist/OpenAPISchemaName.jsx +5 -5
  17. package/dist/OpenAPISecurities.jsx +59 -1
  18. package/dist/OpenAPISelect.jsx +1 -0
  19. package/dist/OpenAPISpec.jsx +16 -1
  20. package/dist/OpenAPIWebhookExample.jsx +1 -1
  21. package/dist/StaticSection.jsx +1 -1
  22. package/dist/code-samples.js +6 -3
  23. package/dist/generateSchemaExample.js +19 -14
  24. package/dist/getDisclosureLabel.d.ts +7 -0
  25. package/dist/getDisclosureLabel.js +18 -0
  26. package/dist/schemas/OpenAPISchemaItem.d.ts +7 -0
  27. package/dist/schemas/OpenAPISchemaItem.jsx +16 -0
  28. package/dist/schemas/OpenAPISchemas.jsx +3 -9
  29. package/dist/translations/de.d.ts +7 -1
  30. package/dist/translations/de.js +10 -4
  31. package/dist/translations/en.d.ts +7 -1
  32. package/dist/translations/en.js +9 -3
  33. package/dist/translations/es.d.ts +7 -1
  34. package/dist/translations/es.js +10 -4
  35. package/dist/translations/fr.d.ts +7 -1
  36. package/dist/translations/fr.js +11 -5
  37. package/dist/translations/index.d.ts +63 -9
  38. package/dist/translations/ja.d.ts +7 -1
  39. package/dist/translations/ja.js +9 -3
  40. package/dist/translations/nl.d.ts +7 -1
  41. package/dist/translations/nl.js +9 -3
  42. package/dist/translations/no.d.ts +7 -1
  43. package/dist/translations/no.js +10 -4
  44. package/dist/translations/pt-br.d.ts +7 -1
  45. package/dist/translations/pt-br.js +10 -4
  46. package/dist/translations/zh.d.ts +7 -1
  47. package/dist/translations/zh.js +10 -4
  48. package/dist/tsconfig.build.tsbuildinfo +1 -1
  49. package/dist/utils.d.ts +1 -0
  50. package/dist/utils.js +38 -0
  51. package/package.json +2 -2
  52. package/src/OpenAPICodeSample.tsx +7 -6
  53. package/src/OpenAPIDisclosure.tsx +7 -3
  54. package/src/OpenAPIDisclosureGroup.tsx +49 -48
  55. package/src/OpenAPIRequestBody.tsx +11 -2
  56. package/src/OpenAPIRequestBodyHeaderType.tsx +36 -0
  57. package/src/OpenAPIResponse.tsx +37 -5
  58. package/src/OpenAPIResponseExample.tsx +46 -35
  59. package/src/OpenAPIResponses.tsx +4 -4
  60. package/src/OpenAPISchema.tsx +157 -130
  61. package/src/OpenAPISchemaName.tsx +10 -8
  62. package/src/OpenAPISecurities.tsx +111 -7
  63. package/src/OpenAPISelect.tsx +1 -1
  64. package/src/OpenAPISpec.tsx +21 -1
  65. package/src/OpenAPIWebhookExample.tsx +2 -2
  66. package/src/StaticSection.tsx +1 -1
  67. package/src/code-samples.test.ts +3 -2
  68. package/src/code-samples.ts +19 -12
  69. package/src/generateSchemaExample.test.ts +20 -0
  70. package/src/generateSchemaExample.ts +9 -1
  71. package/src/getDisclosureLabel.ts +25 -0
  72. package/src/schemas/OpenAPISchemaItem.tsx +34 -0
  73. package/src/schemas/OpenAPISchemas.tsx +7 -13
  74. package/src/translations/de.ts +10 -4
  75. package/src/translations/en.ts +9 -3
  76. package/src/translations/es.ts +10 -4
  77. package/src/translations/fr.ts +11 -5
  78. package/src/translations/ja.ts +9 -3
  79. package/src/translations/nl.ts +9 -3
  80. package/src/translations/no.ts +10 -4
  81. package/src/translations/pt-br.ts +10 -4
  82. package/src/translations/zh.ts +10 -4
  83. package/src/utils.ts +37 -0
@@ -30,7 +30,7 @@ export const codeSampleGenerators: CodeSampleGenerator[] = [
30
30
  {
31
31
  id: 'http',
32
32
  label: 'HTTP',
33
- syntax: 'bash',
33
+ syntax: 'http',
34
34
  generate: ({ method, url, headers = {}, body }: CodeSampleInput) => {
35
35
  const { host, path } = parseHostAndPath(url);
36
36
 
@@ -356,18 +356,25 @@ const BodyGenerators = {
356
356
  // Convert JSON to XML if needed
357
357
  body = JSON.stringify(convertBodyToXML(body));
358
358
  } else {
359
- body = stringifyOpenAPI(body, (_key, value) => {
360
- switch (value) {
361
- case true:
362
- return '$$__TRUE__$$';
363
- case false:
364
- return '$$__FALSE__$$';
365
- default:
366
- return value;
367
- }
368
- })
359
+ body = stringifyOpenAPI(
360
+ body,
361
+ (_key, value) => {
362
+ switch (value) {
363
+ case true:
364
+ return '$$__TRUE__$$';
365
+ case false:
366
+ return '$$__FALSE__$$';
367
+ case null:
368
+ return '$$__NULL__$$';
369
+ default:
370
+ return value;
371
+ }
372
+ },
373
+ 2
374
+ )
369
375
  .replaceAll('"$$__TRUE__$$"', 'True')
370
- .replaceAll('"$$__FALSE__$$"', 'False');
376
+ .replaceAll('"$$__FALSE__$$"', 'False')
377
+ .replaceAll('"$$__NULL__$$"', 'None');
371
378
  }
372
379
 
373
380
  return { body, code, headers };
@@ -1017,4 +1017,24 @@ describe('generateSchemaExample', () => {
1017
1017
  },
1018
1018
  });
1019
1019
  });
1020
+
1021
+ it('handles deprecated properties', () => {
1022
+ expect(
1023
+ generateSchemaExample({
1024
+ type: 'object',
1025
+ deprecated: true,
1026
+ })
1027
+ ).toBeUndefined();
1028
+ });
1029
+
1030
+ it('handle nested deprecated properties', () => {
1031
+ expect(
1032
+ generateSchemaExample({
1033
+ type: 'array',
1034
+ items: {
1035
+ deprecated: true,
1036
+ },
1037
+ })
1038
+ ).toBeUndefined();
1039
+ });
1020
1040
  });
@@ -167,7 +167,7 @@ const getExampleFromSchema = (
167
167
  const makeUpRandomData = !!options?.emptyString;
168
168
 
169
169
  // If the property is deprecated we don't show it in examples.
170
- if (schema.deprecated) {
170
+ if (schema.deprecated || (schema.type === 'array' && schema.items?.deprecated)) {
171
171
  return undefined;
172
172
  }
173
173
 
@@ -204,6 +204,14 @@ const getExampleFromSchema = (
204
204
  return cache(schema, schema.example);
205
205
  }
206
206
 
207
+ // Use a default value, if there’s one and it’s a string or number
208
+ if (
209
+ schema.default !== undefined &&
210
+ ['string', 'number', 'boolean'].includes(typeof schema.default)
211
+ ) {
212
+ return cache(schema, schema.default);
213
+ }
214
+
207
215
  // enum: [ 'available', 'pending', 'sold' ]
208
216
  if (Array.isArray(schema.enum) && schema.enum.length > 0) {
209
217
  return cache(schema, schema.enum[0]);
@@ -0,0 +1,25 @@
1
+ 'use client';
2
+
3
+ import type { OpenAPIV3 } from '@gitbook/openapi-parser';
4
+ import type { OpenAPIClientContext } from './context';
5
+ import { tString } from './translate';
6
+
7
+ export function getDisclosureLabel(props: {
8
+ schema: OpenAPIV3.SchemaObject;
9
+ isExpanded: boolean;
10
+ context: OpenAPIClientContext;
11
+ }) {
12
+ const { schema, isExpanded, context } = props;
13
+ let label: string;
14
+ if (schema.type === 'array' && !!schema.items) {
15
+ if (schema.items.oneOf) {
16
+ label = tString(context.translation, 'available_items').toLowerCase();
17
+ } else {
18
+ label = tString(context.translation, 'properties').toLowerCase();
19
+ }
20
+ } else {
21
+ label = tString(context.translation, 'properties').toLowerCase();
22
+ }
23
+
24
+ return tString(context.translation, isExpanded ? 'hide' : 'show', label);
25
+ }
@@ -0,0 +1,34 @@
1
+ 'use client';
2
+
3
+ import { SectionBody } from '../StaticSection';
4
+
5
+ import type { OpenAPIV3 } from '@gitbook/openapi-parser';
6
+ import { OpenAPIDisclosure } from '../OpenAPIDisclosure';
7
+ import { OpenAPIRootSchema } from '../OpenAPISchemaServer';
8
+ import { Section } from '../StaticSection';
9
+ import type { OpenAPIClientContext } from '../context';
10
+ import { getDisclosureLabel } from '../getDisclosureLabel';
11
+
12
+ export function OpenAPISchemaItem(props: {
13
+ name: string;
14
+ schema: OpenAPIV3.SchemaObject;
15
+ context: OpenAPIClientContext;
16
+ }) {
17
+ const { schema, context, name } = props;
18
+
19
+ return (
20
+ <OpenAPIDisclosure
21
+ className="openapi-schemas-disclosure"
22
+ key={name}
23
+ icon={context.icons.plus}
24
+ header={name}
25
+ label={(isExpanded) => getDisclosureLabel({ schema, isExpanded, context })}
26
+ >
27
+ <Section className="openapi-section-schemas">
28
+ <SectionBody>
29
+ <OpenAPIRootSchema schema={schema} context={context} />
30
+ </SectionBody>
31
+ </Section>
32
+ </OpenAPIDisclosure>
33
+ );
34
+ }
@@ -1,9 +1,8 @@
1
1
  import type { OpenAPISchema } from '@gitbook/openapi-parser';
2
2
  import clsx from 'clsx';
3
- import { OpenAPIDisclosure } from '../OpenAPIDisclosure';
4
3
  import { OpenAPIExample } from '../OpenAPIExample';
5
4
  import { OpenAPIRootSchema } from '../OpenAPISchemaServer';
6
- import { Section, SectionBody, StaticSection } from '../StaticSection';
5
+ import { StaticSection } from '../StaticSection';
7
6
  import {
8
7
  type OpenAPIContextInput,
9
8
  getOpenAPIClientContext,
@@ -11,6 +10,7 @@ import {
11
10
  } from '../context';
12
11
  import { t } from '../translate';
13
12
  import { getExampleFromSchema } from '../util/example';
13
+ import { OpenAPISchemaItem } from './OpenAPISchemaItem';
14
14
 
15
15
  /**
16
16
  * OpenAPI Schemas component.
@@ -85,18 +85,12 @@ export function OpenAPISchemas(props: {
85
85
  <div className={clsx('openapi-schemas', className)}>
86
86
  {schemas.map(({ name, schema }) => {
87
87
  return (
88
- <OpenAPIDisclosure
89
- className="openapi-schemas-disclosure"
88
+ <OpenAPISchemaItem
90
89
  key={name}
91
- icon={context.icons.chevronRight}
92
- label={name}
93
- >
94
- <Section className="openapi-section-schemas">
95
- <SectionBody>
96
- <OpenAPIRootSchema schema={schema} context={clientContext} />
97
- </SectionBody>
98
- </Section>
99
- </OpenAPIDisclosure>
90
+ name={name}
91
+ context={clientContext}
92
+ schema={schema}
93
+ />
100
94
  );
101
95
  })}
102
96
  </div>
@@ -18,9 +18,11 @@ export const de = {
18
18
  nullable: 'Nullfähig',
19
19
  body: 'Rumpf',
20
20
  payload: 'Nutzlast',
21
- headers: 'Kopfzeilen',
21
+ headers: 'Header',
22
+ header: 'Header',
22
23
  authorizations: 'Autorisierungen',
23
24
  responses: 'Antworten',
25
+ response: 'Antwort',
24
26
  path_parameters: 'Pfadparameter',
25
27
  query_parameters: 'Abfrageparameter',
26
28
  header_parameters: 'Header-Parameter',
@@ -30,8 +32,12 @@ export const de = {
30
32
  success: 'Erfolg',
31
33
  redirect: 'Umleitung',
32
34
  error: 'Fehler',
33
- show: 'Anzeigen',
34
- hide: 'Verstecken',
35
+ show: 'Zeige ${1}',
36
+ hide: 'Verstecke ${1}',
35
37
  available_items: 'Verfügbare Elemente',
36
- child_attributes: 'Unterattribute',
38
+ available_scopes: 'Verfügbare scopes',
39
+ properties: 'Eigenschaften',
40
+ or: 'oder',
41
+ and: 'und',
42
+ possible_values: 'Mögliche Werte',
37
43
  };
@@ -19,8 +19,10 @@ export const en = {
19
19
  body: 'Body',
20
20
  payload: 'Payload',
21
21
  headers: 'Headers',
22
+ header: 'Header',
22
23
  authorizations: 'Authorizations',
23
24
  responses: 'Responses',
25
+ response: 'Response',
24
26
  path_parameters: 'Path parameters',
25
27
  query_parameters: 'Query parameters',
26
28
  header_parameters: 'Header parameters',
@@ -30,8 +32,12 @@ export const en = {
30
32
  success: 'Success',
31
33
  redirect: 'Redirect',
32
34
  error: 'Error',
33
- show: 'Show',
34
- hide: 'Hide',
35
+ show: 'Show ${1}',
36
+ hide: 'Hide ${1}',
35
37
  available_items: 'Available items',
36
- child_attributes: 'Child attributes',
38
+ available_scopes: 'Available scopes',
39
+ possible_values: 'Possible values',
40
+ properties: 'Properties',
41
+ or: 'or',
42
+ and: 'and',
37
43
  };
@@ -18,9 +18,11 @@ export const es = {
18
18
  nullable: 'Nulo',
19
19
  body: 'Cuerpo',
20
20
  payload: 'Caga útil',
21
- headers: 'Encabezados',
21
+ headers: 'Headers',
22
+ header: 'Header',
22
23
  authorizations: 'Autorizaciones',
23
24
  responses: 'Respuestas',
25
+ response: 'Respuesta',
24
26
  path_parameters: 'Parámetros de ruta',
25
27
  query_parameters: 'Parámetros de consulta',
26
28
  header_parameters: 'Parámetros de encabezado',
@@ -30,8 +32,12 @@ export const es = {
30
32
  success: 'Éxito',
31
33
  redirect: 'Redirección',
32
34
  error: 'Error',
33
- show: 'Mostrar',
34
- hide: 'Ocultar',
35
+ show: 'Mostrar ${1}',
36
+ hide: 'Ocultar ${1}',
35
37
  available_items: 'Elementos disponibles',
36
- child_attributes: 'Atributos secundarios',
38
+ available_scopes: 'Scopes disponibles',
39
+ properties: 'Propiedades',
40
+ or: 'o',
41
+ and: 'y',
42
+ possible_values: 'Valores posibles',
37
43
  };
@@ -18,20 +18,26 @@ export const fr = {
18
18
  nullable: 'Nullable',
19
19
  body: 'Corps',
20
20
  payload: 'Charge utile',
21
- headers: 'En-têtes',
21
+ headers: 'Headers',
22
+ header: 'Header',
22
23
  authorizations: 'Autorisations',
23
24
  responses: 'Réponses',
25
+ response: 'Réponse',
24
26
  path_parameters: 'Paramètres de chemin',
25
27
  query_parameters: 'Paramètres de requête',
26
- header_parameters: 'Paramètres den-tête',
28
+ header_parameters: "Paramètres d'en-tête",
27
29
  attributes: 'Attributs',
28
30
  test_it: 'Tester',
29
31
  information: 'Information',
30
32
  success: 'Succès',
31
33
  redirect: 'Redirection',
32
34
  error: 'Erreur',
33
- show: 'Afficher',
34
- hide: 'Masquer',
35
+ show: 'Afficher ${1}',
36
+ hide: 'Masquer ${1}',
35
37
  available_items: 'Éléments disponibles',
36
- child_attributes: 'Attributs enfants',
38
+ available_scopes: 'Scopes disponibles',
39
+ properties: 'Propriétés',
40
+ or: 'ou',
41
+ and: 'et',
42
+ possible_values: 'Valeurs possibles',
37
43
  };
@@ -19,8 +19,10 @@ export const ja = {
19
19
  body: '本文',
20
20
  payload: 'ペイロード',
21
21
  headers: 'ヘッダー',
22
+ header: 'ヘッダー',
22
23
  authorizations: '認可',
23
24
  responses: 'レスポンス',
25
+ response: 'レスポンス',
24
26
  path_parameters: 'パスパラメータ',
25
27
  query_parameters: 'クエリパラメータ',
26
28
  header_parameters: 'ヘッダーパラメータ',
@@ -30,8 +32,12 @@ export const ja = {
30
32
  success: '成功',
31
33
  redirect: 'リダイレクト',
32
34
  error: 'エラー',
33
- show: '表示',
34
- hide: '非表示',
35
+ show: '${1}を表示',
36
+ hide: '${1}を非表示',
35
37
  available_items: '利用可能なアイテム',
36
- child_attributes: '子属性',
38
+ available_scopes: '利用可能なスコープ',
39
+ properties: 'プロパティ',
40
+ or: 'または',
41
+ and: 'かつ',
42
+ possible_values: '可能な値',
37
43
  };
@@ -19,8 +19,10 @@ export const nl = {
19
19
  body: 'Body',
20
20
  payload: 'Payload',
21
21
  headers: 'Headers',
22
+ header: 'Header',
22
23
  authorizations: 'Autorisaties',
23
24
  responses: 'Reacties',
25
+ response: 'Reactie',
24
26
  path_parameters: 'Padparameters',
25
27
  query_parameters: 'Queryparameters',
26
28
  header_parameters: 'Headerparameters',
@@ -30,8 +32,12 @@ export const nl = {
30
32
  success: 'Succes',
31
33
  redirect: 'Omleiding',
32
34
  error: 'Fout',
33
- show: 'Toon',
34
- hide: 'Verbergen',
35
+ show: 'Toon ${1}',
36
+ hide: 'Verberg ${1}',
35
37
  available_items: 'Beschikbare items',
36
- child_attributes: 'Kindattributen',
38
+ available_scopes: 'Beschikbare scopes',
39
+ properties: 'Eigenschappen',
40
+ or: 'of',
41
+ and: 'en',
42
+ possible_values: 'Mogelijke waarden',
37
43
  };
@@ -18,9 +18,11 @@ export const no = {
18
18
  nullable: 'Kan være null',
19
19
  body: 'Brødtekst',
20
20
  payload: 'Nyttelast',
21
- headers: 'Overskrifter',
21
+ headers: 'Headers',
22
+ header: 'Header',
22
23
  authorizations: 'Autorisasjoner',
23
24
  responses: 'Responser',
25
+ response: 'Respons',
24
26
  path_parameters: 'Sti-parametere',
25
27
  query_parameters: 'Forespørselsparametere',
26
28
  header_parameters: 'Header-parametere',
@@ -30,8 +32,12 @@ export const no = {
30
32
  success: 'Suksess',
31
33
  redirect: 'Viderekobling',
32
34
  error: 'Feil',
33
- show: 'Vis',
34
- hide: 'Skjul',
35
+ show: 'Vis ${1}',
36
+ hide: 'Skjul ${1}',
35
37
  available_items: 'Tilgjengelige elementer',
36
- child_attributes: 'Barneattributter',
38
+ available_scopes: 'Tilgjengelige scopes',
39
+ properties: 'Egenskaper',
40
+ or: 'eller',
41
+ and: 'og',
42
+ possible_values: 'Mulige verdier',
37
43
  };
@@ -18,9 +18,11 @@ export const pt_br = {
18
18
  nullable: 'Nulo',
19
19
  body: 'Corpo',
20
20
  payload: 'Carga útil',
21
- headers: 'Cabeçalhos',
21
+ headers: 'Headers',
22
+ header: 'Header',
22
23
  authorizations: 'Autorizações',
23
24
  responses: 'Respostas',
25
+ response: 'Resposta',
24
26
  path_parameters: 'Parâmetros de rota',
25
27
  query_parameters: 'Parâmetros de consulta',
26
28
  header_parameters: 'Parâmetros de cabeçalho',
@@ -30,8 +32,12 @@ export const pt_br = {
30
32
  success: 'Sucesso',
31
33
  redirect: 'Redirecionamento',
32
34
  error: 'Erro',
33
- show: 'Mostrar',
34
- hide: 'Ocultar',
35
+ show: 'Mostrar ${1}',
36
+ hide: 'Ocultar ${1}',
35
37
  available_items: 'Itens disponíveis',
36
- child_attributes: 'Atributos filhos',
38
+ available_scopes: 'Scopes disponíveis',
39
+ properties: 'Propriedades',
40
+ or: 'ou',
41
+ and: 'e',
42
+ possible_values: 'Valores possíveis',
37
43
  };
@@ -18,9 +18,11 @@ export const zh = {
18
18
  nullable: '可为 null',
19
19
  body: '请求体',
20
20
  payload: '有效载荷',
21
- headers: '头部信息',
21
+ headers: '头字段',
22
+ header: '头部',
22
23
  authorizations: '授权',
23
24
  responses: '响应',
25
+ response: '响应',
24
26
  path_parameters: '路径参数',
25
27
  query_parameters: '查询参数',
26
28
  header_parameters: '头参数',
@@ -30,8 +32,12 @@ export const zh = {
30
32
  success: '成功',
31
33
  redirect: '重定向',
32
34
  error: '错误',
33
- show: '显示',
34
- hide: '隐藏',
35
+ show: '显示${1}',
36
+ hide: '隐藏${1}',
35
37
  available_items: '可用项',
36
- child_attributes: '子属性',
38
+ available_scopes: '可用范围',
39
+ properties: '属性',
40
+ or: '或',
41
+ and: '和',
42
+ possible_values: '可能的值',
37
43
  };
package/src/utils.ts CHANGED
@@ -216,3 +216,40 @@ function getStatusCodeCategory(statusCode: number | string): number | string {
216
216
 
217
217
  return category;
218
218
  }
219
+
220
+ export function getSchemaTitle(schema: OpenAPIV3.SchemaObject): string {
221
+ // Otherwise try to infer a nice title
222
+ let type = 'any';
223
+
224
+ if (schema.enum || schema['x-enumDescriptions'] || schema['x-gitbook-enum']) {
225
+ type = `${schema.type} · enum`;
226
+ // check array AND schema.items as this is sometimes null despite what the type indicates
227
+ } else if (schema.type === 'array' && !!schema.items) {
228
+ type = `${getSchemaTitle(schema.items)}[]`;
229
+ } else if (Array.isArray(schema.type)) {
230
+ type = schema.type.join(' | ');
231
+ } else if (schema.type || schema.properties) {
232
+ type = schema.type ?? 'object';
233
+
234
+ if (schema.format) {
235
+ type += ` · ${schema.format}`;
236
+ }
237
+
238
+ // Only add the title if it's an object (no need for the title of a string, number, etc.)
239
+ if (type === 'object' && schema.title) {
240
+ type += ` · ${schema.title.replaceAll(' ', '')}`;
241
+ }
242
+ }
243
+
244
+ if ('anyOf' in schema) {
245
+ type = 'any of';
246
+ } else if ('oneOf' in schema) {
247
+ type = 'one of';
248
+ } else if ('allOf' in schema) {
249
+ type = 'all of';
250
+ } else if ('not' in schema) {
251
+ type = 'not';
252
+ }
253
+
254
+ return type;
255
+ }