Skip to content

Strapi V5.25 -> V5.26 breaks OpenAPI generation (Missing types/schema/component) #24717

@ollioddi

Description

@ollioddi

Node Version

22.20.0

NPM/Yarn/PNPM Version

NPM 11.6.2

Strapi Version

5.25/5.26

Operating System

Linux (Other)

Database

PostgreSQL

Javascript or Typescript

Typescript

Reproduction URL

No response

Bug Description

After updating beyond V25 to 26 (Or currently 29), the generated OpenAPI file is missing references, and types (components & schemas).

Reverting back to 25 from 26 (or 29) resolves the issue.

This makes it so that FE client generators are unable to create a proper client.

I was unable to find any changes in release 26 regarding this code, making it slightly confusing.

Diffing the files reveals that in v25, the components are referenced from otherplaces. In v26 they are inline.

Steps to Reproduce

  1. Generate the spec in v25 and observe that the output is correct
  2. Bump the version to v26 and observe that the output is broken
    "@strapi/plugin-cloud": "5.26.0",
    "@strapi/plugin-users-permissions": "5.26.0",
    "@strapi/strapi": "5.26.0",
  1. Revert to v25 and observe it is correct again
    "@strapi/plugin-cloud": "5.25.0",
    "@strapi/plugin-users-permissions": "5.25.0",
    "@strapi/strapi": "5.25.0",

I don't believe there is anything specific to this codebase other than the version responsible for this.

Expected Behavior

A correctly generated file populated with types.

Logs

strapi git:(fix/web-client-generation) ✗ npm run generate-spec

> strapi@0.1.0 generate-spec
> cross-env ENV_PATH=../.env strapi openapi generate --output ../openapi/strapi-spec.json


⚠️  The OpenAPI generation feature is currently experimental.
    Its behavior and output might change in future releases without following semver.
    Please report any issues you encounter on https://github.com/strapi/strapi/issues/new?template=BUG_REPORT.yml.

Generated an OpenAPI specification for "strapi v0.1.0" at ../openapi/strapi-spec.json in 76ms

Code Snippets

No response

Media

V26

Image

V25

Image

Additional information

I can provide the generated files if requested, but the project itself is WIP and the files are large.

Because it works when purely changing Strapi versions, i doubt its my code at fault. However i cannot conclude that it is not. Any pointers or help is greatly appreciated.

Running on Fedora 42 with PostgreSQL in Docker.

Confirmation Checklist

EDIT: The types are placed inline, but they are not defined as reusable components. As such, multiple tools will not pick it up and generate client types based on it (afaik), such as Hey API

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue: bugIssue reporting a bugsource: core:openapiSource is core/openapi packagestatus: pending reproductionWaiting for free time to reproduce the issue, or more informationversion: 5Issue is present in Strapi 5

    Type

    Projects

    Status

    To be reviewed (Open)

    Status

    To triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions