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

Add auto-generated doc to Swift4 generator #2666

Merged
merged 9 commits into from Apr 16, 2019
Merged

Add auto-generated doc to Swift4 generator #2666

merged 9 commits into from Apr 16, 2019

Conversation

wing328
Copy link
Member

@wing328 wing328 commented Apr 15, 2019

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh, ./bin/openapi3/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: master, 3.4.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

Add auto-generated documentation (README, API doc, model doc) to Swift4 generator

@jgavris (2017/07) @ehyche (2017/08) @Edubits (2017/09) @jaz-ah (2017/09) @d-date (2018/03)

Copy link
Contributor

@d-date d-date left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

// the following code samples are still beta. If you notice any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new
import PetstoreClient

let body = Order(123, 123, 123, "TODO", "status_example", 123) // Order | order placed for purchasing the pet
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • The initializer should have labels for parameters.
  • It looks Bool turns Int, should be true or false.

As is:

let body = Order(123, 123, 123, "TODO", "status_example", 123)

Ideal:

let body = Order(id: 123, petId: 123, quantity: 123, shipDate: "TODO", status: "status_example", complete: true)

}
{{/usePromiseKit}}
{{#useRxSwift}}
// TODO rxswift sample code. To contribute, please open a ticket via http://github.com/OpenAPITools/openapi-generator/issues/new
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If indent is not match, please indent with 4 spaces

Suggested change
// TODO rxswift sample code. To contribute, please open a ticket via http://github.com/OpenAPITools/openapi-generator/issues/new
{{#summary}}// {{{.}}}
{{/summary}}{{classname}}.{{{operationId}}}({{#allParams}}{{paramName}}: {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}).subscribe(onNext: {
// when request is on success
}, onError: { error in
// when request was failed with error
}).disposed(by: disposeBag)
}

**float** | **Float** | | [optional]
**double** | **Double** | | [optional]
**string** | **String** | | [optional]
**byte** | [**Data**](Data.md) | |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data is standard struct in Swift.

**double** | **Double** | | [optional]
**string** | **String** | | [optional]
**byte** | [**Data**](Data.md) | |
**binary** | [**URL**](URL.md) | | [optional]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

URL is standard struct in Swift

**string** | **String** | | [optional]
**byte** | [**Data**](Data.md) | |
**binary** | [**URL**](URL.md) | | [optional]
**date** | [**Date**](Date.md) | |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Date is standard struct in Swift

**byte** | [**Data**](Data.md) | |
**binary** | [**URL**](URL.md) | | [optional]
**date** | [**Date**](Date.md) | |
**dateTime** | [**Date**](Date.md) | | [optional]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

**binary** | [**URL**](URL.md) | | [optional]
**date** | [**Date**](Date.md) | |
**dateTime** | [**Date**](Date.md) | | [optional]
**uuid** | [**UUID**](UUID.md) | | [optional]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UUID is struct in Foundation, no need to reference.

**mapArrayAnytype** | [**[String:[Any]]**](Array.md) | | [optional]
**mapMapString** | [**[String:[String:String]]**](Dictionary.md) | | [optional]
**mapMapAnytype** | [**[String:[String:Any]]**](Dictionary.md) | | [optional]
**anytype1** | [**Any**](.md) | | [optional]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any is primitive type in Swift

------------ | ------------- | ------------- | -------------
**arrayOfString** | **[String]** | | [optional]
**arrayArrayOfInteger** | [**[[Int64]]**](Array.md) | | [optional]
**arrayArrayOfModel** | [**[[ReadOnlyFirst]]**](Array.md) | | [optional]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not refer to Array.md, but ReadOnlyFirst.md.


Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트

Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it correct to be printed out same comments?

**int64** | **Int64**| None | [optional]
**float** | **Float**| None | [optional]
**string** | **String**| None | [optional]
**binary** | **URL****URL**| None | [optional]
Copy link
Contributor

@d-date d-date Apr 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

**URL****URL** should be **URL**


Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**param** | [**[String:String]**](String.md)| request body |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String.md should not be refer.

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**param** | **String**| field1 |
**param2** | **String**| field2 |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[NIT] should have space after **String**

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**mapString** | **[String:String]** | | [optional]
**mapMapString** | [**[String:[String:String]]**](Dictionary.md) | | [optional]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not refer Dictionary.md

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**arrayArrayNumber** | [**[[Double]]**](Array.md) | | [optional]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not refer Array.md

------------ | ------------- | ------------- | -------------
**arrayOfString** | **[String]** | | [optional]
**arrayArrayOfInteger** | [**[[Int64]]**](Array.md) | | [optional]
**arrayArrayOfModel** | [**[[ReadOnlyFirst]]**](Array.md) | | [optional]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Array.md


# **fakeOuterBooleanSerialize**
```swift
open class func fakeOuterBooleanSerialize( body: Bool? = nil) -> Promise<Bool>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[NIT] should be removed space before parameter

let int64 = 987 // Int64 | None (optional)
let float = 987 // Float | None (optional)
let string = "string_example" // String | None (optional)
let binary = "TODO" // URL | None (optional)
Copy link
Contributor

@d-date d-date Apr 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

URL example is like below. String should be more exampled.

let binary = URL(string: "https://example.com")!

let float = 987 // Float | None (optional)
let string = "string_example" // String | None (optional)
let binary = "TODO" // URL | None (optional)
let date = TODO // Date | None (optional)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Date example is like below.

let date = Date() // means now.

let string = "string_example" // String | None (optional)
let binary = "TODO" // URL | None (optional)
let date = TODO // Date | None (optional)
let dateTime = TODO // Date | None (optional)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Datetime is also.

let datetime = Date() // means now.


Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**param** | [**[String:String]**](String.md)| request body |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String.md)


### Return type

void (empty response body)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type name void should be capitalized Void .


To test class name in snake case

To test class name in snake case
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think some pattern has duplicated comments


# **getOrderById**
```swift
open class func getOrderById(orderId: Int64, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be

  • single bracket for closure
  • [NIT] need space after comma
open class func getOrderById(orderId: Int64, completion: @escaping (_ data: Order?, _ error: Error?) -> Void)

@d-date
Copy link
Contributor

d-date commented Apr 15, 2019

I believe that all for review, but if you need to be more checked, let me know.

@wing328
Copy link
Member Author

wing328 commented Apr 16, 2019

Thanks for the review 👍

Let me fix those.

@wing328
Copy link
Member Author

wing328 commented Apr 16, 2019

I should have fixed most if not all of the reviews.

About the duplicated description, it's due to both summary and notes set to the same description text.

@wing328
Copy link
Member Author

wing328 commented Apr 16, 2019

Let's go with this one and we can always submit another PR to further improve the doc.

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

Successfully merging this pull request may close these issues.

None yet

2 participants