Open wing328 opened 7 years ago
@wing328 Let me know if I have this correct. You just want to go back through for all of the tests and update petstore.yaml to petstore-with-fake-endpoints-models-for-testing.yaml for all of the .sh and .bat files correct?
Or do you only want it updated for the ones that can generate servers? e.g. node but not typescript-angular becauese that can only be a browser client lib not a server client lib.
@kenisteward this "issue" is for server generators only.
Alright I'll handle this. Should the list be updated to these? C# (ASP.NET Core, NancyFx), Erlang, Go, Haskell, Java (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, RestEasy), PHP (Lumen, Slim, Silex, Zend Expressive), Python (Flask), NodeJS, Ruby (Sinatra, Rails5), Scala (Finch, Scalatra)
Got them from the initial readme. Since you can't have an Typescript Angular server, however it might be possible to have an typescript-jquery server i just don't think we generate them.
@wing328 I've Done the first of the Servers as a part of #5595. Let me know if anything else needs changed
@kenisteward I've removed Typescript in the list. Thanks for pointing it out.
@wing328 I'm trying to update server Slim generator and spotted small issue:
Related endpoint in petstore-with-fake-endpoints-models-for-testing.yaml
:
get:
tags:
- fake
summary: To test enum parameters
description: To test enum parameters
operationId: testEnumParameters
consumes:
- "*/*"
produces:
- "*/*"
parameters:
Produces PHP syntax error:
/**
* GET testEnumParameters
* Summary: To test enum parameters
* Notes: To test enum parameters
* Output-Formats: [*/*]
*/
$app->GET('/v2/fake', function($request, $response, $args) {
Should I somehow escape */*
value inside SlimFrameworkServerCodegen.java
?
@wing328 I've updated Slim codegen and now */*
in comment escaped like this:
/**
* GET testEnumParameters
* Summary: To test enum parameters
* Notes: To test enum parameters
* Output-Formats: [*\/*]
*/
$app->GET('/v2/fake', function($request, $response, $args) {
Next I'm going to fix broken models:
<?php
/*
* $Special[modelName]
*/
namespace \Models;
/*
* $Special[modelName]
*/
class $Special[modelName] {
/* @var int $specialPropertyName */
private $specialPropertyName;
}
<?php
/*
* 200Response
*/
namespace \Models;
/*
* 200Response
*/
class 200Response {
/* @var int $name */
private $name;
/* @var string $class */
private $class;
}
There are also models with Return
and List
names which is keywords in PHP and cannot be used as class names.
What should I do with all these model names? Should I prefix them forcefully with something inside codegen? Should I strip special chars from model name $Special[modelName]
?
@wing328
Found pretty good implementation of toModelName
in PHPClientCodegen.java
and model names are solved now.
Slim Application Error:
Type: FastRoute\BadRouteException
Message: Static route "/v2/user/logout" is shadowed
by previously defined variable route "/v2/user/([^/]+)"
for method "GET"
If @edwd is right in topic above, we cannot sort route paths inside codegen. Maybe we need to throw warnings when routes overlaps.
Description
petstore-with-fake-endpoints-models-for-testing.yaml covers a lot more edge cases when comparing with the original one (petstore.yaml)
We'll need to to update petstore.yaml with petstore-with-fake-endpoints-models-for-testing.yaml so to ensure the edge cases are covered moving forward.
API servers using petstore-with-fake-endpoints-models-for-testing.yaml:
If anyone wants to work on the enhancement, please reply to let us know. Thank you!