@gitbook/react-openapi 1.3.0 → 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 (64) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/OpenAPICodeSample.jsx +7 -4
  3. package/dist/OpenAPIRequestBody.jsx +7 -2
  4. package/dist/OpenAPIRequestBodyHeaderType.d.ts +8 -0
  5. package/dist/OpenAPIRequestBodyHeaderType.jsx +25 -0
  6. package/dist/OpenAPIResponse.d.ts +1 -1
  7. package/dist/OpenAPIResponse.jsx +2 -2
  8. package/dist/OpenAPIResponseExample.jsx +7 -0
  9. package/dist/OpenAPISchema.jsx +1 -39
  10. package/dist/OpenAPISchemaName.jsx +4 -4
  11. package/dist/OpenAPISecurities.jsx +59 -1
  12. package/dist/OpenAPISelect.jsx +1 -0
  13. package/dist/OpenAPISpec.jsx +16 -1
  14. package/dist/OpenAPIWebhookExample.jsx +1 -1
  15. package/dist/code-samples.js +1 -1
  16. package/dist/generateSchemaExample.js +14 -14
  17. package/dist/translations/de.d.ts +1 -0
  18. package/dist/translations/de.js +1 -0
  19. package/dist/translations/en.d.ts +1 -0
  20. package/dist/translations/en.js +1 -0
  21. package/dist/translations/es.d.ts +1 -0
  22. package/dist/translations/es.js +1 -0
  23. package/dist/translations/fr.d.ts +1 -0
  24. package/dist/translations/fr.js +1 -0
  25. package/dist/translations/index.d.ts +9 -0
  26. package/dist/translations/ja.d.ts +1 -0
  27. package/dist/translations/ja.js +1 -0
  28. package/dist/translations/nl.d.ts +1 -0
  29. package/dist/translations/nl.js +1 -0
  30. package/dist/translations/no.d.ts +1 -0
  31. package/dist/translations/no.js +1 -0
  32. package/dist/translations/pt-br.d.ts +1 -0
  33. package/dist/translations/pt-br.js +1 -0
  34. package/dist/translations/zh.d.ts +1 -0
  35. package/dist/translations/zh.js +1 -0
  36. package/dist/tsconfig.build.tsbuildinfo +1 -1
  37. package/dist/utils.d.ts +1 -0
  38. package/dist/utils.js +38 -0
  39. package/package.json +2 -2
  40. package/src/OpenAPICodeSample.tsx +7 -6
  41. package/src/OpenAPIRequestBody.tsx +11 -2
  42. package/src/OpenAPIRequestBodyHeaderType.tsx +36 -0
  43. package/src/OpenAPIResponse.tsx +3 -3
  44. package/src/OpenAPIResponseExample.tsx +10 -1
  45. package/src/OpenAPISchema.tsx +1 -38
  46. package/src/OpenAPISchemaName.tsx +8 -6
  47. package/src/OpenAPISecurities.tsx +111 -7
  48. package/src/OpenAPISelect.tsx +1 -1
  49. package/src/OpenAPISpec.tsx +21 -1
  50. package/src/OpenAPIWebhookExample.tsx +2 -2
  51. package/src/code-samples.test.ts +2 -2
  52. package/src/code-samples.ts +16 -12
  53. package/src/generateSchemaExample.test.ts +20 -0
  54. package/src/generateSchemaExample.ts +1 -1
  55. package/src/translations/de.ts +1 -0
  56. package/src/translations/en.ts +1 -0
  57. package/src/translations/es.ts +1 -0
  58. package/src/translations/fr.ts +1 -0
  59. package/src/translations/ja.ts +1 -0
  60. package/src/translations/nl.ts +1 -0
  61. package/src/translations/no.ts +1 -0
  62. package/src/translations/pt-br.ts +1 -0
  63. package/src/translations/zh.ts +1 -0
  64. package/src/utils.ts +37 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @gitbook/react-openapi
2
2
 
3
+ ## 1.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 957afd9: Add authorization header for OAuth2
8
+ - 7a00880: Improve support for OAuth2 security type
9
+ - a0c06a7: Indent JSON python code sample
10
+ - b403962: Handle nullish OpenAPI mediaTypeObject
11
+ - 1e013cd: Optional label in OpenAPI x-codeSamples
12
+ - 4c9a9d0: Handle nested deprecated properties in generateSchemaExample
13
+ - 40df91a: Deduplicate path parameters from OpenAPI spec
14
+ - 2350baa: Support for OpenAPI Array request body
15
+ - Updated dependencies [1e013cd]
16
+ - Updated dependencies [4f5cbfe]
17
+ - @gitbook/openapi-parser@2.1.5
18
+
3
19
  ## 1.3.0
4
20
 
5
21
  ### Minor Changes
@@ -164,13 +164,11 @@ function getCustomCodeSamples(props) {
164
164
  if (customSamples && Array.isArray(customSamples)) {
165
165
  customCodeSamples = customSamples
166
166
  .filter(function (sample) {
167
- return (typeof sample.label === 'string' &&
168
- typeof sample.source === 'string' &&
169
- typeof sample.lang === 'string');
167
+ return typeof sample.source === 'string' && typeof sample.lang === 'string';
170
168
  })
171
169
  .map(function (sample, index) { return ({
172
170
  key: "custom-sample-".concat(sample.lang, "-").concat(index),
173
- label: sample.label,
171
+ label: sample.label || sample.lang,
174
172
  body: context.renderCodeBlock({
175
173
  code: sample.source,
176
174
  syntax: sample.lang,
@@ -214,6 +212,11 @@ function getSecurityHeaders(securities) {
214
212
  _a[name_1] = 'YOUR_API_KEY',
215
213
  _a;
216
214
  }
215
+ case 'oauth2': {
216
+ return {
217
+ Authorization: 'Bearer YOUR_OAUTH2_TOKEN',
218
+ };
219
+ }
217
220
  default: {
218
221
  return {};
219
222
  }
@@ -1,4 +1,5 @@
1
1
  import { InteractiveSection } from './InteractiveSection';
2
+ import { OpenAPIRequestBodyHeaderType } from './OpenAPIRequestBodyHeaderType';
2
3
  import { OpenAPIRootSchema } from './OpenAPISchemaServer';
3
4
  import { t } from './translate';
4
5
  import { checkIsReference, createStateKey } from './utils';
@@ -11,13 +12,17 @@ export function OpenAPIRequestBody(props) {
11
12
  if (checkIsReference(requestBody)) {
12
13
  return null;
13
14
  }
14
- return (<InteractiveSection header={t(context.translation, 'name' in data ? 'payload' : 'body')} className="openapi-requestbody" stateKey={createStateKey('request-body-media-type', context.blockKey)} selectIcon={context.icons.chevronDown} tabs={Object.entries((_a = requestBody.content) !== null && _a !== void 0 ? _a : {}).map(function (_a) {
15
+ var stateKey = createStateKey('request-body-media-type', context.blockKey);
16
+ return (<InteractiveSection header={<>
17
+ <span>{t(context.translation, 'name' in data ? 'payload' : 'body')}</span>
18
+ <OpenAPIRequestBodyHeaderType requestBody={requestBody} stateKey={stateKey}/>
19
+ </>} className="openapi-requestbody" stateKey={stateKey} selectIcon={context.icons.chevronDown} tabs={Object.entries((_a = requestBody.content) !== null && _a !== void 0 ? _a : {}).map(function (_a) {
15
20
  var _b;
16
21
  var contentType = _a[0], mediaTypeObject = _a[1];
17
22
  return {
18
23
  key: contentType,
19
24
  label: contentType,
20
- body: (<OpenAPIRootSchema schema={(_b = mediaTypeObject.schema) !== null && _b !== void 0 ? _b : {}} context={context}/>),
25
+ body: (<OpenAPIRootSchema schema={(_b = mediaTypeObject.schema) !== null && _b !== void 0 ? _b : {}} context={context} key={contentType}/>),
21
26
  };
22
27
  })}/>);
23
28
  }
@@ -0,0 +1,8 @@
1
+ import type { OpenAPIV3 } from '@gitbook/openapi-parser';
2
+ /**
3
+ * Display the type of a request body. It only displays the type if the selected content is an array.
4
+ */
5
+ export declare function OpenAPIRequestBodyHeaderType(props: {
6
+ requestBody: OpenAPIV3.RequestBodyObject;
7
+ stateKey: string;
8
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,25 @@
1
+ 'use client';
2
+ import { useSelectState } from './OpenAPISelect';
3
+ import { getSchemaTitle } from './utils';
4
+ /**
5
+ * Display the type of a request body. It only displays the type if the selected content is an array.
6
+ */
7
+ export function OpenAPIRequestBodyHeaderType(props) {
8
+ var _a, _b, _c;
9
+ var requestBody = props.requestBody, stateKey = props.stateKey;
10
+ var content = (_a = requestBody.content) !== null && _a !== void 0 ? _a : {};
11
+ var state = useSelectState(stateKey, Object.keys(content)[0]);
12
+ var selectedContentMediaType = (_b = Object.entries(content).find(function (_a) {
13
+ var contentType = _a[0];
14
+ return contentType === state.key;
15
+ })) === null || _b === void 0 ? void 0 : _b[1];
16
+ // If the selected content is not an array, we don't display the type
17
+ if (!selectedContentMediaType ||
18
+ !((_c = selectedContentMediaType.schema) === null || _c === void 0 ? void 0 : _c.type) ||
19
+ selectedContentMediaType.schema.type !== 'array') {
20
+ return null;
21
+ }
22
+ return (<span className="openapi-requestbody-header-type">
23
+ {"".concat(getSchemaTitle(selectedContentMediaType.schema))}
24
+ </span>);
25
+ }
@@ -5,6 +5,6 @@ import type { OpenAPIClientContext } from './context';
5
5
  */
6
6
  export declare function OpenAPIResponse(props: {
7
7
  response: OpenAPIV3.ResponseObject;
8
- mediaType: OpenAPIV3.MediaTypeObject;
8
+ mediaType: OpenAPIV3.MediaTypeObject | null;
9
9
  context: OpenAPIClientContext;
10
10
  }): import("react").JSX.Element | null;
@@ -24,7 +24,7 @@ export function OpenAPIResponse(props) {
24
24
  var name = _a[0], header = _a[1];
25
25
  return [name, header !== null && header !== void 0 ? header : {}];
26
26
  });
27
- var content = Object.entries((_b = mediaType.schema) !== null && _b !== void 0 ? _b : {});
27
+ var content = Object.entries((_b = mediaType === null || mediaType === void 0 ? void 0 : mediaType.schema) !== null && _b !== void 0 ? _b : {});
28
28
  var description = resolveDescription(response);
29
29
  if (content.length === 0 && !description && headers.length === 0) {
30
30
  return null;
@@ -44,7 +44,7 @@ export function OpenAPIResponse(props) {
44
44
  return parameterToProperty(__assign({ name: name }, header));
45
45
  })} context={context}/>
46
46
  </OpenAPIDisclosure>) : null}
47
- {mediaType.schema && (<div className="openapi-responsebody">
47
+ {(mediaType === null || mediaType === void 0 ? void 0 : mediaType.schema) && (<div className="openapi-responsebody">
48
48
  <OpenAPISchemaProperties id={"response-".concat(context.blockKey)} properties={[
49
49
  {
50
50
  schema: mediaType.schema,
@@ -80,6 +80,13 @@ function OpenAPIResponse(props) {
80
80
  }
81
81
  var tabs = entries.map(function (entry) {
82
82
  var mediaType = entry[0], mediaTypeObject = entry[1];
83
+ if (!mediaTypeObject) {
84
+ return {
85
+ key: mediaType,
86
+ label: mediaType,
87
+ body: <OpenAPIEmptyExample context={context}/>,
88
+ };
89
+ }
83
90
  return {
84
91
  key: mediaType,
85
92
  label: mediaType,
@@ -40,7 +40,7 @@ import { retrocycle } from './decycle';
40
40
  import { getDisclosureLabel } from './getDisclosureLabel';
41
41
  import { stringifyOpenAPI } from './stringifyOpenAPI';
42
42
  import { tString } from './translate';
43
- import { checkIsReference, resolveDescription, resolveFirstExample } from './utils';
43
+ import { checkIsReference, getSchemaTitle, resolveDescription, resolveFirstExample } from './utils';
44
44
  /**
45
45
  * Render a property of an OpenAPI schema.
46
46
  */
@@ -398,41 +398,3 @@ function mergeRequiredFields(schemaOrRef, latestAncestor) {
398
398
  }
399
399
  return Array.from(new Set(__spreadArray(__spreadArray([], ((latestAncestor === null || latestAncestor === void 0 ? void 0 : latestAncestor.required) || []), true), (schemaOrRef.required || []), true)));
400
400
  }
401
- function getSchemaTitle(schema) {
402
- var _a;
403
- // Otherwise try to infer a nice title
404
- var type = 'any';
405
- if (schema.enum || schema['x-enumDescriptions'] || schema['x-gitbook-enum']) {
406
- type = "".concat(schema.type, " \u00B7 enum");
407
- // check array AND schema.items as this is sometimes null despite what the type indicates
408
- }
409
- else if (schema.type === 'array' && !!schema.items) {
410
- type = "".concat(getSchemaTitle(schema.items), "[]");
411
- }
412
- else if (Array.isArray(schema.type)) {
413
- type = schema.type.join(' | ');
414
- }
415
- else if (schema.type || schema.properties) {
416
- type = (_a = schema.type) !== null && _a !== void 0 ? _a : 'object';
417
- if (schema.format) {
418
- type += " \u00B7 ".concat(schema.format);
419
- }
420
- // Only add the title if it's an object (no need for the title of a string, number, etc.)
421
- if (type === 'object' && schema.title) {
422
- type += " \u00B7 ".concat(schema.title.replaceAll(' ', ''));
423
- }
424
- }
425
- if ('anyOf' in schema) {
426
- type = 'any of';
427
- }
428
- else if ('oneOf' in schema) {
429
- type = 'one of';
430
- }
431
- else if ('allOf' in schema) {
432
- type = 'all of';
433
- }
434
- else if ('not' in schema) {
435
- type = 'not';
436
- }
437
- return type;
438
- }
@@ -10,10 +10,10 @@ export function OpenAPISchemaName(props) {
10
10
  {propertyName ? (<span data-deprecated={schema === null || schema === void 0 ? void 0 : schema.deprecated} className="openapi-schema-propertyname">
11
11
  {propertyName}
12
12
  </span>) : null}
13
- <span>
14
- {type ? <span className="openapi-schema-type">{type}</span> : null}
15
- {additionalItems ? (<span className="openapi-schema-type">{additionalItems}</span>) : null}
16
- </span>
13
+ {type || additionalItems ? (<span>
14
+ {type ? <span className="openapi-schema-type">{type}</span> : null}
15
+ {additionalItems ? (<span className="openapi-schema-type">{additionalItems}</span>) : null}
16
+ </span>) : null}
17
17
  {(schema === null || schema === void 0 ? void 0 : schema.readOnly) ? (<span className="openapi-schema-readonly">
18
18
  {t(context.translation, 'read_only')}
19
19
  </span>) : null}
@@ -1,5 +1,6 @@
1
1
  import { InteractiveSection } from './InteractiveSection';
2
2
  import { Markdown } from './Markdown';
3
+ import { OpenAPICopyButton } from './OpenAPICopyButton';
3
4
  import { OpenAPISchemaName } from './OpenAPISchemaName';
4
5
  import { t } from './translate';
5
6
  import { createStateKey, resolveDescription } from './utils';
@@ -46,7 +47,7 @@ function getLabelForType(security, context) {
46
47
  }
47
48
  return (<OpenAPISchemaName context={context} propertyName="HTTP" required={security.required}/>);
48
49
  case 'oauth2':
49
- return (<OpenAPISchemaName context={context} propertyName="OAuth2" required={security.required}/>);
50
+ return <OpenAPISchemaOAuth2Flows context={context} security={security}/>;
50
51
  case 'openIdConnect':
51
52
  return (<OpenAPISchemaName context={context} propertyName="OpenID Connect" required={security.required}/>);
52
53
  default:
@@ -54,3 +55,60 @@ function getLabelForType(security, context) {
54
55
  return security.type;
55
56
  }
56
57
  }
58
+ function OpenAPISchemaOAuth2Flows(props) {
59
+ var _a;
60
+ var context = props.context, security = props.security;
61
+ var flows = Object.entries((_a = security.flows) !== null && _a !== void 0 ? _a : {});
62
+ return (<div className="openapi-securities-oauth-flows">
63
+ {flows.map(function (_a, index) {
64
+ var name = _a[0], flow = _a[1];
65
+ return (<OpenAPISchemaOAuth2Item key={index} flow={flow} name={name} context={context} security={security}/>);
66
+ })}
67
+ </div>);
68
+ }
69
+ function OpenAPISchemaOAuth2Item(props) {
70
+ var _a;
71
+ var flow = props.flow, context = props.context, security = props.security, name = props.name;
72
+ if (!flow) {
73
+ return null;
74
+ }
75
+ var scopes = Object.entries((_a = flow === null || flow === void 0 ? void 0 : flow.scopes) !== null && _a !== void 0 ? _a : {});
76
+ return (<div>
77
+ <OpenAPISchemaName context={context} propertyName="OAuth2" type={name} required={security.required}/>
78
+ <div className="openapi-securities-oauth-content openapi-markdown">
79
+ {security.description ? <Markdown source={security.description}/> : null}
80
+ {'authorizationUrl' in flow && flow.authorizationUrl ? (<span>
81
+ Authorization URL:{' '}
82
+ <OpenAPICopyButton value={flow.authorizationUrl} context={context} className="openapi-securities-url" withTooltip>
83
+ {flow.authorizationUrl}
84
+ </OpenAPICopyButton>
85
+ </span>) : null}
86
+ {'tokenUrl' in flow && flow.tokenUrl ? (<span>
87
+ Token URL:{' '}
88
+ <OpenAPICopyButton value={flow.tokenUrl} context={context} className="openapi-securities-url" withTooltip>
89
+ {flow.tokenUrl}
90
+ </OpenAPICopyButton>
91
+ </span>) : null}
92
+ {'refreshUrl' in flow && flow.refreshUrl ? (<span>
93
+ Refresh URL:{' '}
94
+ <OpenAPICopyButton value={flow.refreshUrl} context={context} className="openapi-securities-url" withTooltip>
95
+ {flow.refreshUrl}
96
+ </OpenAPICopyButton>
97
+ </span>) : null}
98
+ {scopes.length ? (<div>
99
+ {t(context.translation, 'available_scopes')}:{' '}
100
+ <ul>
101
+ {scopes.map(function (_a) {
102
+ var key = _a[0], value = _a[1];
103
+ return (<li key={key}>
104
+ <OpenAPICopyButton value={key} context={context} withTooltip>
105
+ <code>{key}</code>
106
+ </OpenAPICopyButton>
107
+ : {value}
108
+ </li>);
109
+ })}
110
+ </ul>
111
+ </div>) : null}
112
+ </div>
113
+ </div>);
114
+ }
@@ -6,6 +6,7 @@ import { useStore } from 'zustand';
6
6
  import { getOrCreateStoreByKey } from './getOrCreateStoreByKey';
7
7
  export function useSelectState(stateKey, initialKey) {
8
8
  if (stateKey === void 0) { stateKey = 'select-state'; }
9
+ if (initialKey === void 0) { initialKey = 'default'; }
9
10
  var store = useStore(getOrCreateStoreByKey(stateKey, initialKey));
10
11
  return {
11
12
  key: store.key,
@@ -9,7 +9,7 @@ export function OpenAPISpec(props) {
9
9
  var _a;
10
10
  var data = props.data, context = props.context;
11
11
  var operation = data.operation;
12
- var parameters = (_a = operation.parameters) !== null && _a !== void 0 ? _a : [];
12
+ var parameters = deduplicateParameters((_a = operation.parameters) !== null && _a !== void 0 ? _a : []);
13
13
  var parameterGroups = groupParameters(parameters, context);
14
14
  var securities = 'securities' in data ? data.securities : [];
15
15
  return (<>
@@ -60,3 +60,18 @@ function getParameterGroupName(paramIn, context) {
60
60
  return paramIn;
61
61
  }
62
62
  }
63
+ /** Deduplicate parameters by name and in.
64
+ * Some specs have both parameters define at path and operation level.
65
+ * We only want to display one of them.
66
+ */
67
+ function deduplicateParameters(parameters) {
68
+ var seen = new Set();
69
+ return parameters.filter(function (param) {
70
+ var key = "".concat(param.name, ":").concat(param.in);
71
+ if (seen.has(key)) {
72
+ return false;
73
+ }
74
+ seen.add(key);
75
+ return true;
76
+ });
77
+ }
@@ -12,7 +12,7 @@ export function OpenAPIWebhookExample(props) {
12
12
  }
13
13
  return Object.entries(operation.requestBody.content).map(function (_a) {
14
14
  var key = _a[0], value = _a[1];
15
- var schema = value.schema;
15
+ var schema = value === null || value === void 0 ? void 0 : value.schema;
16
16
  if (!schema) {
17
17
  return {
18
18
  key: key,
@@ -345,7 +345,7 @@ var BodyGenerators = {
345
345
  default:
346
346
  return value;
347
347
  }
348
- })
348
+ }, 2)
349
349
  .replaceAll('"$$__TRUE__$$"', 'True')
350
350
  .replaceAll('"$$__FALSE__$$"', 'False')
351
351
  .replaceAll('"$$__NULL__$$"', 'None');
@@ -101,7 +101,7 @@ function guessFromFormat(schema, fallback) {
101
101
  */
102
102
  var getExampleFromSchema = function (schema, options, level, parentSchema, name, resultCache) {
103
103
  var _a, _b, _c, _d;
104
- var _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
104
+ var _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
105
105
  if (level === void 0) { level = 0; }
106
106
  if (resultCache === void 0) { resultCache = new WeakMap(); }
107
107
  // Store result in the cache, and return the result
@@ -123,7 +123,7 @@ var getExampleFromSchema = function (schema, options, level, parentSchema, name,
123
123
  // Fails if it contains a circular reference
124
124
  JSON.stringify(schema);
125
125
  }
126
- catch (_v) {
126
+ catch (_w) {
127
127
  return '[Circular Reference]';
128
128
  }
129
129
  }
@@ -131,7 +131,7 @@ var getExampleFromSchema = function (schema, options, level, parentSchema, name,
131
131
  // But if `emptyString` is set, we do want to see some values.
132
132
  var makeUpRandomData = !!(options === null || options === void 0 ? void 0 : options.emptyString);
133
133
  // If the property is deprecated we don't show it in examples.
134
- if (schema.deprecated) {
134
+ if (schema.deprecated || (schema.type === 'array' && ((_e = schema.items) === null || _e === void 0 ? void 0 : _e.deprecated))) {
135
135
  return undefined;
136
136
  }
137
137
  // Check if the property is read-only/write-only
@@ -141,7 +141,7 @@ var getExampleFromSchema = function (schema, options, level, parentSchema, name,
141
141
  }
142
142
  // Use given variables as values
143
143
  if (schema['x-variable']) {
144
- var value = (_e = options === null || options === void 0 ? void 0 : options.variables) === null || _e === void 0 ? void 0 : _e[schema['x-variable']];
144
+ var value = (_f = options === null || options === void 0 ? void 0 : options.variables) === null || _f === void 0 ? void 0 : _f[schema['x-variable']];
145
145
  // Return the value if it’s defined
146
146
  if (value !== undefined) {
147
147
  // Type-casting
@@ -171,13 +171,13 @@ var getExampleFromSchema = function (schema, options, level, parentSchema, name,
171
171
  // Check if the property is required
172
172
  var isObjectOrArray = schema.type === 'object' ||
173
173
  schema.type === 'array' ||
174
- !!((_g = (_f = schema.allOf) === null || _f === void 0 ? void 0 : _f.at) === null || _g === void 0 ? void 0 : _g.call(_f, 0)) ||
175
- !!((_j = (_h = schema.anyOf) === null || _h === void 0 ? void 0 : _h.at) === null || _j === void 0 ? void 0 : _j.call(_h, 0)) ||
176
- !!((_l = (_k = schema.oneOf) === null || _k === void 0 ? void 0 : _k.at) === null || _l === void 0 ? void 0 : _l.call(_k, 0));
174
+ !!((_h = (_g = schema.allOf) === null || _g === void 0 ? void 0 : _g.at) === null || _h === void 0 ? void 0 : _h.call(_g, 0)) ||
175
+ !!((_k = (_j = schema.anyOf) === null || _j === void 0 ? void 0 : _j.at) === null || _k === void 0 ? void 0 : _k.call(_j, 0)) ||
176
+ !!((_m = (_l = schema.oneOf) === null || _l === void 0 ? void 0 : _l.at) === null || _m === void 0 ? void 0 : _m.call(_l, 0));
177
177
  if (!isObjectOrArray && (options === null || options === void 0 ? void 0 : options.omitEmptyAndOptionalProperties) === true) {
178
178
  var isRequired = schema.required === true ||
179
179
  (parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.required) === true ||
180
- ((_m = parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.required) === null || _m === void 0 ? void 0 : _m.includes(name !== null && name !== void 0 ? name : schema.name));
180
+ ((_o = parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.required) === null || _o === void 0 ? void 0 : _o.includes(name !== null && name !== void 0 ? name : schema.name));
181
181
  if (!isRequired) {
182
182
  return undefined;
183
183
  }
@@ -190,7 +190,7 @@ var getExampleFromSchema = function (schema, options, level, parentSchema, name,
190
190
  for (var propertyName in schema.properties) {
191
191
  if (Object.prototype.hasOwnProperty.call(schema.properties, propertyName)) {
192
192
  var property = schema.properties[propertyName];
193
- var propertyXmlTagName = (options === null || options === void 0 ? void 0 : options.xml) ? (_o = property.xml) === null || _o === void 0 ? void 0 : _o.name : undefined;
193
+ var propertyXmlTagName = (options === null || options === void 0 ? void 0 : options.xml) ? (_p = property.xml) === null || _p === void 0 ? void 0 : _p.name : undefined;
194
194
  response[propertyXmlTagName !== null && propertyXmlTagName !== void 0 ? propertyXmlTagName : propertyName] = getExampleFromSchema(property, options, level + 1, schema, propertyName, resultCache);
195
195
  if (typeof response[propertyXmlTagName !== null && propertyXmlTagName !== void 0 ? propertyXmlTagName : propertyName] === 'undefined') {
196
196
  delete response[propertyXmlTagName !== null && propertyXmlTagName !== void 0 ? propertyXmlTagName : propertyName];
@@ -241,8 +241,8 @@ var getExampleFromSchema = function (schema, options, level, parentSchema, name,
241
241
  }
242
242
  // Array
243
243
  if (schema.type === 'array' || schema.items !== undefined) {
244
- var itemsXmlTagName_1 = (_q = (_p = schema === null || schema === void 0 ? void 0 : schema.items) === null || _p === void 0 ? void 0 : _p.xml) === null || _q === void 0 ? void 0 : _q.name;
245
- var wrapItems = !!((options === null || options === void 0 ? void 0 : options.xml) && ((_r = schema.xml) === null || _r === void 0 ? void 0 : _r.wrapped) && itemsXmlTagName_1);
244
+ var itemsXmlTagName_1 = (_r = (_q = schema === null || schema === void 0 ? void 0 : schema.items) === null || _q === void 0 ? void 0 : _q.xml) === null || _r === void 0 ? void 0 : _r.name;
245
+ var wrapItems = !!((options === null || options === void 0 ? void 0 : options.xml) && ((_s = schema.xml) === null || _s === void 0 ? void 0 : _s.wrapped) && itemsXmlTagName_1);
246
246
  if (schema.example !== undefined) {
247
247
  return cache(schema, wrapItems ? (_a = {}, _a[itemsXmlTagName_1] = schema.example, _a) : schema.example);
248
248
  }
@@ -284,7 +284,7 @@ var getExampleFromSchema = function (schema, options, level, parentSchema, name,
284
284
  return cache(schema, wrapItems ? [(_c = {}, _c[itemsXmlTagName_1] = exampleFromRule, _c)] : exampleFromRule);
285
285
  }
286
286
  }
287
- if ((_s = schema.items) === null || _s === void 0 ? void 0 : _s.type) {
287
+ if ((_t = schema.items) === null || _t === void 0 ? void 0 : _t.type) {
288
288
  var exampleFromSchema = getExampleFromSchema(schema.items, options, level + 1, undefined, undefined, resultCache);
289
289
  return wrapItems ? [(_d = {}, _d[itemsXmlTagName_1] = exampleFromSchema, _d)] : [exampleFromSchema];
290
290
  }
@@ -293,8 +293,8 @@ var getExampleFromSchema = function (schema, options, level, parentSchema, name,
293
293
  var exampleValues = {
294
294
  string: makeUpRandomData ? guessFromFormat(schema, options === null || options === void 0 ? void 0 : options.emptyString) : '',
295
295
  boolean: true,
296
- integer: (_t = schema.min) !== null && _t !== void 0 ? _t : 1,
297
- number: (_u = schema.min) !== null && _u !== void 0 ? _u : 1,
296
+ integer: (_u = schema.min) !== null && _u !== void 0 ? _u : 1,
297
+ number: (_v = schema.min) !== null && _v !== void 0 ? _v : 1,
298
298
  array: [],
299
299
  };
300
300
  if (schema.type !== undefined && exampleValues[schema.type] !== undefined) {
@@ -35,6 +35,7 @@ export declare const de: {
35
35
  show: string;
36
36
  hide: string;
37
37
  available_items: string;
38
+ available_scopes: string;
38
39
  properties: string;
39
40
  or: string;
40
41
  and: string;
@@ -35,6 +35,7 @@ export var de = {
35
35
  show: 'Zeige ${1}',
36
36
  hide: 'Verstecke ${1}',
37
37
  available_items: 'Verfügbare Elemente',
38
+ available_scopes: 'Verfügbare scopes',
38
39
  properties: 'Eigenschaften',
39
40
  or: 'oder',
40
41
  and: 'und',
@@ -35,6 +35,7 @@ export declare const en: {
35
35
  show: string;
36
36
  hide: string;
37
37
  available_items: string;
38
+ available_scopes: string;
38
39
  possible_values: string;
39
40
  properties: string;
40
41
  or: string;
@@ -35,6 +35,7 @@ export var en = {
35
35
  show: 'Show ${1}',
36
36
  hide: 'Hide ${1}',
37
37
  available_items: 'Available items',
38
+ available_scopes: 'Available scopes',
38
39
  possible_values: 'Possible values',
39
40
  properties: 'Properties',
40
41
  or: 'or',
@@ -35,6 +35,7 @@ export declare const es: {
35
35
  show: string;
36
36
  hide: string;
37
37
  available_items: string;
38
+ available_scopes: string;
38
39
  properties: string;
39
40
  or: string;
40
41
  and: string;
@@ -35,6 +35,7 @@ export var es = {
35
35
  show: 'Mostrar ${1}',
36
36
  hide: 'Ocultar ${1}',
37
37
  available_items: 'Elementos disponibles',
38
+ available_scopes: 'Scopes disponibles',
38
39
  properties: 'Propiedades',
39
40
  or: 'o',
40
41
  and: 'y',
@@ -35,6 +35,7 @@ export declare const fr: {
35
35
  show: string;
36
36
  hide: string;
37
37
  available_items: string;
38
+ available_scopes: string;
38
39
  properties: string;
39
40
  or: string;
40
41
  and: string;
@@ -35,6 +35,7 @@ export var fr = {
35
35
  show: 'Afficher ${1}',
36
36
  hide: 'Masquer ${1}',
37
37
  available_items: 'Éléments disponibles',
38
+ available_scopes: 'Scopes disponibles',
38
39
  properties: 'Propriétés',
39
40
  or: 'ou',
40
41
  and: 'et',
@@ -37,6 +37,7 @@ export declare const translations: {
37
37
  show: string;
38
38
  hide: string;
39
39
  available_items: string;
40
+ available_scopes: string;
40
41
  possible_values: string;
41
42
  properties: string;
42
43
  or: string;
@@ -79,6 +80,7 @@ export declare const translations: {
79
80
  show: string;
80
81
  hide: string;
81
82
  available_items: string;
83
+ available_scopes: string;
82
84
  properties: string;
83
85
  or: string;
84
86
  and: string;
@@ -121,6 +123,7 @@ export declare const translations: {
121
123
  show: string;
122
124
  hide: string;
123
125
  available_items: string;
126
+ available_scopes: string;
124
127
  properties: string;
125
128
  or: string;
126
129
  and: string;
@@ -163,6 +166,7 @@ export declare const translations: {
163
166
  show: string;
164
167
  hide: string;
165
168
  available_items: string;
169
+ available_scopes: string;
166
170
  properties: string;
167
171
  or: string;
168
172
  and: string;
@@ -205,6 +209,7 @@ export declare const translations: {
205
209
  show: string;
206
210
  hide: string;
207
211
  available_items: string;
212
+ available_scopes: string;
208
213
  properties: string;
209
214
  or: string;
210
215
  and: string;
@@ -247,6 +252,7 @@ export declare const translations: {
247
252
  show: string;
248
253
  hide: string;
249
254
  available_items: string;
255
+ available_scopes: string;
250
256
  properties: string;
251
257
  or: string;
252
258
  and: string;
@@ -289,6 +295,7 @@ export declare const translations: {
289
295
  show: string;
290
296
  hide: string;
291
297
  available_items: string;
298
+ available_scopes: string;
292
299
  properties: string;
293
300
  or: string;
294
301
  and: string;
@@ -331,6 +338,7 @@ export declare const translations: {
331
338
  show: string;
332
339
  hide: string;
333
340
  available_items: string;
341
+ available_scopes: string;
334
342
  properties: string;
335
343
  or: string;
336
344
  and: string;
@@ -373,6 +381,7 @@ export declare const translations: {
373
381
  show: string;
374
382
  hide: string;
375
383
  available_items: string;
384
+ available_scopes: string;
376
385
  properties: string;
377
386
  or: string;
378
387
  and: string;
@@ -35,6 +35,7 @@ export declare const ja: {
35
35
  show: string;
36
36
  hide: string;
37
37
  available_items: string;
38
+ available_scopes: string;
38
39
  properties: string;
39
40
  or: string;
40
41
  and: string;
@@ -35,6 +35,7 @@ export var ja = {
35
35
  show: '${1}を表示',
36
36
  hide: '${1}を非表示',
37
37
  available_items: '利用可能なアイテム',
38
+ available_scopes: '利用可能なスコープ',
38
39
  properties: 'プロパティ',
39
40
  or: 'または',
40
41
  and: 'かつ',
@@ -35,6 +35,7 @@ export declare const nl: {
35
35
  show: string;
36
36
  hide: string;
37
37
  available_items: string;
38
+ available_scopes: string;
38
39
  properties: string;
39
40
  or: string;
40
41
  and: string;
@@ -35,6 +35,7 @@ export var nl = {
35
35
  show: 'Toon ${1}',
36
36
  hide: 'Verberg ${1}',
37
37
  available_items: 'Beschikbare items',
38
+ available_scopes: 'Beschikbare scopes',
38
39
  properties: 'Eigenschappen',
39
40
  or: 'of',
40
41
  and: 'en',
@@ -35,6 +35,7 @@ export declare const no: {
35
35
  show: string;
36
36
  hide: string;
37
37
  available_items: string;
38
+ available_scopes: string;
38
39
  properties: string;
39
40
  or: string;
40
41
  and: string;