Redocly / Redocly/redoc

Auto generated examples do not work with exploded array type

Open
#2,430 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Bug
Dominant language
TypeScript
Stars
25.9k
Forks
2.4k
Avg merge
13h 10m
Merged PRs (30d)
4

Description

This specification:

        - in: query
          name: my_param
          schema:
            type: array
            items:
              type: string
            example:
              - one
              - two
          explode: true
          style: form

correctly yields

my_param Array of strings
Example: my_param=one&my_param=two

under 'Query Parameters'.

However, in the auto-generated examples we get for example (in Python):

query = {
  "my_param": "my_param=one&my_param=two",
}

response = requests.get(url, params=query)

which does not produce a request containing my_param=one&my_param=two as url parameters.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the auto-generated Python example path for OpenAPI query parameters, using the exploded array specification and its generated Query Parameters table as the reproduction case. Compare how the example builds request parameters with the documented repeated-key form; done when the generated Python request produces separate my_param=one and my_param=two query parameters.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, typescript
Domain
api, documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.