fix(api): add missing response type in response section#42
Conversation
Greptile SummaryThis PR fixes a missing response type label in the API page's Response section by rendering a short sentence that shows the schema's
Confidence Score: 4/5Safe to merge — the change is additive UI-only and does not affect data fetching, routing, or any shared state. The new paragraph is purely presentational and the fallback (no label rendered) is benign. The only gap is that schemas expressed entirely via src/components/api-page.tsx — specifically the guard condition on line 165 around Important Files Changed
Sequence DiagramsequenceDiagram
participant R as ResponseSection
participant S as schema (OpenAPI object)
participant L as schemaTypeLabel()
participant UI as Rendered UI
R->>S: read schema.title, schema.type
alt "schema.title || schema.type"
R->>L: schemaTypeLabel(schema)
L-->>R: "type string (e.g. "object", "string | null")"
R->>UI: "render "The response is of type [title ·] <type>.""
else no title and no type
R->>UI: skip type label paragraph
end
R->>UI: render SchemaExplorer
Reviews (1): Last reviewed commit: "fix(api): add missing response type in r..." | Re-trigger Greptile |
| {schema && (schema.title || schema.type) && ( | ||
| <p className="mb-3 text-sm text-stone-600 dark:text-stone-400"> | ||
| The response is of type{' '} | ||
| {schema.title && ( | ||
| <> | ||
| <code className="rounded bg-stone-100 px-1 py-0.5 text-xs text-stone-900 dark:bg-stone-800 dark:text-stone-100"> | ||
| {schema.title} | ||
| </code> | ||
| {' · '} | ||
| </> | ||
| )} | ||
| {schemaTypeLabel(schema)}. | ||
| </p> |
There was a problem hiding this comment.
Guard condition misses
oneOf/anyOf and enum-only schemas
The render condition schema.title || schema.type won't fire for schemas whose entire type information comes from oneOf, anyOf, or enum without a top-level type. schemaTypeLabel handles all three cases and would return a meaningful string (e.g. string | null, enum<string>), but the outer guard prevents the paragraph from ever appearing for them. A schema like { oneOf: [...] } with no title and no type would silently skip the label.
Closes DOCS-112