Skip to content

Commit

Permalink
add some tests
Browse files Browse the repository at this point in the history
added some tests to `modules/openapi-generator/src/test/resources/3_0/go/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml` and regenerated the samples
  • Loading branch information
tanmaykm committed Jul 30, 2024
1 parent 907f10c commit c8b07f7
Show file tree
Hide file tree
Showing 12 changed files with 1,139 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1233,6 +1233,22 @@ paths:
responses:
'200':
description: OK
/fake/deep_object_anyof_test:
get:
tags:
- fake
operationId: test_query_deep_object_anyof
parameters:
- name: filter
in: query
required: false
style: deepObject
schema:
$ref: '#/components/schemas/FilterAny'
explode: false
responses:
'200':
description: OK
/fake/parameter-name-mapping:
get:
tags:
Expand Down Expand Up @@ -1375,6 +1391,41 @@ components:
type: http
scheme: signature
schemas:
FilterTypeRegex:
type: object
properties:
type:
enum:
- set
- range
type: string
regex:
type: string
required:
- type
FilterTypeRange:
type: object
properties:
type:
enum:
- set
- range
type: string
data:
type: array
items:
type: string
required:
- type
FilterAny:
anyOf:
- $ref: '#/components/schemas/FilterTypeRegex'
- $ref: '#/components/schemas/FilterTypeRange'
discriminator:
mapping:
set: '#/components/schemas/FilterTypeRegex'
range: '#/components/schemas/FilterTypeRange'
propertyName: type
MapWithDateTime:
type: object
additionalProperties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ docs/FakeAPI.md
docs/FakeClassnameTags123API.md
docs/File.md
docs/FileSchemaTestClass.md
docs/FilterAny.md
docs/FilterTypeRange.md
docs/FilterTypeRegex.md
docs/Foo.md
docs/FooGetDefaultResponse.md
docs/FormatTest.md
Expand Down Expand Up @@ -116,6 +119,9 @@ model_enum_class.go
model_enum_test_.go
model_file.go
model_file_schema_test_class.go
model_filter_any.go
model_filter_type_range.go
model_filter_type_regex.go
model_foo.go
model_format_test_.go
model_fruit.go
Expand Down
4 changes: 4 additions & 0 deletions samples/openapi3/client/petstore/go/go-petstore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ Class | Method | HTTP request | Description
*FakeAPI* | [**TestInlineFreeformAdditionalProperties**](docs/FakeAPI.md#testinlinefreeformadditionalproperties) | **Post** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties
*FakeAPI* | [**TestJsonFormData**](docs/FakeAPI.md#testjsonformdata) | **Get** /fake/jsonFormData | test json serialization of form data
*FakeAPI* | [**TestQueryDeepObject**](docs/FakeAPI.md#testquerydeepobject) | **Get** /fake/deep_object_test |
*FakeAPI* | [**TestQueryDeepObjectAnyof**](docs/FakeAPI.md#testquerydeepobjectanyof) | **Get** /fake/deep_object_anyof_test |
*FakeAPI* | [**TestQueryParameterCollectionFormat**](docs/FakeAPI.md#testqueryparametercollectionformat) | **Put** /fake/test-query-parameters |
*FakeAPI* | [**TestStringMapReference**](docs/FakeAPI.md#teststringmapreference) | **Post** /fake/stringMap-reference | test referenced string map
*FakeAPI* | [**TestUniqueItemsHeaderAndQueryParameterCollectionFormat**](docs/FakeAPI.md#testuniqueitemsheaderandqueryparametercollectionformat) | **Put** /fake/test-unique-parameters |
Expand Down Expand Up @@ -153,6 +154,9 @@ Class | Method | HTTP request | Description
- [EnumTest](docs/EnumTest.md)
- [File](docs/File.md)
- [FileSchemaTestClass](docs/FileSchemaTestClass.md)
- [FilterAny](docs/FilterAny.md)
- [FilterTypeRange](docs/FilterTypeRange.md)
- [FilterTypeRegex](docs/FilterTypeRegex.md)
- [Foo](docs/Foo.md)
- [FooGetDefaultResponse](docs/FooGetDefaultResponse.md)
- [FormatTest](docs/FormatTest.md)
Expand Down
51 changes: 51 additions & 0 deletions samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,22 @@ paths:
description: OK
tags:
- fake
/fake/deep_object_anyof_test:
get:
operationId: test_query_deep_object_anyof
parameters:
- explode: false
in: query
name: filter
required: false
schema:
$ref: '#/components/schemas/FilterAny'
style: deepObject
responses:
"200":
description: OK
tags:
- fake
/fake/parameter-name-mapping:
get:
operationId: getParameterNameMapping
Expand Down Expand Up @@ -1278,6 +1294,41 @@ components:
description: Pet object that needs to be added to the store
required: true
schemas:
FilterTypeRegex:
properties:
type:
enum:
- set
- range
type: string
regex:
type: string
required:
- type
type: object
FilterTypeRange:
properties:
type:
enum:
- set
- range
type: string
data:
items:
type: string
type: array
required:
- type
type: object
FilterAny:
anyOf:
- $ref: '#/components/schemas/FilterTypeRegex'
- $ref: '#/components/schemas/FilterTypeRange'
discriminator:
mapping:
set: '#/components/schemas/FilterTypeRegex'
range: '#/components/schemas/FilterTypeRange'
propertyName: type
MapWithDateTime:
additionalProperties:
items:
Expand Down
106 changes: 106 additions & 0 deletions samples/openapi3/client/petstore/go/go-petstore/api_fake.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 63 additions & 0 deletions samples/openapi3/client/petstore/go/go-petstore/docs/FakeAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Method | HTTP request | Description
[**TestInlineFreeformAdditionalProperties**](FakeAPI.md#TestInlineFreeformAdditionalProperties) | **Post** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties
[**TestJsonFormData**](FakeAPI.md#TestJsonFormData) | **Get** /fake/jsonFormData | test json serialization of form data
[**TestQueryDeepObject**](FakeAPI.md#TestQueryDeepObject) | **Get** /fake/deep_object_test |
[**TestQueryDeepObjectAnyof**](FakeAPI.md#TestQueryDeepObjectAnyof) | **Get** /fake/deep_object_anyof_test |
[**TestQueryParameterCollectionFormat**](FakeAPI.md#TestQueryParameterCollectionFormat) | **Put** /fake/test-query-parameters |
[**TestStringMapReference**](FakeAPI.md#TestStringMapReference) | **Post** /fake/stringMap-reference | test referenced string map
[**TestUniqueItemsHeaderAndQueryParameterCollectionFormat**](FakeAPI.md#TestUniqueItemsHeaderAndQueryParameterCollectionFormat) | **Put** /fake/test-unique-parameters |
Expand Down Expand Up @@ -1177,6 +1178,68 @@ No authorization required
[[Back to README]](../README.md)


## TestQueryDeepObjectAnyof

> TestQueryDeepObjectAnyof(ctx).Filter(filter).Execute()


### Example

```go
package main

import (
"context"
"fmt"
"os"
openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
)

func main() {
filter := *openapiclient.NewFilterAny("Type_example") // FilterAny | (optional)

configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
r, err := apiClient.FakeAPI.TestQueryDeepObjectAnyof(context.Background()).Filter(filter).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `FakeAPI.TestQueryDeepObjectAnyof``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```

### Path Parameters



### Other Parameters

Other parameters are passed through a pointer to a apiTestQueryDeepObjectAnyofRequest struct via the builder pattern


Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**filter** | [**FilterAny**](FilterAny.md) | |

### Return type

(empty response body)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **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)


## TestQueryParameterCollectionFormat

> TestQueryParameterCollectionFormat(ctx).Pipe(pipe).Ioutil(ioutil).Http(http).Url(url).Context(context).Execute()
Expand Down
Loading

0 comments on commit c8b07f7

Please sign in to comment.