docusaurus-plugin-openapi-docs 0.0.0-735 → 0.0.0-737

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.
@@ -52,7 +52,7 @@ export class OpenAPIParser {
52
52
  constructor(
53
53
  spec: OpenAPISpec,
54
54
  specUrl?: string,
55
- private options: {} = new RedocNormalizedOptions()
55
+ private options: {} = new RedocNormalizedOptions(),
56
56
  ) {
57
57
  this.validate(spec);
58
58
 
@@ -131,7 +131,7 @@ export class OpenAPIParser {
131
131
  deref<T extends object>(
132
132
  obj: OpenAPIRef | T,
133
133
  forceCircular = false,
134
- mergeAsAllOf = false
134
+ mergeAsAllOf = false,
135
135
  ): T {
136
136
  if (this.isRef(obj)) {
137
137
  const schemaName = getDefinitionName(obj.$ref);
@@ -186,7 +186,7 @@ export class OpenAPIParser {
186
186
  if (
187
187
  mergeAsAllOf &&
188
188
  keys.some(
189
- (k) => k !== "description" && k !== "title" && k !== "externalDocs"
189
+ (k) => k !== "description" && k !== "title" && k !== "externalDocs",
190
190
  )
191
191
  ) {
192
192
  return {
@@ -211,7 +211,7 @@ export class OpenAPIParser {
211
211
  schema: OpenAPISchema,
212
212
  $ref?: string,
213
213
  forceCircular: boolean = false,
214
- used$Refs = new Set<string>()
214
+ used$Refs = new Set<string>(),
215
215
  ): MergedOpenAPISchema {
216
216
  if ($ref) {
217
217
  used$Refs.add($ref);
@@ -253,7 +253,7 @@ export class OpenAPIParser {
253
253
  resolved,
254
254
  subRef,
255
255
  forceCircular,
256
- used$Refs
256
+ used$Refs,
257
257
  );
258
258
  receiver.parentRefs!.push(...(subMerged.parentRefs || []));
259
259
  return {
@@ -285,7 +285,7 @@ export class OpenAPIParser {
285
285
  type !== undefined
286
286
  ) {
287
287
  console.warn(
288
- `Incompatible types in allOf at "${$ref}": "${receiver.type}" and "${type}"`
288
+ `Incompatible types in allOf at "${$ref}": "${receiver.type}" and "${type}"`,
289
289
  );
290
290
  }
291
291
 
@@ -314,7 +314,7 @@ export class OpenAPIParser {
314
314
  // merge inner properties
315
315
  const mergedProp = this.mergeAllOf(
316
316
  { allOf: [receiver.properties[prop], properties[prop]] },
317
- $ref + "/properties/" + prop
317
+ $ref + "/properties/" + prop,
318
318
  );
319
319
  receiver.properties[prop] = mergedProp;
320
320
  this.exitParents(mergedProp); // every prop resolution should have separate recursive stack
@@ -326,15 +326,15 @@ export class OpenAPIParser {
326
326
  const receiverItems = isBoolean(receiver.items)
327
327
  ? { items: receiver.items }
328
328
  : receiver.items
329
- ? (Object.assign({}, receiver.items) as OpenAPISchema)
330
- : {};
329
+ ? (Object.assign({}, receiver.items) as OpenAPISchema)
330
+ : {};
331
331
  const subSchemaItems = isBoolean(items)
332
332
  ? { items }
333
333
  : (Object.assign({}, items) as OpenAPISchema);
334
334
  // merge inner properties
335
335
  receiver.items = this.mergeAllOf(
336
336
  { allOf: [receiverItems, subSchemaItems] },
337
- $ref + "/items"
337
+ $ref + "/items",
338
338
  );
339
339
  }
340
340
 
@@ -385,7 +385,7 @@ export class OpenAPIParser {
385
385
  if (
386
386
  def.allOf !== undefined &&
387
387
  def.allOf.find(
388
- (obj) => obj.$ref !== undefined && $refs.indexOf(obj.$ref) > -1
388
+ (obj) => obj.$ref !== undefined && $refs.indexOf(obj.$ref) > -1,
389
389
  )
390
390
  ) {
391
391
  res["#/components/schemas/" + defName] = [
@@ -64,7 +64,7 @@ export interface RedocRawOptions {
64
64
 
65
65
  export function argValueToBoolean(
66
66
  val?: string | boolean,
67
- defaultValue?: boolean
67
+ defaultValue?: boolean,
68
68
  ): boolean {
69
69
  if (val === undefined) {
70
70
  return defaultValue || false;
@@ -76,7 +76,7 @@ export function argValueToBoolean(
76
76
  }
77
77
 
78
78
  function argValueToNumber(
79
- value: number | string | undefined
79
+ value: number | string | undefined,
80
80
  ): number | undefined {
81
81
  if (typeof value === "string") {
82
82
  return parseInt(value, 10);
@@ -89,7 +89,7 @@ function argValueToNumber(
89
89
 
90
90
  function argValueToExpandLevel(
91
91
  value?: number | string | undefined,
92
- defaultValue = 0
92
+ defaultValue = 0,
93
93
  ): number {
94
94
  if (value === "all") return Infinity;
95
95
 
@@ -109,20 +109,20 @@ export class RedocNormalizedOptions {
109
109
  return res;
110
110
  } else if (value !== undefined) {
111
111
  console.warn(
112
- `expandResponses must be a string but received value "${value}" of type ${typeof value}`
112
+ `expandResponses must be a string but received value "${value}" of type ${typeof value}`,
113
113
  );
114
114
  }
115
115
  return {};
116
116
  }
117
117
 
118
118
  static normalizeHideHostname(
119
- value: RedocRawOptions["hideHostname"]
119
+ value: RedocRawOptions["hideHostname"],
120
120
  ): boolean {
121
121
  return !!value;
122
122
  }
123
123
 
124
124
  static normalizeShowExtensions(
125
- value: RedocRawOptions["showExtensions"]
125
+ value: RedocRawOptions["showExtensions"],
126
126
  ): string[] | boolean {
127
127
  if (typeof value === "undefined") {
128
128
  return false;
@@ -146,7 +146,7 @@ export class RedocNormalizedOptions {
146
146
  }
147
147
 
148
148
  static normalizeSideNavStyle(
149
- value: RedocRawOptions["sideNavStyle"]
149
+ value: RedocRawOptions["sideNavStyle"],
150
150
  ): SideNavStyleEnum {
151
151
  const defaultValue = SideNavStyleEnum.SummaryOnly;
152
152
  if (typeof value !== "string") {
@@ -166,7 +166,7 @@ export class RedocNormalizedOptions {
166
166
  }
167
167
 
168
168
  static normalizePayloadSampleIdx(
169
- value: RedocRawOptions["payloadSampleIdx"]
169
+ value: RedocRawOptions["payloadSampleIdx"],
170
170
  ): number {
171
171
  if (typeof value === "number") {
172
172
  return Math.max(0, value); // always greater or equal than 0
@@ -180,7 +180,7 @@ export class RedocNormalizedOptions {
180
180
  }
181
181
 
182
182
  private static normalizeJsonSampleExpandLevel(
183
- level?: number | string | "all"
183
+ level?: number | string | "all",
184
184
  ): number {
185
185
  if (level === "all") {
186
186
  return +Infinity;
@@ -192,7 +192,7 @@ export class RedocNormalizedOptions {
192
192
  }
193
193
 
194
194
  private static normalizeGeneratedPayloadSamplesMaxDepth(
195
- value?: number | string | undefined
195
+ value?: number | string | undefined,
196
196
  ): number {
197
197
  if (!isNaN(Number(value))) {
198
198
  return Math.max(0, Number(value));
@@ -250,20 +250,20 @@ export class RedocNormalizedOptions {
250
250
  raw = { ...defaults, ...raw };
251
251
 
252
252
  this.hideHostname = RedocNormalizedOptions.normalizeHideHostname(
253
- raw.hideHostname
253
+ raw.hideHostname,
254
254
  );
255
255
  this.expandResponses = RedocNormalizedOptions.normalizeExpandResponses(
256
- raw.expandResponses
256
+ raw.expandResponses,
257
257
  );
258
258
  this.requiredPropsFirst = argValueToBoolean(raw.requiredPropsFirst);
259
259
  this.sortPropsAlphabetically = argValueToBoolean(
260
- raw.sortPropsAlphabetically
260
+ raw.sortPropsAlphabetically,
261
261
  );
262
262
  this.sortEnumValuesAlphabetically = argValueToBoolean(
263
- raw.sortEnumValuesAlphabetically
263
+ raw.sortEnumValuesAlphabetically,
264
264
  );
265
265
  this.sortOperationsAlphabetically = argValueToBoolean(
266
- raw.sortOperationsAlphabetically
266
+ raw.sortOperationsAlphabetically,
267
267
  );
268
268
  this.sortTagsAlphabetically = argValueToBoolean(raw.sortTagsAlphabetically);
269
269
  this.nativeScrollbars = argValueToBoolean(raw.nativeScrollbars);
@@ -275,41 +275,41 @@ export class RedocNormalizedOptions {
275
275
  this.disableSearch = argValueToBoolean(raw.disableSearch);
276
276
  this.onlyRequiredInSamples = argValueToBoolean(raw.onlyRequiredInSamples);
277
277
  this.showExtensions = RedocNormalizedOptions.normalizeShowExtensions(
278
- raw.showExtensions
278
+ raw.showExtensions,
279
279
  );
280
280
  this.sideNavStyle = RedocNormalizedOptions.normalizeSideNavStyle(
281
- raw.sideNavStyle
281
+ raw.sideNavStyle,
282
282
  );
283
283
  this.hideSingleRequestSampleTab = argValueToBoolean(
284
- raw.hideSingleRequestSampleTab
284
+ raw.hideSingleRequestSampleTab,
285
285
  );
286
286
  this.menuToggle = argValueToBoolean(raw.menuToggle, true);
287
287
  this.jsonSampleExpandLevel =
288
288
  RedocNormalizedOptions.normalizeJsonSampleExpandLevel(
289
- raw.jsonSampleExpandLevel
289
+ raw.jsonSampleExpandLevel,
290
290
  );
291
291
  this.enumSkipQuotes = argValueToBoolean(raw.enumSkipQuotes);
292
292
  this.hideSchemaTitles = argValueToBoolean(raw.hideSchemaTitles);
293
293
  this.simpleOneOfTypeLabel = argValueToBoolean(raw.simpleOneOfTypeLabel);
294
294
  this.payloadSampleIdx = RedocNormalizedOptions.normalizePayloadSampleIdx(
295
- raw.payloadSampleIdx
295
+ raw.payloadSampleIdx,
296
296
  );
297
297
  this.expandSingleSchemaField = argValueToBoolean(
298
- raw.expandSingleSchemaField
298
+ raw.expandSingleSchemaField,
299
299
  );
300
300
  this.schemaExpansionLevel = argValueToExpandLevel(raw.schemaExpansionLevel);
301
301
  this.showObjectSchemaExamples = argValueToBoolean(
302
- raw.showObjectSchemaExamples
302
+ raw.showObjectSchemaExamples,
303
303
  );
304
304
  this.showSecuritySchemeType = argValueToBoolean(raw.showSecuritySchemeType);
305
305
  this.hideSecuritySection = argValueToBoolean(raw.hideSecuritySection);
306
306
 
307
307
  this.unstable_ignoreMimeParameters = argValueToBoolean(
308
- raw.unstable_ignoreMimeParameters
308
+ raw.unstable_ignoreMimeParameters,
309
309
  );
310
310
 
311
311
  this.expandDefaultServerVariables = argValueToBoolean(
312
- raw.expandDefaultServerVariables
312
+ raw.expandDefaultServerVariables,
313
313
  );
314
314
  this.maxDisplayedEnumValues = argValueToNumber(raw.maxDisplayedEnumValues);
315
315
  const ignoreNamedSchemas = isArray(raw.ignoreNamedSchemas)
@@ -319,7 +319,7 @@ export class RedocNormalizedOptions {
319
319
  this.hideSchemaPattern = argValueToBoolean(raw.hideSchemaPattern);
320
320
  this.generatedPayloadSamplesMaxDepth =
321
321
  RedocNormalizedOptions.normalizeGeneratedPayloadSamplesMaxDepth(
322
- raw.generatedPayloadSamplesMaxDepth
322
+ raw.generatedPayloadSamplesMaxDepth,
323
323
  );
324
324
  this.nonce = raw.nonce;
325
325
  this.hideFab = argValueToBoolean(raw.hideFab);
@@ -14,7 +14,7 @@ import slugify from "slugify";
14
14
  */
15
15
  export function mapWithLast<T, P>(
16
16
  array: T[],
17
- iteratee: (item: T, isLast: boolean) => P
17
+ iteratee: (item: T, isLast: boolean) => P,
18
18
  ) {
19
19
  const res: P[] = [];
20
20
  for (let i = 0; i < array.length - 1; i++) {
@@ -36,7 +36,7 @@ export function mapWithLast<T, P>(
36
36
  */
37
37
  export function mapValues<T, P>(
38
38
  object: Record<string, T>,
39
- iteratee: (val: T, key: string, obj: Record<string, T>) => P
39
+ iteratee: (val: T, key: string, obj: Record<string, T>) => P,
40
40
  ): Record<string, P> {
41
41
  const res: { [key: string]: P } = {};
42
42
  for (const key in object) {
@@ -54,7 +54,7 @@ export function mapValues<T, P>(
54
54
  */
55
55
  export function flattenByProp<T extends object, P extends keyof T>(
56
56
  collectionItems: T[],
57
- prop: P
57
+ prop: P,
58
58
  ): T[] {
59
59
  const res: T[] = [];
60
60
  const iterate = (items: T[]) => {
@@ -83,13 +83,13 @@ export function isNumeric(n: any): n is number {
83
83
  export function appendToMdHeading(
84
84
  md: string,
85
85
  heading: string,
86
- content: string
86
+ content: string,
87
87
  ) {
88
88
  // if heading is already in md and append to the end of it
89
89
  const testRegex = new RegExp(`(^|\\n)#\\s?${heading}\\s*\\n`, "i");
90
90
  const replaceRegex = new RegExp(
91
91
  `((\\n|^)#\\s*${heading}\\s*(\\n|$)(?:.|\\n)*?)(\\n#|$)`,
92
- "i"
92
+ "i",
93
93
  );
94
94
  if (testRegex.test(md)) {
95
95
  return md.replace(replaceRegex, `$1\n\n${content}\n$4`);
@@ -30,7 +30,7 @@ import {
30
30
  } from "../types";
31
31
 
32
32
  function isWildcardStatusCode(
33
- statusCode: string | number
33
+ statusCode: string | number,
34
34
  ): statusCode is string {
35
35
  return typeof statusCode === "string" && /\dxx/i.test(statusCode);
36
36
  }
@@ -45,7 +45,7 @@ export function isStatusCode(statusCode: string) {
45
45
 
46
46
  export function getStatusCodeType(
47
47
  statusCode: string | number,
48
- defaultAsError = false
48
+ defaultAsError = false,
49
49
  ): string {
50
50
  if (statusCode === "default") {
51
51
  return defaultAsError ? "error" : "success";
@@ -140,7 +140,7 @@ export function detectType(schema: OpenAPISchema): string {
140
140
 
141
141
  export function isPrimitiveType(
142
142
  schema: OpenAPISchema,
143
- type: string | string[] | undefined = schema.type
143
+ type: string | string[] | undefined = schema.type,
144
144
  ) {
145
145
  if (schema.oneOf !== undefined || schema.anyOf !== undefined) {
146
146
  return false;
@@ -187,7 +187,7 @@ export function isFormUrlEncoded(contentType: string): boolean {
187
187
  function delimitedEncodeField(
188
188
  fieldVal: any,
189
189
  fieldName: string,
190
- delimiter: string
190
+ delimiter: string,
191
191
  ): string {
192
192
  if (isArray(fieldVal)) {
193
193
  return fieldVal.map((v) => v.toString()).join(delimiter);
@@ -203,7 +203,7 @@ function delimitedEncodeField(
203
203
  function deepObjectEncodeField(fieldVal: any, fieldName: string): string {
204
204
  if (isArray(fieldVal)) {
205
205
  console.warn(
206
- "deepObject style cannot be used with array value:" + fieldVal.toString()
206
+ "deepObject style cannot be used with array value:" + fieldVal.toString(),
207
207
  );
208
208
  return "";
209
209
  } else if (typeof fieldVal === "object") {
@@ -213,7 +213,7 @@ function deepObjectEncodeField(fieldVal: any, fieldName: string): string {
213
213
  } else {
214
214
  console.warn(
215
215
  "deepObject style cannot be used with non-object value:" +
216
- fieldVal.toString()
216
+ fieldVal.toString(),
217
217
  );
218
218
  return "";
219
219
  }
@@ -237,7 +237,7 @@ function serializeFormValue(name: string, explode: boolean, value: any) {
237
237
  */
238
238
  export function urlFormEncodePayload(
239
239
  payload: object,
240
- encoding: { [field: string]: OpenAPIEncoding } = {}
240
+ encoding: { [field: string]: OpenAPIEncoding } = {},
241
241
  ) {
242
242
  if (isArray(payload)) {
243
243
  throw new Error("Payload must have fields: " + payload.toString());
@@ -269,7 +269,7 @@ function serializePathParameter(
269
269
  name: string,
270
270
  style: OpenAPIParameterStyle,
271
271
  explode: boolean,
272
- value: any
272
+ value: any,
273
273
  ): string {
274
274
  const suffix = explode ? "*" : "";
275
275
  let prefix = "";
@@ -294,7 +294,7 @@ function serializeQueryParameter(
294
294
  name: string,
295
295
  style: OpenAPIParameterStyle,
296
296
  explode: boolean,
297
- value: any
297
+ value: any,
298
298
  ): string {
299
299
  switch (style) {
300
300
  case "form":
@@ -322,7 +322,7 @@ function serializeQueryParameter(
322
322
  case "deepObject":
323
323
  if (!explode || isArray(value) || typeof value !== "object") {
324
324
  console.warn(
325
- "The style deepObject is only applicable for objects with explode=true"
325
+ "The style deepObject is only applicable for objects with explode=true",
326
326
  );
327
327
  return "";
328
328
  }
@@ -337,7 +337,7 @@ function serializeQueryParameter(
337
337
  function serializeHeaderParameter(
338
338
  style: OpenAPIParameterStyle,
339
339
  explode: boolean,
340
- value: any
340
+ value: any,
341
341
  ): string {
342
342
  switch (style) {
343
343
  case "simple":
@@ -357,7 +357,7 @@ function serializeCookieParameter(
357
357
  name: string,
358
358
  style: OpenAPIParameterStyle,
359
359
  explode: boolean,
360
- value: any
360
+ value: any,
361
361
  ): string {
362
362
  switch (style) {
363
363
  case "form":
@@ -370,7 +370,7 @@ function serializeCookieParameter(
370
370
 
371
371
  export function serializeParameterValueWithMime(
372
372
  value: any,
373
- mime: string
373
+ mime: string,
374
374
  ): string {
375
375
  if (isJsonLike(mime)) {
376
376
  return JSON.stringify(value);
@@ -382,7 +382,7 @@ export function serializeParameterValueWithMime(
382
382
 
383
383
  export function serializeParameterValue(
384
384
  parameter: OpenAPIParameter & { serializationMime?: string },
385
- value: any
385
+ value: any,
386
386
  ): string {
387
387
  const { name, style, explode = false, serializationMime } = parameter;
388
388
 
@@ -395,7 +395,7 @@ export function serializeParameterValue(
395
395
  case "query":
396
396
  return `${name}=${serializeParameterValueWithMime(
397
397
  value,
398
- serializationMime
398
+ serializationMime,
399
399
  )}`;
400
400
  default:
401
401
  console.warn("Unexpected parameter location: " + parameter.in);
@@ -451,7 +451,7 @@ export function getDefinitionName(pointer?: string): string | undefined {
451
451
  }
452
452
 
453
453
  function humanizeMultipleOfConstraint(
454
- multipleOf: number | undefined
454
+ multipleOf: number | undefined,
455
455
  ): string | undefined {
456
456
  if (multipleOf === undefined) {
457
457
  return;
@@ -466,7 +466,7 @@ function humanizeMultipleOfConstraint(
466
466
  function humanizeRangeConstraint(
467
467
  description: string,
468
468
  min: number | undefined,
469
- max: number | undefined
469
+ max: number | undefined,
470
470
  ): string | undefined {
471
471
  let stringRange;
472
472
  if (min !== undefined && max !== undefined) {
@@ -519,7 +519,7 @@ export function humanizeConstraints(schema: OpenAPISchema): string[] {
519
519
  const stringRange = humanizeRangeConstraint(
520
520
  "characters",
521
521
  schema.minLength,
522
- schema.maxLength
522
+ schema.maxLength,
523
523
  );
524
524
  if (stringRange !== undefined) {
525
525
  res.push(stringRange);
@@ -528,7 +528,7 @@ export function humanizeConstraints(schema: OpenAPISchema): string[] {
528
528
  const arrayRange = humanizeRangeConstraint(
529
529
  "items",
530
530
  schema.minItems,
531
- schema.maxItems
531
+ schema.maxItems,
532
532
  );
533
533
  if (arrayRange !== undefined) {
534
534
  res.push(arrayRange);
@@ -537,7 +537,7 @@ export function humanizeConstraints(schema: OpenAPISchema): string[] {
537
537
  const propertiesRange = humanizeRangeConstraint(
538
538
  "properties",
539
539
  schema.minProperties,
540
- schema.maxProperties
540
+ schema.maxProperties,
541
541
  );
542
542
  if (propertiesRange !== undefined) {
543
543
  res.push(propertiesRange);
@@ -582,7 +582,7 @@ export function sortByRequired(fields: any[], order: string[] = []) {
582
582
 
583
583
  export function sortByField(
584
584
  fields: any[],
585
- param: "name" | "description" | "kind"
585
+ param: "name" | "description" | "kind",
586
586
  ) {
587
587
  return [...fields].sort((a, b) => {
588
588
  return a[param].localeCompare(b[param]);
@@ -592,7 +592,7 @@ export function sortByField(
592
592
  export function mergeParams(
593
593
  parser: OpenAPIParser,
594
594
  pathParams: Array<Referenced<OpenAPIParameter>> = [],
595
- operationParams: Array<Referenced<OpenAPIParameter>> = []
595
+ operationParams: Array<Referenced<OpenAPIParameter>> = [],
596
596
  ): Array<Referenced<OpenAPIParameter>> {
597
597
  const operationParamNames = {};
598
598
  operationParams.forEach((param) => {
@@ -610,7 +610,7 @@ export function mergeParams(
610
610
  }
611
611
 
612
612
  export function mergeSimilarMediaTypes(
613
- types: Record<string, OpenAPIMediaType>
613
+ types: Record<string, OpenAPIMediaType>,
614
614
  ): Record<string, OpenAPIMediaType> {
615
615
  const mergedTypes = {};
616
616
  Object.keys(types).forEach((name) => {
@@ -632,17 +632,17 @@ export function mergeSimilarMediaTypes(
632
632
 
633
633
  export function expandDefaultServerVariables(
634
634
  url: string,
635
- variables: object = {}
635
+ variables: object = {},
636
636
  ) {
637
637
  return url.replace(
638
638
  /(?:{)([\w-.]+)(?:})/g,
639
- (match, name) => (variables[name] && variables[name].default) || match
639
+ (match, name) => (variables[name] && variables[name].default) || match,
640
640
  );
641
641
  }
642
642
 
643
643
  export function normalizeServers(
644
644
  specUrl: string | undefined,
645
- servers: OpenAPIServer[]
645
+ servers: OpenAPIServer[],
646
646
  ): OpenAPIServer[] {
647
647
  const getHref = () => {
648
648
  if (!false) {
@@ -689,7 +689,7 @@ export const shortenHTTPVerb = (verb) =>
689
689
  ({
690
690
  delete: "del",
691
691
  options: "opts",
692
- }[verb] || verb);
692
+ })[verb] || verb;
693
693
 
694
694
  export function isRedocExtension(key: string): boolean {
695
695
  const redocExtensions = {
@@ -713,7 +713,7 @@ export function isRedocExtension(key: string): boolean {
713
713
 
714
714
  export function extractExtensions(
715
715
  obj: object,
716
- showExtensions: string[] | true
716
+ showExtensions: string[] | true,
717
717
  ): Record<string, any> {
718
718
  return Object.keys(obj)
719
719
  .filter((key) => {
@@ -734,14 +734,14 @@ export function pluralizeType(displayType: string): string {
734
734
  .map((type) =>
735
735
  type.replace(
736
736
  /^(string|object|number|integer|array|boolean)s?( ?.*)/,
737
- "$1s$2"
738
- )
737
+ "$1s$2",
738
+ ),
739
739
  )
740
740
  .join(" or ");
741
741
  }
742
742
 
743
743
  export function getContentWithLegacyExamples(
744
- info: OpenAPIRequestBody | OpenAPIResponse
744
+ info: OpenAPIRequestBody | OpenAPIResponse,
745
745
  ): { [mime: string]: OpenAPIMediaType } | undefined {
746
746
  let mediaContent = info.content;
747
747
  const xExamples = info["x-examples"]; // converted from OAS2 body param
package/src/options.ts CHANGED
@@ -60,9 +60,9 @@ export const OptionsSchema = Joi.object({
60
60
  label: Joi.string().required(),
61
61
  baseUrl: Joi.string().required(),
62
62
  downloadUrl: Joi.string(),
63
- })
63
+ }),
64
64
  ),
65
- })
65
+ }),
66
66
  )
67
67
  .required(),
68
68
  });
@@ -46,7 +46,7 @@ function groupByTags(
46
46
  sidebarOptions: SidebarOptions,
47
47
  options: APIOptions,
48
48
  tags: TagObject[][],
49
- docPath: string
49
+ docPath: string,
50
50
  ): ProcessedSidebar {
51
51
  let { outputDir, label, showSchemas } = options;
52
52
 
@@ -76,12 +76,12 @@ function groupByTags(
76
76
  const operationTags = uniq(
77
77
  apiItems
78
78
  .flatMap((item) => item.api.tags)
79
- .filter((item): item is string => !!item)
79
+ .filter((item): item is string => !!item),
80
80
  );
81
81
  const schemaTags = uniq(
82
82
  schemaItems
83
83
  .flatMap((item) => item.schema["x-tags"])
84
- .filter((item): item is string => !!item)
84
+ .filter((item): item is string => !!item),
85
85
  );
86
86
 
87
87
  // Combine globally defined tags with operation and schema tags
@@ -102,7 +102,7 @@ function groupByTags(
102
102
  ? outputDir.split(docPath!)[1].replace(/^\/+/g, "")
103
103
  : outputDir.slice(outputDir.indexOf("/", 1)).replace(/^\/+/g, "");
104
104
  function createDocItem(
105
- item: ApiPageMetadata | SchemaPageMetadata
105
+ item: ApiPageMetadata | SchemaPageMetadata,
106
106
  ): SidebarItemDoc {
107
107
  const sidebar_label = item.frontMatter.sidebar_label;
108
108
  const title = item.title;
@@ -114,13 +114,13 @@ function groupByTags(
114
114
  "menu__list-item--deprecated": item.api.deprecated,
115
115
  "api-method": !!item.api.method,
116
116
  },
117
- item.api.method
117
+ item.api.method,
118
118
  )
119
119
  : clsx(
120
120
  {
121
121
  "menu__list-item--deprecated": item.schema.deprecated,
122
122
  },
123
- "schema"
123
+ "schema",
124
124
  );
125
125
  return {
126
126
  type: "doc" as const,
@@ -145,14 +145,14 @@ function groupByTags(
145
145
  .map((tag) => {
146
146
  // Map info object to tag
147
147
  const taggedInfoObject = intros.find((i) =>
148
- i.tags ? i.tags.find((t: any) => t.name === tag) : undefined
148
+ i.tags ? i.tags.find((t: any) => t.name === tag) : undefined,
149
149
  );
150
150
  const tagObject = tags.flat().find(
151
151
  (t) =>
152
152
  tag === t.name ?? {
153
153
  name: tag,
154
154
  description: `${tag} Index`,
155
- }
155
+ },
156
156
  );
157
157
 
158
158
  // TODO: perhaps move this into a getLinkConfig() function
@@ -188,18 +188,18 @@ function groupByTags(
188
188
  "/category",
189
189
  basePath,
190
190
  kebabCase(label),
191
- kebabCase(tag)
192
- )
191
+ kebabCase(tag),
192
+ ),
193
193
  )
194
194
  : posixPath(path.join("/category", basePath, kebabCase(tag))),
195
195
  } as SidebarItemCategoryLinkConfig;
196
196
  }
197
197
 
198
198
  const taggedApiItems = apiItems.filter(
199
- (item) => !!item.api.tags?.includes(tag)
199
+ (item) => !!item.api.tags?.includes(tag),
200
200
  );
201
201
  const taggedSchemaItems = schemaItems.filter(
202
- (item) => !!item.schema["x-tags"]?.includes(tag)
202
+ (item) => !!item.schema["x-tags"]?.includes(tag),
203
203
  );
204
204
 
205
205
  return {
@@ -262,7 +262,7 @@ export default function generateSidebarSlice(
262
262
  api: ApiMetadata[],
263
263
  tags: TagObject[][],
264
264
  docPath: string,
265
- tagGroups?: TagGroupObject[]
265
+ tagGroups?: TagGroupObject[],
266
266
  ) {
267
267
  let sidebarSlice: ProcessedSidebar = [];
268
268
 
@@ -287,7 +287,7 @@ export default function generateSidebarSlice(
287
287
  sidebarOptions,
288
288
  options,
289
289
  [filteredTags],
290
- docPath
290
+ docPath,
291
291
  ),
292
292
  };
293
293
 
@@ -295,12 +295,12 @@ export default function generateSidebarSlice(
295
295
  // For the first tagGroup, save the generated "Schemas" category for later.
296
296
  if (schemasGroup.length === 0) {
297
297
  schemasGroup = groupCategory.items?.filter(
298
- (item) => item.type === "category" && item.label === "Schemas"
298
+ (item) => item.type === "category" && item.label === "Schemas",
299
299
  );
300
300
  }
301
301
  // Remove the "Schemas" category from every `groupCategory`.
302
302
  groupCategory.items = groupCategory.items.filter((item) =>
303
- "label" in item ? item.label !== "Schemas" : true
303
+ "label" in item ? item.label !== "Schemas" : true,
304
304
  );
305
305
  }
306
306
  sidebarSlice.push(groupCategory as ProcessedSidebarItem);