mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-19 07:07:11 +00:00
[Golang][client] delete sample output dir before rebuild (#477)
* delete Go client sample output dir before rebuild * purge go-petstore-withXml samples output dir before build * update samples * fix go-petstore-withxml.sh echo path
This commit is contained in:
@@ -25,6 +25,9 @@ then
|
||||
mvn -B clean package
|
||||
fi
|
||||
|
||||
echo "Removing files and folders under samples/client/petstore/go/go-petstore-withXml"
|
||||
rm -rf samples/client/petstore/go/go-petstore-withXml
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/go -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g go -o samples/client/petstore/go/go-petstore-withXml -DpackageName=petstore,withXml=true $@"
|
||||
|
||||
@@ -25,6 +25,9 @@ then
|
||||
mvn -B clean package
|
||||
fi
|
||||
|
||||
echo "Removing files and folders under samples/client/petstore/go/go-petstore"
|
||||
rm -rf samples/client/petstore/go/go-petstore
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/go -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g go -o samples/client/petstore/go/go-petstore -DpackageName=petstore $@"
|
||||
|
||||
@@ -35,6 +35,7 @@ Class | Method | HTTP request | Description
|
||||
*FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **Post** /fake/outer/composite |
|
||||
*FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **Post** /fake/outer/number |
|
||||
*FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **Post** /fake/outer/string |
|
||||
*FakeApi* | [**TestBodyWithFileSchema**](docs/FakeApi.md#testbodywithfileschema) | **Put** /fake/body-with-file-schema |
|
||||
*FakeApi* | [**TestBodyWithQueryParams**](docs/FakeApi.md#testbodywithqueryparams) | **Put** /fake/body-with-query-params |
|
||||
*FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **Patch** /fake | To test \"client\" model
|
||||
*FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **Post** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
@@ -83,6 +84,8 @@ Class | Method | HTTP request | Description
|
||||
- [EnumArrays](docs/EnumArrays.md)
|
||||
- [EnumClass](docs/EnumClass.md)
|
||||
- [EnumTest](docs/EnumTest.md)
|
||||
- [File](docs/File.md)
|
||||
- [FileSchemaTestClass](docs/FileSchemaTestClass.md)
|
||||
- [FormatTest](docs/FormatTest.md)
|
||||
- [HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
|
||||
- [List](docs/List.md)
|
||||
|
||||
@@ -973,6 +973,22 @@ paths:
|
||||
summary: To test special tags
|
||||
tags:
|
||||
- $another-fake?
|
||||
/fake/body-with-file-schema:
|
||||
put:
|
||||
description: For this test, the body for this request much reference a schema named `File`.
|
||||
operationId: testBodyWithFileSchema
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/FileSchemaTestClass'
|
||||
required: true
|
||||
responses:
|
||||
200:
|
||||
content: {}
|
||||
description: Success
|
||||
tags:
|
||||
- fake
|
||||
/fake/{petId}/uploadImageWithRequiredFile:
|
||||
post:
|
||||
operationId: uploadFileWithRequiredFile
|
||||
@@ -1413,6 +1429,21 @@ components:
|
||||
OuterBoolean:
|
||||
type: boolean
|
||||
x-codegen-body-parameter-name: boolean_post_body
|
||||
FileSchemaTestClass:
|
||||
example:
|
||||
file:
|
||||
sourceURI: sourceURI
|
||||
files:
|
||||
- sourceURI: sourceURI
|
||||
- sourceURI: sourceURI
|
||||
properties:
|
||||
file:
|
||||
$ref: '#/components/schemas/File'
|
||||
files:
|
||||
items:
|
||||
$ref: '#/components/schemas/File'
|
||||
type: array
|
||||
type: object
|
||||
Animal:
|
||||
discriminator:
|
||||
propertyName: className
|
||||
@@ -1475,6 +1506,14 @@ components:
|
||||
items:
|
||||
$ref: '#/components/schemas/Animal'
|
||||
type: array
|
||||
File:
|
||||
example:
|
||||
sourceURI: sourceURI
|
||||
properties:
|
||||
sourceURI:
|
||||
description: Test capitalization
|
||||
type: string
|
||||
type: object
|
||||
Pet:
|
||||
example:
|
||||
photoUrls:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -414,6 +414,73 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO
|
||||
return localVarReturnValue, localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/*
|
||||
FakeApiService
|
||||
For this test, the body for this request much reference a schema named `File`.
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
* @param fileSchemaTestClass
|
||||
*/
|
||||
func (a *FakeApiService) TestBodyWithFileSchema(ctx context.Context, fileSchemaTestClass FileSchemaTestClass) (*http.Response, error) {
|
||||
var (
|
||||
localVarHttpMethod = strings.ToUpper("Put")
|
||||
localVarPostBody interface{}
|
||||
localVarFileName string
|
||||
localVarFileBytes []byte
|
||||
)
|
||||
|
||||
// create path and map variables
|
||||
localVarPath := a.client.cfg.BasePath + "/fake/body-with-file-schema"
|
||||
|
||||
localVarHeaderParams := make(map[string]string)
|
||||
localVarQueryParams := url.Values{}
|
||||
localVarFormParams := url.Values{}
|
||||
|
||||
// to determine the Content-Type header
|
||||
localVarHttpContentTypes := []string{"application/json"}
|
||||
|
||||
// set Content-Type header
|
||||
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
||||
if localVarHttpContentType != "" {
|
||||
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
||||
}
|
||||
|
||||
// to determine the Accept header
|
||||
localVarHttpHeaderAccepts := []string{}
|
||||
|
||||
// set Accept header
|
||||
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
||||
if localVarHttpHeaderAccept != "" {
|
||||
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
||||
}
|
||||
// body params
|
||||
localVarPostBody = &fileSchemaTestClass
|
||||
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
localVarHttpResponse, err := a.client.callAPI(r)
|
||||
if err != nil || localVarHttpResponse == nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
||||
localVarHttpResponse.Body.Close()
|
||||
if err != nil {
|
||||
return localVarHttpResponse, err
|
||||
}
|
||||
|
||||
if localVarHttpResponse.StatusCode >= 300 {
|
||||
newErr := GenericOpenAPIError{
|
||||
body: localVarBody,
|
||||
error: localVarHttpResponse.Status,
|
||||
}
|
||||
return localVarHttpResponse, newErr
|
||||
}
|
||||
|
||||
return localVarHttpResponse, nil
|
||||
}
|
||||
|
||||
/*
|
||||
FakeApiService
|
||||
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
||||
|
||||
@@ -8,6 +8,7 @@ Method | HTTP request | Description
|
||||
[**FakeOuterCompositeSerialize**](FakeApi.md#FakeOuterCompositeSerialize) | **Post** /fake/outer/composite |
|
||||
[**FakeOuterNumberSerialize**](FakeApi.md#FakeOuterNumberSerialize) | **Post** /fake/outer/number |
|
||||
[**FakeOuterStringSerialize**](FakeApi.md#FakeOuterStringSerialize) | **Post** /fake/outer/string |
|
||||
[**TestBodyWithFileSchema**](FakeApi.md#TestBodyWithFileSchema) | **Put** /fake/body-with-file-schema |
|
||||
[**TestBodyWithQueryParams**](FakeApi.md#TestBodyWithQueryParams) | **Put** /fake/body-with-query-params |
|
||||
[**TestClientModel**](FakeApi.md#TestClientModel) | **Patch** /fake | To test \"client\" model
|
||||
[**TestEndpointParameters**](FakeApi.md#TestEndpointParameters) | **Post** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
@@ -38,7 +39,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Return type
|
||||
|
||||
**bool**
|
||||
[**bool**](boolean.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
@@ -108,7 +109,7 @@ Name | Type | Description | Notes
|
||||
|
||||
### Return type
|
||||
|
||||
**float32**
|
||||
[**float32**](number.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
@@ -156,6 +157,34 @@ No authorization required
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **TestBodyWithFileSchema**
|
||||
> TestBodyWithFileSchema(ctx, fileSchemaTestClass)
|
||||
|
||||
|
||||
For this test, the body for this request much reference a schema named `File`.
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
|
||||
**fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| |
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **TestBodyWithQueryParams**
|
||||
> TestBodyWithQueryParams(ctx, query, user)
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# OuterNumber
|
||||
# File
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**SourceURI** | **string** | Test capitalization | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
# OuterString
|
||||
# FileSchemaTestClass
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**File** | [**File**](File.md) | | [optional]
|
||||
**Files** | [**[]File**](File.md) | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
# ModelApiResponse
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Code** | **int32** | | [optional] [default to null]
|
||||
**Type_** | **string** | | [optional] [default to null]
|
||||
**Message** | **string** | | [optional] [default to null]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
# ModelReturn
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**Return_** | **int32** | | [optional] [default to null]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
# OuterBoolean
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
/*
|
||||
* Swagger Petstore
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* API version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package petstore
|
||||
|
||||
type OuterBoolean struct {
|
||||
type File struct {
|
||||
// Test capitalization
|
||||
SourceURI string `json:"sourceURI,omitempty" xml:"sourceURI"`
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* API version: 1.0.0
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package petstore
|
||||
|
||||
type FileSchemaTestClass struct {
|
||||
File File `json:"file,omitempty" xml:"file"`
|
||||
Files []File `json:"files,omitempty" xml:"files"`
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Swagger Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* API version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
|
||||
package petstore
|
||||
|
||||
type OuterNumber struct {
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
* Swagger Petstore
|
||||
*
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* API version: 1.0.0
|
||||
* Contact: apiteam@swagger.io
|
||||
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
||||
*/
|
||||
|
||||
package petstore
|
||||
|
||||
type OuterString struct {
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user