marshmallow-code / marshmallow-code/apispec
Generating labels of validate.OneOf(labels=[..]) in the json schema
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 202
- Avg merge
- 3h 38m
- Merged PRs (30d)
- 3
Description
Hi,
I have the following field in marshmallow:
```python
the_field = fields.Integer(validate=[validate.OneOf([1, 2, 3], labels=['one', 'two', 'three'])])
```
And the resulting json:
```
"the_field": {
"type": "integer",
"enum": [
1,
2,
3
]
}
```
Is there a way to also print the labels `['one', 'two', 'three']` in the json ?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is named in the issue. Start by locating the schema-generation path that handles marshmallow validate.OneOf and compare its current enum output with the requested labels; done means the generated JSON schema represents the labels as intended and existing behavior remains covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, python
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100