You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
The generator output for a oneOf could be improved. I need properly typed models for each oneOf case. However, right now it seems to generate an object containing all possible properties.
The php-laravel generator generates something like:
class FormElementsGet200ResponseInner {
publicfunction__construct(
public\OpenAPI\Server\Model\RadioElementType$type,
publicstring$placeholder,
publicarray$options,
) {}
Where I would expect something more along the lines of e.g. the typescript-fetch generator:
exporttypeFormElementsGet200ResponseInner=RadioElement|TextElement;exportfunctionFormElementsGet200ResponseInnerFromJSON(json: any): FormElementsGet200ResponseInner{returnFormElementsGet200ResponseInnerFromJSONTyped(json,false);}// .. other stuff
In addition I believe the \OpenAPI\Server\Model\RadioElementType in the constructor to be incorrect, as its type could also be TextElementType.
Describe the solution you'd like
I would like to extend support for at least oneOf in the php-laravel generator, so that the oneOf generates a proper set of models.
The generated code should be more usable that way. I would assume that fixing anyOf and allOf would be trivial once oneOf is working correctly.
Describe alternatives you've considered
I considered using the type as-is and creating the discriminator logic in my specific application, but I think it would be better to adapt the generator to be more precise.
Additional context
Requesting feedback here to check if the solution follows the general idea, before working on a PR. Would appreciate feedback
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
The generator output for a oneOf could be improved. I need properly typed models for each oneOf case. However, right now it seems to generate an object containing all possible properties.
Given this (minimal) example:
The php-laravel generator generates something like:
Where I would expect something more along the lines of e.g. the typescript-fetch generator:
In addition I believe the \OpenAPI\Server\Model\RadioElementType in the constructor to be incorrect, as its type could also be TextElementType.
Describe the solution you'd like
I would like to extend support for at least oneOf in the
php-laravel
generator, so that the oneOf generates a proper set of models.The generated code should be more usable that way. I would assume that fixing anyOf and allOf would be trivial once oneOf is working correctly.
Describe alternatives you've considered
I considered using the type as-is and creating the discriminator logic in my specific application, but I think it would be better to adapt the generator to be more precise.
Additional context
Requesting feedback here to check if the solution follows the general idea, before working on a PR. Would appreciate feedback
The text was updated successfully, but these errors were encountered: