OpenAPITools / OpenAPITools/openapi-generator
PHP model field validation broken on oneOf
Open
Nobody has claimed this yet.
Issue: Bug
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
bar:
properties:
field:
type: string
enum: [a,b]
ray:
properties:
field:
type: string
enum: [c,d]
MyObject:
properties:
foo:
type: array
items:
oneOf:
- $ref: '#/components/schemas/bar'
- $ref: '#/components/schemas/ray'
```
ObjectSerializer::deserialize (src/Http/ObjectSerializer.php:478) fails:
getFieldAllowableValues & getOperatorAllowableValues do not combine all options and validation fails.
It instead only uses enum values from the last item (ray) for validation
##### openapi-generator version
Latest
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
Start at src/Http/ObjectSerializer.php:478 and inspect getFieldAllowableValues and getOperatorAllowableValues during deserialization of the shown oneOf array schema. Reproduce validation with bar and ray, then verify that allowable enum values from both options are accepted rather than only ray's values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, php
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100