Optional relation incorrectly mapped on JsonResource #978
Unanswered
apasquini95
asked this question in
Q&A
Replies: 1 comment
-
|
@apasquini95 Seems like Scramble is not aware of Do you think you want to create a PR for this? This should be a simple one. The only difference with |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone, I'm having an issue with a model's JsonResource while mapping an optional relation. These are the models:
Once I configure the
MyModelResourceoptionally adding a field representing thevalueproperty of an optional related model, the generated openapi specification fallbacks tostringinstead ofinteger:{ "components": { "schemas": { "MyModelResource": { "type": "object", "properties": { "id": { "type": "integer" }, "related": { "type": "string" // <-- Why is this string? } }, "required": [ "id" ], "title": "MyModelResource" } } } }Obviously if I explicitly declare the type with a phpdoc it works, but I wondered if there's a way to make this automatic:
Am I missing something?
For this purpose I created a branch for reproduction in this repository:
https://github.com/apasquini95/demo_scramble/tree/optional_relation_resource_property
Beta Was this translation helpful? Give feedback.
All reactions