Files
medusa-store/www/utils/packages/docblock-generator/src/constants.ts
Shahed Nasser 922fff4051 docs-util: fixes and improvements to OAS generator (#7731)
* fixed associated schema names

* move OAS method and summary descriptions to knowledge base

* refactoring and fixes

* detect default object value in delete responses
2024-06-26 11:54:09 +03:00

36 lines
1.1 KiB
TypeScript

import { OpenAPIV3 } from "openapi-types"
export const DOCBLOCK_LINE_ASTRIX = " * "
export const DOCBLOCK_NEW_LINE = `\n${DOCBLOCK_LINE_ASTRIX}`
export const DOCBLOCK_START = `*${DOCBLOCK_NEW_LINE}`
export const DOCBLOCK_END_LINE = "\n"
export const DOCBLOCK_DOUBLE_LINES = `${DOCBLOCK_NEW_LINE}${DOCBLOCK_NEW_LINE}`
export const DEFAULT_OAS_RESPONSES: {
[k: string]: OpenAPIV3.ReferenceObject
} = {
"400": {
$ref: "#/components/responses/400_error",
},
"401": {
$ref: "#/components/responses/unauthorized",
},
"404": {
$ref: "#/components/responses/not_found_error",
},
"409": {
$ref: "#/components/responses/invalid_state_error",
},
"422": {
$ref: "#/components/responses/invalid_request_error",
},
"500": {
$ref: "#/components/responses/500_error",
},
}
export const API_ROUTE_PARAM_REGEX = /\[(.+?)\]/g
// we can't use `{summary}` because it causes an MDX error
// when we finally render the summary. We can alternatively
// use `\{summary\}` but it wouldn't look pretty in the OAS,
// so doing this for now.
export const SUMMARY_PLACEHOLDER = "SUMMARY"