Home / Function/ getTypeDisplayFromSchema() — supabase Function Reference

getTypeDisplayFromSchema() — supabase Function Reference

Architecture documentation for the getTypeDisplayFromSchema() function in Reference.api.utils.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  ddd25313_39f7_44ef_a55f_cf32b776fdab["getTypeDisplayFromSchema()"]
  c3e497ec_f856_95f0_0bc9_021b36406772["ApiSchemaParamDetails()"]
  c3e497ec_f856_95f0_0bc9_021b36406772 -->|calls| ddd25313_39f7_44ef_a55f_cf32b776fdab
  5a053538_7f1d_9407_4fd0_1115584fb1d7["ApiOperationRequestBodyDetailsInternal()"]
  5a053538_7f1d_9407_4fd0_1115584fb1d7 -->|calls| ddd25313_39f7_44ef_a55f_cf32b776fdab
  style ddd25313_39f7_44ef_a55f_cf32b776fdab fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/features/docs/Reference.api.utils.ts lines 135–198

export function getTypeDisplayFromSchema(schema: ISchema) {
  if ('allOf' in schema) {
    if (schema.allOf.length === 1) {
      return getTypeDisplayFromSchema(schema.allOf[0])
    } else {
      return {
        displayName: 'all of the following options',
      }
    }
  } else if ('oneOf' in schema) {
    if (schema.oneOf.length === 1) {
      return getTypeDisplayFromSchema(schema.oneOf[0])
    } else {
      return {
        displayName: 'one of the following options',
      }
    }
  } else if ('anyOf' in schema) {
    if (schema.anyOf.length === 1) {
      return getTypeDisplayFromSchema(schema.anyOf[0])
    } else {
      return {
        displayName: 'any of the following options',
      }
    }
  } else if ('enum' in schema) {
    return {
      displayName: 'enum',
    }
  } else if (schema.type === 'boolean') {
    return {
      displayName: 'boolean',
    }
  } else if (schema.type === 'integer') {
    return {
      displayName: 'integer',
    }
  } else if (schema.type === 'number') {
    return {
      displayName: 'number',
    }
  } else if (schema.type === 'string') {
    return {
      displayName: 'string',
    }
  } else if (schema.type === 'file') {
    return {
      displayName: 'file',
    }
  } else if (schema.type === 'array') {
    return {
      displayName: `Array<${getTypeDisplayFromSchema(schema.items).displayName}>`,
    }
  } else if (schema.type === 'object') {
    return {
      displayName: 'object',
    }
  }

  // Default fallback for unhandled schema types
  return {
    displayName: 'unknown',
  }
}

Subdomains

Frequently Asked Questions

What does getTypeDisplayFromSchema() do?
getTypeDisplayFromSchema() is a function in the supabase codebase.
What calls getTypeDisplayFromSchema()?
getTypeDisplayFromSchema() is called by 2 function(s): ApiOperationRequestBodyDetailsInternal, ApiSchemaParamDetails.

Analyze Your Own Codebase

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

Try Supermodel Free