cloudflare / cloudflare/chanfana

Set example values of bodyRequest, or any field, without setting default?

Open
#149 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
766
Forks
70
Avg merge
25m
Merged PRs (30d)
4

Description

For Swagger UI it's really neat to have example to run trough your API, as of right now this allows to make use of them via the .default() method, is there already any way of setting the example field specifically, the new BodyRequest does not support it. Could it be implement?

Contributor guide

Open the contributing guide

Research direction

Start by tracing the BodyRequest implementation and the existing default() handling in the schema generation path. Check how generated OpenAPI data is consumed by Swagger UI; the work is done when a body field can define an example independently of a default value and that example appears in the generated API documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
api
Issue type
Feature
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.