Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade API server integration tests to use Fake Petstore spec #5419 #5420

Open
12 tasks
wing328 opened this issue Apr 19, 2017 · 8 comments
Open
12 tasks

Upgrade API server integration tests to use Fake Petstore spec #5419 #5420

wing328 opened this issue Apr 19, 2017 · 8 comments

Comments

@wing328
Copy link
Contributor

wing328 commented Apr 19, 2017

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:

  • C# (NancyFx, ASP.net Core)
  • Elixir
  • Erlang
  • Go
  • Haskell Servant
  • JavaScript/NodeJS
  • Java (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, RestEasy)
  • PHP (Lumen, Slim, Silex, Zend Expressive)
  • Python Flask
  • Ruby (Sinatra, Rails)
  • Scala Finch
  • Scala Scalatra

If anyone wants to work on the enhancement, please reply to let us know. Thank you!

@kenisteward
Copy link
Contributor

@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.

@wing328
Copy link
Contributor Author

wing328 commented May 9, 2017

@kenisteward this "issue" is for server generators only.

@kenisteward
Copy link
Contributor

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.

@kenisteward
Copy link
Contributor

@wing328 I've Done the first of the Servers as a part of #5595. Let me know if anything else needs changed

@wing328
Copy link
Contributor Author

wing328 commented May 17, 2017

@kenisteward I've removed Typescript in the list. Thanks for pointing it out.

@ybelenko
Copy link

ybelenko commented Jun 8, 2018

@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?

@ybelenko
Copy link

@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]?

@ybelenko
Copy link

@wing328
Found pretty good implementation of toModelName in PHPClientCodegen.java and model names are solved now.

#7698 issue appeares:

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment