Skip to content

Commit 512cb75

Browse files
authored
add tests for timeout handling (#74)
Adding some tests for timeout handling. Also tests the use of `OpenAPI.Clients.with_timeout` method provided to invoke OpenAPI client side APIs with a timeout value.
1 parent 6c820c5 commit 512cb75

26 files changed

+647
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.openapi-generator-ignore
2+
README.md
3+
docs/DefaultApi.md
4+
docs/DelayresponseGet200Response.md
5+
src/TimeoutTestClient.jl
6+
src/apis/api_DefaultApi.jl
7+
src/modelincludes.jl
8+
src/models/model_DelayresponseGet200Response.jl
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.2.0
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Julia API client for TimeoutTestClient
2+
3+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4+
5+
## Overview
6+
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client.
7+
8+
- API version: 1.0.0
9+
- Build package: org.openapitools.codegen.languages.JuliaClientCodegen
10+
11+
12+
## Installation
13+
Place the Julia files generated under the `src` folder in your Julia project. Include TimeoutTestClient.jl in the project code.
14+
It would include the module named TimeoutTestClient.
15+
16+
Documentation is generated as markdown files under the `docs` folder. You can include them in your project documentation.
17+
Documentation is also embedded in Julia which can be used with a Julia specific documentation generator.
18+
19+
## API Endpoints
20+
21+
Class | Method
22+
------------ | -------------
23+
*DefaultApi* | [**delayresponse_get**](docs/DefaultApi.md#delayresponse_get)<br/>**GET** /delayresponse<br/>Delay Response Endpoint
24+
25+
26+
## Models
27+
28+
- [DelayresponseGet200Response](docs/DelayresponseGet200Response.md)
29+
30+
31+
<a id="authorization"></a>
32+
## Authorization
33+
Endpoints do not require authorization.
34+
35+
36+
## Author
37+
38+
39+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# DefaultApi
2+
3+
All URIs are relative to *http://localhost*
4+
5+
Method | HTTP request | Description
6+
------------- | ------------- | -------------
7+
[**delayresponse_get**](DefaultApi.md#delayresponse_get) | **GET** /delayresponse | Delay Response Endpoint
8+
9+
10+
# **delayresponse_get**
11+
> delayresponse_get(_api::DefaultApi, delay_seconds::Int64; _mediaType=nothing) -> DelayresponseGet200Response, OpenAPI.Clients.ApiResponse <br/>
12+
> delayresponse_get(_api::DefaultApi, response_stream::Channel, delay_seconds::Int64; _mediaType=nothing) -> Channel{ DelayresponseGet200Response }, OpenAPI.Clients.ApiResponse
13+
14+
Delay Response Endpoint
15+
16+
### Required Parameters
17+
18+
Name | Type | Description | Notes
19+
------------- | ------------- | ------------- | -------------
20+
**_api** | **DefaultApi** | API context |
21+
**delay_seconds** | **Int64**| Number of seconds to delay the response | [default to nothing]
22+
23+
### Return type
24+
25+
[**DelayresponseGet200Response**](DelayresponseGet200Response.md)
26+
27+
### Authorization
28+
29+
No authorization required
30+
31+
### HTTP request headers
32+
33+
- **Content-Type**: Not defined
34+
- **Accept**: application/json
35+
36+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
37+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# DelayresponseGet200Response
2+
3+
4+
## Properties
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**delay_seconds** | **String** | | [optional] [default to nothing]
8+
9+
10+
[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md)
11+
12+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This file was generated by the Julia OpenAPI Code Generator
2+
# Do not modify this file directly. Modify the OpenAPI specification instead.
3+
4+
module TimeoutTestClient
5+
6+
using Dates, TimeZones
7+
using OpenAPI
8+
using OpenAPI.Clients
9+
10+
const API_VERSION = "1.0.0"
11+
12+
include("modelincludes.jl")
13+
14+
include("apis/api_DefaultApi.jl")
15+
16+
end # module TimeoutTestClient
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This file was generated by the Julia OpenAPI Code Generator
2+
# Do not modify this file directly. Modify the OpenAPI specification instead.
3+
4+
struct DefaultApi <: OpenAPI.APIClientImpl
5+
client::OpenAPI.Clients.Client
6+
end
7+
8+
"""
9+
The default API base path for APIs in `DefaultApi`.
10+
This can be used to construct the `OpenAPI.Clients.Client` instance.
11+
"""
12+
basepath(::Type{ DefaultApi }) = "http://localhost"
13+
14+
const _returntypes_delayresponse_get_DefaultApi = Dict{Regex,Type}(
15+
Regex("^" * replace("200", "x"=>".") * "\$") => DelayresponseGet200Response,
16+
)
17+
18+
function _oacinternal_delayresponse_get(_api::DefaultApi, delay_seconds::Int64; _mediaType=nothing)
19+
OpenAPI.validate_param("delay_seconds", "delayresponse_get", :minimum, delay_seconds, 0, false)
20+
21+
_ctx = OpenAPI.Clients.Ctx(_api.client, "GET", _returntypes_delayresponse_get_DefaultApi, "/delayresponse", [])
22+
OpenAPI.Clients.set_param(_ctx.query, "delay_seconds", delay_seconds) # type Int64
23+
OpenAPI.Clients.set_header_accept(_ctx, ["application/json", ])
24+
OpenAPI.Clients.set_header_content_type(_ctx, (_mediaType === nothing) ? [] : [_mediaType])
25+
return _ctx
26+
end
27+
28+
@doc raw"""Delay Response Endpoint
29+
30+
Params:
31+
- delay_seconds::Int64 (required)
32+
33+
Return: DelayresponseGet200Response, OpenAPI.Clients.ApiResponse
34+
"""
35+
function delayresponse_get(_api::DefaultApi, delay_seconds::Int64; _mediaType=nothing)
36+
_ctx = _oacinternal_delayresponse_get(_api, delay_seconds; _mediaType=_mediaType)
37+
return OpenAPI.Clients.exec(_ctx)
38+
end
39+
40+
function delayresponse_get(_api::DefaultApi, response_stream::Channel, delay_seconds::Int64; _mediaType=nothing)
41+
_ctx = _oacinternal_delayresponse_get(_api, delay_seconds; _mediaType=_mediaType)
42+
return OpenAPI.Clients.exec(_ctx, response_stream)
43+
end
44+
45+
export delayresponse_get
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# This file was generated by the Julia OpenAPI Code Generator
2+
# Do not modify this file directly. Modify the OpenAPI specification instead.
3+
4+
include("models/model_DelayresponseGet200Response.jl")
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This file was generated by the Julia OpenAPI Code Generator
2+
# Do not modify this file directly. Modify the OpenAPI specification instead.
3+
4+
5+
@doc raw"""_delayresponse_get_200_response
6+
7+
DelayresponseGet200Response(;
8+
delay_seconds=nothing,
9+
)
10+
11+
- delay_seconds::String
12+
"""
13+
Base.@kwdef mutable struct DelayresponseGet200Response <: OpenAPI.APIModel
14+
delay_seconds::Union{Nothing, String} = nothing
15+
16+
function DelayresponseGet200Response(delay_seconds, )
17+
OpenAPI.validate_property(DelayresponseGet200Response, Symbol("delay_seconds"), delay_seconds)
18+
return new(delay_seconds, )
19+
end
20+
end # type DelayresponseGet200Response
21+
22+
const _property_types_DelayresponseGet200Response = Dict{Symbol,String}(Symbol("delay_seconds")=>"String", )
23+
OpenAPI.property_type(::Type{ DelayresponseGet200Response }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_DelayresponseGet200Response[name]))}
24+
25+
function check_required(o::DelayresponseGet200Response)
26+
true
27+
end
28+
29+
function OpenAPI.validate_property(::Type{ DelayresponseGet200Response }, name::Symbol, val)
30+
end

0 commit comments

Comments
 (0)