1 import { OpenAPIV3 } from "openapi-types"
2
3 export const DOCBLOCK_LINE_ASTRIX = " * "
4 export const DOCBLOCK_NEW_LINE = `\n${DOCBLOCK_LINE_ASTRIX}`
5 export const DOCBLOCK_START = `*${DOCBLOCK_NEW_LINE}`
6 export const DOCBLOCK_END_LINE = "\n"
7 export const DOCBLOCK_DOUBLE_LINES = `${DOCBLOCK_NEW_LINE}${DOCBLOCK_NEW_LINE}`
8 export const DEFAULT_OAS_RESPONSES: {
9 [k: string]: OpenAPIV3.ReferenceObject
10 } = {
11 "400": {
12 $ref: "#/components/responses/400_error",
13 },
14 "401": {
15 $ref: "#/components/responses/unauthorized",
16 },
17 "404": {
18 $ref: "#/components/responses/not_found_error",
19 },
20 "409": {
21 $ref: "#/components/responses/invalid_state_error",
22 },
23 "422": {
24 $ref: "#/components/responses/invalid_request_error",
25 },
26 "500": {
27 $ref: "#/components/responses/500_error",
28 },
29 }
30 export const API_ROUTE_PARAM_REGEX = /\[(.+?)\]/g
31 /**
32 * The schema associated with a tag whose name can't be inferred from the tag's name.
33 * The key is the tag's area and name, and the value is the schema's name.
34 *
35 * For example, the `Views` tag of the admin area is associated with the
36 * `AdminViewConfiguration` schema, whereas `AdminView` is inferred from its name.
37 */
38 export const TAG_SCHEMA_NAME_OVERRIDES: {
39 [areaAndTagName: string]: string
40 } = {
41 "admin:Views": "AdminViewConfiguration",
42 }
43 // we can't use `{summary}` because it causes an MDX error
44 // when we finally render the summary. We can alternatively
45 // use `\{summary\}` but it wouldn't look pretty in the OAS,
46 // so doing this for now.
47 export const SUMMARY_PLACEHOLDER = "SUMMARY"