Skip to content

ValueError: dictionary update sequence element #0 has length 1; 2 is required #166

Description

@stativ

When allOf refers to schema that is not an object but a string, sphinx-build fails when generating examples with a following error

      File "/home/stativ/development/workdir/astra-open-api/.venv/lib/python3.13/site-packages/sphinxcontrib/openapi/schema_utils.py", line 67, in example_from_schema
        example.update(example_from_schema(sub_schema))
        ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ValueError: dictionary update sequence element #0 has length 1; 2 is required

Minimal Example

test.yaml

openapi: 3.0.3
info:
  version: 1.0.0
  title: Bug example
paths:
  /test:
    get:
      responses:
        '200':
          description: Success.
          content:
            application/json:
              schema:
                title: SomeTitle
                type: object
                properties:
                  timestamp:
                    allOf:
                      - $ref: '#/components/schemas/Timestamp'
components:
  schemas:
    Timestamp:
      type: string
      example: 2022-09-12 13:09:16:18

index.rst

.. openapi:: test.yaml
   :generate-examples-from-schemas:

SW Versions

  • sphinx-openapi commit e2c4473
  • sphinx 8.2.3

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions