Azure / Azure/azure-functions-openapi-extension

OpenApiProperty default array unable to cast to string

Open
#540 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
C#
Stars
388
Forks
202
PR merge metrics
No merged PRs in 30d

Description

**Describe the issue**
swagger or open api documentation document generation throws an error:
Unable to cast object of type 'System.Int32[]' to type 'System.String'

**To Reproduce**
Steps to reproduce the behavior:
1. add attribute
[OpenApiProperty(Default = new int[] { 2, 3 }, Description = "list", Deprecated = false)]
2. swagger.json or openapi.yaml generations fail

**Expected behavior**
documentation document is generated without issues

Contributor guide

Open the contributing guide

Research direction

Start by reproducing swagger.json or openapi.yaml generation with the shown OpenApiProperty attribute and trace where the Int32[] default is converted during document generation. Done means the example generates documentation without the cast-to-String error, while preserving the default array value.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, openapi
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.