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.
I've spend some time under php mock server #3545
At first I analyzed current PHP client implementation. It uses flatten data type declarations, eg string[]. It would be enough for a Mock server, but it doesn't help with automatic request validation. Let's look at the example:
In current implementation this property will be described as:
/** @var string[] $imageUrls */$imageUrls = [];
As a result we lost minItems, format, minLength and maxLength declarations. It makes automatic request validation impossible. It's obvious that we need all the props to check request under all requirements. The only way I see it we need to serialize all request parameters into PHP arrays. So the model above will look like:
I think there should be method in AbstractPhpCodegen to convert Java Map/List instance into PHP array. Then I can convert parameters into PHP strings and add them to codegen, then use it in templates like $parameters = {{serializedParameters}};. Maybe this function/helper can be useful in other cases which I don't even realize yet.
Describe alternatives you've considered
If there is built-in Java method to convert any Java Map/List into PHP string definition please correct me.
This issue can be closed, but I want a feedback from PHP templates creators. Do we need a function that converts Java map to valid PHP array string or not? Eg. {"foobar": "Hello World!"} transforms to ["foobar" => "Hello World!"]
Is your feature request related to a problem? Please describe.
I've spend some time under php mock server #3545
At first I analyzed current PHP client implementation. It uses flatten data type declarations, eg
string[]
. It would be enough for a Mock server, but it doesn't help with automatic request validation. Let's look at the example:In current implementation this property will be described as:
As a result we lost
minItems
,format
,minLength
andmaxLength
declarations. It makes automatic request validation impossible. It's obvious that we need all the props to check request under all requirements. The only way I see it we need to serialize all request parameters into PHP arrays. So the model above will look like:Describe the solution you'd like
I think there should be method in
AbstractPhpCodegen
to convert Java Map/List instance into PHP array. Then I can convert parameters into PHP strings and add them to codegen, then use it in templates like$parameters = {{serializedParameters}};
. Maybe this function/helper can be useful in other cases which I don't even realize yet.Describe alternatives you've considered
If there is built-in Java method to convert any Java Map/List into PHP string definition please correct me.
cc @jebentier, @dkarlovi, @mandrean, @jfastnacht, @ackintosh, @renepardon
The text was updated successfully, but these errors were encountered: