Skip to content

OpenAPI - schema examples are not used #75

@gotson

Description

@gotson

Description

I have an OpenAPI spec, where the example is set on each field of the schema. I don't have any example set at the API response level. When using my OpenAPI spec, the example from the schema fields are not used, and instead dummy data is generated.

Reproduction steps

Here is a trimmed down version of my OpenAPI spec:

openapi.json

Here is what the mock returns for GET /api/v1/announcements:

{
  "description": "truly",
  "home_page_url": "savor",
  "items": [
    {
      "_komga": {
        "read": false
      },
      "author": {
        "name": "after",
        "url": "misty"
      },
      "content_html": "yahoo",
      "date_modified": "2025-11-13T10:58:20.178Z",
      "id": "where",
      "summary": "owner",
      "tags": [
        "chant",
        "dimly",
        "along",
        "after",
        "since",
        "realm"
      ],
      "title": "yahoo",
      "url": "torte"
    },
    {
      "_komga": {
        "read": false
      },
      "author": {
        "name": "fooey",
        "url": "giant"
      },
      "content_html": "circa",
      "date_modified": "2025-07-30T12:11:50.348Z",
      "id": "fooey",
      "summary": "since",
      "tags": [
        "armor",
        "which"
      ],
      "title": "yahoo",
      "url": "round"
    }
  ],
  "title": "until",
  "version": "fooey"
}

Expected behavior

The mock JSON should be using the example fields of the schema.

Initial assessment

No clue…

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions