Skip to content

OpenAPI. Problem displaying a field with an array of enums type #2908

@illia2m4ch

Description

@illia2m4ch

To Reproduce

  1. Use OpenAPI integration
  2. Add a field with the following type to the openapi.json specification:
{
  "options": {
    "type": "array",
    "description": "Description",
    "items": {
      "type": "string",
      "enum": [
        "FIRST",
        "SECOND",
        "THIRD"
      ]
    }
  }
}

Current vs. Expected behavior

Current behavior:
A field of type array<string> is displayed without info tags.

Image

Expected behavior:
A field of type array<string> is displayed with info tag "Value in" or something like that (e.g. "Item value in")

Image

This also needs to be thought out for a nesting arrays (e.g. array<array<string>>)

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:29 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6000
  Available memory (MB): 32768
  Available CPU cores: 8
Binaries:
  Node: 22.15.0
  npm: 10.9.2
  Yarn: 1.22.22
  pnpm: N/A
Relevant Packages:
  next: 16.1.1 // There is a newer version (16.1.2) available, upgrade recommended! 
  eslint-config-next: 15.5.2
  react: 19.2.3
  react-dom: 19.2.3
  typescript: 5.9.2
Next.js Config:
  output: standalone

Which area(s) are affected? (Select all that apply)

UI

Additional context

A naive implementation might look something like this:

// https://github.com/fuma-nama/fumadocs/blob/dev/packages/openapi/src/ui/schema/index.tsx

function findNestedEnum(schema: ResolvedSchema): string[] | null {
    if (schema.enum) {
        return schema.enum
    {
    if (schema.items) {
        return findNestedEnum(schema.items)
    }
    return null
}

function generateInfoTags(schema: Exclude<ResolvedSchema, boolean>) {

    // ...

    let nestedEnum = schema.items && findNestedEnum(schema.items)
    if (nestedEnum) {
      fields.push(field('Item value in', nestedEnum.map((value) => JSON.stringify(value)).join(' | ')));
    }

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions