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

Bugs fixing and minor improvements #37

Merged
merged 2 commits into from
Feb 25, 2014
Merged

Conversation

dayman
Copy link
Contributor

@dayman dayman commented Feb 19, 2014

ApiOperationParser

  1. A bug when we have @ApiOperation without "method" specified.
    Then value is taken from httpMethod (without trimming). As a result we get "POST ", which is not recognized by Swagger UI.
  2. A bug when we have @ApiOperation without "produces" or "consumes" specifed.
    Then code populates this arrays with "" value and then in Swagger UI we see "Produces: ['']"
  3. ApiError renamed to ApiResponse in code
  4. Validation logic partially moved to DocumentationOperation (as well as toScalaOperation())

ApiModelParser, ApiParserImpl
5. A bug with missing models.
Some of the models were ignored by parsing and Swagger UI had no ability to show them to user.
Models parsing logic was moved to ApiUtils class so that both of classes mentioned could use it.
In future, probably, it is better to merge this "model parsing logic" and remove baseModelPackage property, because it seems that this property is not necessary.
6. Work with Generics was improved. Code now correctly parses generic return types:
List -> List[SomeClass]
ContainerClass -> ContainerClass[InnerClass]

My Fork of Swagger UI renders such response types correctly
swagger-api/swagger-ui#401

Elements with only one generic would be processed.

Andrey Antonov added 2 commits February 19, 2014 18:13
ApiOperationParser
1. A bug when we have @ApiOperation without "method" specified.
  Then value is taken from httpMethod (without trimming). As a result we get "POST ", which is not recognized by Swagger UI.
2. A bug when we have @ApiOperation without "produces" or "consumes" specifed.
  Then code populates this arrays with "" value and then in Swagger UI we see "Produces: ['']"
3. ApiError renamed to ApiResponse in code
4. Validation logic partially moved to DocumentationOperation (as well as toScalaOperation())

ApiModelParser, ApiParserImpl
5. A bug with missing models.
  Some of the models were ignored by parsing and Swagger UI had no ability to show them to user.
  Models parsing logic was moved to ApiUtils class so that both of classes mentioned could use it.
  In future, probably, it is better to merge this "model parsing logic" and remove baseModelPackage property,
  because it seems that this property is not necessary.

6. Work with Generics was improved. Code now correctly parses generic return types:
  List<SomeClass> -> List[SomeClass]
  ContainerClass<InnerClass> -> ContainerClass[InnerClass]

  My Fork of Swagger UI renders such response types correctly
  swagger-api/swagger-ui#401

  Elements with only one generic would be processed.
…Type="form"). That caused crash in swagger-ui.

baseModelPackage and additionaModelPackages were removed since there were unnecessary.
All models are now adding on the go, that increased speed and amount of data sent to client (swagger ui).
@wkennedy
Copy link
Owner

These changes look good, dayman. Thanks!

wkennedy pushed a commit that referenced this pull request Feb 25, 2014
Bugs fixing and minor improvements
@wkennedy wkennedy merged commit 1fac516 into wkennedy:master Feb 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants