OpenAPITools / OpenAPITools/openapi-generator

attribute components.schemas.test.default is not of type `string`

Open
#1,324 14 comments 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

The generator throw "attribute components.schemas.test.default is not of type string" when property is of type array and default value is array.

openapi-generator version

3.3.1

OpenAPI declaration file content or url
"schema": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    },
                    "default": [
                        {
                            "id": "asc"
                        }
                    ]
                }

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

No source file or test is named. Start by reproducing the error from the supplied OpenAPI declaration using openapi-generator 3.3.1, then trace the validation path for an array schema with an array default. Done means the declaration is accepted without the string-type error and the behavior is covered by regression testing.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.