Home / Function/ gen_v3() — supabase Function Reference

gen_v3() — supabase Function Reference

Architecture documentation for the gen_v3() function in helpers.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  ed861eff_c31c_7ffc_754a_851706ec4946["gen_v3()"]
  5d0aea85_78ea_8cee_ee43_add6bcd0d55b["getSpecSections()"]
  5d0aea85_78ea_8cee_ee43_add6bcd0d55b -->|calls| ed861eff_c31c_7ffc_754a_851706ec4946
  ccd051dd_e35b_c631_0682_045c3138a74a["toArrayWithKey()"]
  ed861eff_c31c_7ffc_754a_851706ec4946 -->|calls| ccd051dd_e35b_c631_0682_045c3138a74a
  0067ace5_fc7e_cc01_4523_70818d1d345e["isValidSlug()"]
  ed861eff_c31c_7ffc_754a_851706ec4946 -->|calls| 0067ace5_fc7e_cc01_4523_70818d1d345e
  0c8ff3ed_1529_8bf0_0c66_fe7b4584873f["slugify()"]
  ed861eff_c31c_7ffc_754a_851706ec4946 -->|calls| 0c8ff3ed_1529_8bf0_0c66_fe7b4584873f
  099feb22_462f_a2d5_6eb6_967b45c3d4fa["toTitle()"]
  ed861eff_c31c_7ffc_754a_851706ec4946 -->|calls| 099feb22_462f_a2d5_6eb6_967b45c3d4fa
  style ed861eff_c31c_7ffc_754a_851706ec4946 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/lib/refGenerator/helpers.ts lines 230–275

export function gen_v3(
  spec: OpenAPIV3.Document,
  dest: string,
  { apiUrl, type }: { apiUrl: string; type?: 'client-lib' | 'cli' | 'api' | 'mgmt-api' }
) {
  const specLayout = spec.tags || []
  const operations: enrichedOperation[] = []

  Object.entries(spec.paths).forEach(([key, val]) => {
    const fullPath = `${apiUrl}${key}`

    toArrayWithKey(val!, 'operation').forEach((o) => {
      const operation = o as v3OperationWithPath
      const operationId =
        type === 'mgmt-api' && operation.operationId && isValidSlug(operation.operationId)
          ? operation.operationId
          : slugify(operation.summary!)
      const enriched = {
        ...operation,
        path: key,
        fullPath,
        operationId,
        responseList: toArrayWithKey(operation.responses!, 'responseCode') || [],
      }
      // @ts-expect-error // missing 'responses', see OpenAPIV3.OperationObject.responses
      operations.push(enriched)
    })
  })

  const sections = specLayout.map((section) => {
    return {
      ...section,
      title: toTitle(section.name),
      id: slugify(section.name),
      operations: operations.filter((operation) => operation.tags?.includes(section.name)),
    }
  })

  const content = {
    info: spec.info,
    sections,
    operations,
  }

  return content
}

Subdomains

Called By

Frequently Asked Questions

What does gen_v3() do?
gen_v3() is a function in the supabase codebase.
What does gen_v3() call?
gen_v3() calls 4 function(s): isValidSlug, slugify, toArrayWithKey, toTitle.
What calls gen_v3()?
gen_v3() is called by 1 function(s): getSpecSections.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free