Skip to content

Commit

Permalink
add separate tests for openapi-generator (#45)
Browse files Browse the repository at this point in the history
The openapi-generator repo uses a slightly separate spec for Petstore.
It is best to have a separate set of tests for that.
  • Loading branch information
tanmaykm authored Jul 23, 2023
1 parent f0ce7e1 commit 00fc01f
Show file tree
Hide file tree
Showing 59 changed files with 5,567 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ keywords = ["Swagger", "OpenAPI", "REST"]
license = "MIT"
desc = "OpenAPI server and client helper for Julia"
authors = ["JuliaHub Inc."]
version = "0.1.13"
version = "0.1.14"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down
7 changes: 7 additions & 0 deletions test/client/openapigenerator_petstore_v3/generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
java -jar openapi-generator-cli.jar generate \
-i ../../specs/openapigenerator_petstore_v3.json \
-g julia-client \
-o petstore \
--additional-properties=packageName=OpenAPIGenPetStoreClient \
--additional-properties=exportModels=true \
--additional-properties=exportOperations=true
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
README.md
docs/ApiResponse.md
docs/Category.md
docs/Order.md
docs/Pet.md
docs/PetApi.md
docs/StoreApi.md
docs/Tag.md
docs/User.md
docs/UserApi.md
src/OpenAPIGenPetStoreClient.jl
src/apis/api_PetApi.jl
src/apis/api_StoreApi.jl
src/apis/api_UserApi.jl
src/modelincludes.jl
src/models/model_ApiResponse.jl
src/models/model_Category.jl
src/models/model_Order.jl
src/models/model_Pet.jl
src/models/model_Tag.jl
src/models/model_User.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.0.0-SNAPSHOT
95 changes: 95 additions & 0 deletions test/client/openapigenerator_petstore_v3/petstore/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Julia API client for OpenAPIGenPetStoreClient

This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.

## Overview
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.

- API version: 1.0.0
- Build package: org.openapitools.codegen.languages.JuliaClientCodegen


## Installation
Place the Julia files generated under the `src` folder in your Julia project. Include OpenAPIGenPetStoreClient.jl in the project code.
It would include the module named OpenAPIGenPetStoreClient.

Documentation is generated as markdown files under the `docs` folder. You can include them in your project documentation.
Documentation is also embedded in Julia which can be used with a Julia specific documentation generator.

## API Endpoints

Class | Method
------------ | -------------
*PetApi* | [**add_pet**](docs/PetApi.md#add_pet)<br/>**POST** /pet<br/>Add a new pet to the store
*PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet)<br/>**DELETE** /pet/{petId}<br/>Deletes a pet
*PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status)<br/>**GET** /pet/findByStatus<br/>Finds Pets by status
*PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags)<br/>**GET** /pet/findByTags<br/>Finds Pets by tags
*PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id)<br/>**GET** /pet/{petId}<br/>Find pet by ID
*PetApi* | [**update_pet**](docs/PetApi.md#update_pet)<br/>**PUT** /pet<br/>Update an existing pet
*PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form)<br/>**POST** /pet/{petId}<br/>Updates a pet in the store with form data
*PetApi* | [**upload_file**](docs/PetApi.md#upload_file)<br/>**POST** /pet/{petId}/uploadImage<br/>uploads an image
*StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order)<br/>**DELETE** /store/order/{orderId}<br/>Delete purchase order by ID
*StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory)<br/>**GET** /store/inventory<br/>Returns pet inventories by status
*StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id)<br/>**GET** /store/order/{orderId}<br/>Find purchase order by ID
*StoreApi* | [**place_order**](docs/StoreApi.md#place_order)<br/>**POST** /store/order<br/>Place an order for a pet
*UserApi* | [**create_user**](docs/UserApi.md#create_user)<br/>**POST** /user<br/>Create user
*UserApi* | [**create_users_with_array_input**](docs/UserApi.md#create_users_with_array_input)<br/>**POST** /user/createWithArray<br/>Creates list of users with given input array
*UserApi* | [**create_users_with_list_input**](docs/UserApi.md#create_users_with_list_input)<br/>**POST** /user/createWithList<br/>Creates list of users with given input array
*UserApi* | [**delete_user**](docs/UserApi.md#delete_user)<br/>**DELETE** /user/{username}<br/>Delete user
*UserApi* | [**get_user_by_name**](docs/UserApi.md#get_user_by_name)<br/>**GET** /user/{username}<br/>Get user by user name
*UserApi* | [**login_user**](docs/UserApi.md#login_user)<br/>**GET** /user/login<br/>Logs user into the system
*UserApi* | [**logout_user**](docs/UserApi.md#logout_user)<br/>**GET** /user/logout<br/>Logs out current logged in user session
*UserApi* | [**update_user**](docs/UserApi.md#update_user)<br/>**PUT** /user/{username}<br/>Updated user


## Models

- [ApiResponse](docs/ApiResponse.md)
- [Category](docs/Category.md)
- [Order](docs/Order.md)
- [Pet](docs/Pet.md)
- [Tag](docs/Tag.md)
- [User](docs/User.md)


<a id="authorization"></a>
## Authorization

Authentication schemes defined for the API:
<a id="petstore_auth"></a>
### petstore_auth
- **Type**: OAuth
- **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- **read:pets**: read your pets
- **write:pets**: modify pets in your account

Example
```
using OpenAPI
using OpenAPI.Clients
import OpenAPI.Clients: Client, set_header
client = Client(server_uri)
set_header(client, "Authorization", "Bearer $bearer_auth")
api = MyApi(client)
result = callApi(api, args...; api_key)
```
<a id="api_key"></a>
### api_key
- **Type**: API key

Example
```
using OpenAPI
using OpenAPI.Clients
import OpenAPI.Clients: Client
client = Client(server_uri)
api = MyApi(client)
result = callApi(api, args...; api_key)
```

## Author



Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# ApiResponse


## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**message** | **String** | | [optional] [default to nothing]
**code** | **Int64** | | [optional] [default to nothing]
**type** | **String** | | [optional] [default to nothing]


[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md)


13 changes: 13 additions & 0 deletions test/client/openapigenerator_petstore_v3/petstore/docs/Category.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Category


## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | | [optional] [default to nothing]
**id** | **Int64** | | [optional] [default to nothing]


[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md)


17 changes: 17 additions & 0 deletions test/client/openapigenerator_petstore_v3/petstore/docs/Order.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Order


## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**petId** | **Int64** | | [optional] [default to nothing]
**shipDate** | **ZonedDateTime** | | [optional] [default to nothing]
**status** | **String** | Order Status | [optional] [default to nothing]
**id** | **Int64** | | [optional] [default to nothing]
**complete** | **Bool** | | [optional] [default to false]
**quantity** | **Int64** | | [optional] [default to nothing]


[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md)


17 changes: 17 additions & 0 deletions test/client/openapigenerator_petstore_v3/petstore/docs/Pet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Pet


## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | | [default to nothing]
**status** | **String** | pet status in the store | [optional] [default to nothing]
**id** | **Int64** | | [optional] [default to nothing]
**photoUrls** | **Vector{String}** | | [default to nothing]
**tags** | [**Vector{Tag}**](Tag.md) | | [optional] [default to nothing]
**category** | [***Category**](Category.md) | | [optional] [default to nothing]


[[Back to Model list]](../README.md#models) [[Back to API list]](../README.md#api-endpoints) [[Back to README]](../README.md)


Loading

2 comments on commit 00fc01f

@tanmaykm
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/88114

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.14 -m "<description of version>" 00fc01fc844e800ac8d0a8505ef9ead03279d96c
git push origin v0.1.14

Please sign in to comment.