Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,10 @@ public String toModelName(String name, String jsonPath) {
// camelize the model name
// phone_number => PhoneNumber
String camelizedName = camelize(nameWithPrefixSuffix);
if (camelizedName.isEmpty()) {
// happens with a name like "/"
camelizedName = camelize(toEnumVarName(name, null).toLowerCase(Locale.ROOT));
}

String[] pathPieces;
boolean isComponent = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1692,6 +1692,15 @@ paths:
description: see other
3XX:
description: 3XX response
/:
get:
operationId: slashRoute
summary: slash route
tags:
- fake
responses:
200:
$ref: '#/components/responses/SuccessDescriptionOnly'
servers:
- url: 'http://{server}.swagger.io:{port}/v2'
description: petstore server
Expand Down
10 changes: 10 additions & 0 deletions samples/openapi3/client/petstore/python/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ docs/paths/pet_pet_id/delete.md
docs/paths/pet_pet_id/get.md
docs/paths/pet_pet_id/post.md
docs/paths/pet_pet_id_upload_image/post.md
docs/paths/solidus/get.md
docs/paths/store_inventory/get.md
docs/paths/store_order/post.md
docs/paths/store_order_order_id/delete.md
Expand Down Expand Up @@ -283,6 +284,7 @@ src/petstore_api/apis/paths/pet_find_by_status.py
src/petstore_api/apis/paths/pet_find_by_tags.py
src/petstore_api/apis/paths/pet_pet_id.py
src/petstore_api/apis/paths/pet_pet_id_upload_image.py
src/petstore_api/apis/paths/solidus.py
src/petstore_api/apis/paths/store_inventory.py
src/petstore_api/apis/paths/store_order.py
src/petstore_api/apis/paths/store_order_order_id.py
Expand Down Expand Up @@ -1162,6 +1164,11 @@ src/petstore_api/paths/pet_pet_id_upload_image/post/responses/__init__.py
src/petstore_api/paths/pet_pet_id_upload_image/post/responses/response_200/__init__.py
src/petstore_api/paths/pet_pet_id_upload_image/post/security/__init__.py
src/petstore_api/paths/pet_pet_id_upload_image/post/security/security_requirement_object_0.py
src/petstore_api/paths/solidus/__init__.py
src/petstore_api/paths/solidus/get/__init__.py
src/petstore_api/paths/solidus/get/operation.py
src/petstore_api/paths/solidus/get/responses/__init__.py
src/petstore_api/paths/solidus/get/responses/response_200/__init__.py
src/petstore_api/paths/store_inventory/__init__.py
src/petstore_api/paths/store_inventory/get/__init__.py
src/petstore_api/paths/store_inventory/get/operation.py
Expand Down Expand Up @@ -1367,6 +1374,7 @@ test/test_paths/__init__.py
test/test_paths/__init__.py
test/test_paths/__init__.py
test/test_paths/__init__.py
test/test_paths/__init__.py
test/test_paths/test_another_fake_dummy/__init__.py
test/test_paths/test_another_fake_dummy/test_patch.py
test/test_paths/test_fake/__init__.py
Expand Down Expand Up @@ -1459,6 +1467,8 @@ test/test_paths/test_pet_pet_id/test_get.py
test/test_paths/test_pet_pet_id/test_post.py
test/test_paths/test_pet_pet_id_upload_image/__init__.py
test/test_paths/test_pet_pet_id_upload_image/test_post.py
test/test_paths/test_solidus/__init__.py
test/test_paths/test_solidus/test_get.py
test/test_paths/test_store_inventory/__init__.py
test/test_paths/test_store_inventory/test_get.py
test/test_paths/test_store_order/__init__.py
Expand Down
18 changes: 7 additions & 11 deletions samples/openapi3/client/petstore/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,27 +174,22 @@ Please follow the [installation procedure](#installation) and then run the follo
```python
import petstore_api
from petstore_api.configurations import api_configuration
from petstore_api.apis.tags import another_fake_api
from petstore_api.apis.tags import fake_api
from pprint import pprint
used_configuration = api_configuration.ApiConfiguration(
)
# Enter a context with an instance of the API client
with petstore_api.ApiClient(used_configuration) as api_client:
# Create an instance of the API class
api_instance = another_fake_api.AnotherFakeApi(api_client)
api_instance = fake_api.FakeApi(api_client)

# example passing only required values which don't have defaults set
body = client.Client(
client="client_example",
)
# example, this endpoint has no required or optional parameters
try:
# To test special tags
api_response = api_instance.call_123_test__special_tags(
body=body,
)
# slash route
api_response = api_instance.slash_route()
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling AnotherFakeApi->call_123_test__special_tags: %s\n" % e)
print("Exception when calling FakeApi->slash_route: %s\n" % e)
```

## Servers
Expand All @@ -213,6 +208,7 @@ All URIs are relative to the selected server

HTTP request | Method | Description
------------ | ------ | -------------
/ **get** | [FakeApi](docs/apis/tags/fake_api.md).[slash_route](docs/paths/solidus/get.md) | slash route
/another-fake/dummy **patch** | [AnotherFakeApi](docs/apis/tags/another_fake_api.md).[call_123_test__special_tags](docs/paths/another_fake_dummy/patch.md) | To test special tags
/fake **delete** | [FakeApi](docs/apis/tags/fake_api.md).[group_parameters](docs/paths/fake/delete.md) | Fake endpoint to test group parameters (optional)
/fake **get** | [FakeApi](docs/apis/tags/fake_api.md).[enum_parameters](docs/paths/fake/get.md) | To test enum parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Method | Description
[**redirection**](../../paths/fake_redirection/get.md) | operation with redirection responses
[**ref_object_in_query**](../../paths/fake_ref_obj_in_query/get.md) | user list
[**response_without_schema**](../../paths/fake_response_without_schema/get.md) | receives a response without schema
[**slash_route**](../../paths/solidus/get.md) | slash route
[**string**](../../paths/fake_refs_string/post.md) |
[**string_enum**](../../paths/fake_refs_enum/post.md) |
[**upload_download_file**](../../paths/fake_upload_download_file/post.md) | uploads a file and downloads a file using application/octet-stream
Expand Down
79 changes: 79 additions & 0 deletions samples/openapi3/client/petstore/python/docs/paths/get.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
petstore_api.paths..operation
# Operation Method Name

| Method Name | Api Class | Notes |
| ----------- | --------- | ----- |
| slash_route | [FakeApi](../../apis/tags/fake_api.md) | This api is only for tag=fake |
| get | ApiForGet | This api is only for this endpoint |
| get | | This api is only for path=/ |

## Table of Contents
- [General Info](#general-info)
- [Arguments](#arguments)
- [Return Types](#return-types)
- [Servers](#servers)
- [Code Sample](#code-sample)

## General Info
| Field | Value |
| ----- | ----- |
| Summary | slash route |
| Path | "/" |
| HTTP Method | get |

## Arguments

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
server_index | typing.Optional[int] | default is None | Allows one to select a different server
stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file
timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client
skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned

## Return Types

HTTP Status Code | Class | Description
------------- | ------------- | -------------
n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned
200 | [SuccessDescriptionOnly.response_cls](../../components/responses/response_success_description_only.md#response_success_description_onlyresponse_cls) | Success

## Servers

Set the available servers by defining your used servers in ApiConfiguration.server_info
Then select your server by setting a server index in ApiConfiguration.server_index_info or by
passing server_index in to the endpoint method.
- these servers are the general api servers
- defaults to server_index=0, server.url = http://petstore.swagger.io:80/v2

server_index | Class | Description
------------ | ----- | ------------
0 | [Server0](../../../servers/server_0.md) | petstore server
1 | [Server1](../../../servers/server_1.md) | The local server
2 | [Server2](../../../servers/server_2.md) | staging server with no variables

## Code Sample

```python
import petstore_api
from petstore_api.configurations import api_configuration
from petstore_api.apis.tags import fake_api
from pprint import pprint
used_configuration = api_configuration.ApiConfiguration(
)
# Enter a context with an instance of the API client
with petstore_api.ApiClient(used_configuration) as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)

# example, this endpoint has no required or optional parameters
try:
# slash route
api_response = api_instance.slash_route()
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->slash_route: %s\n" % e)
```

[[Back to top]](#top)
[[Back to FakeApi API]](../../apis/tags/fake_api.md)
[[Back to Endpoints]](../../../README.md#Endpoints) [[Back to README]](../../../README.md)
79 changes: 79 additions & 0 deletions samples/openapi3/client/petstore/python/docs/paths/solidus/get.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
petstore_api.paths.solidus.operation
# Operation Method Name

| Method Name | Api Class | Notes |
| ----------- | --------- | ----- |
| slash_route | [FakeApi](../../apis/tags/fake_api.md) | This api is only for tag=fake |
| get | ApiForGet | This api is only for this endpoint |
| get | Solidus | This api is only for path=/ |

## Table of Contents
- [General Info](#general-info)
- [Arguments](#arguments)
- [Return Types](#return-types)
- [Servers](#servers)
- [Code Sample](#code-sample)

## General Info
| Field | Value |
| ----- | ----- |
| Summary | slash route |
| Path | "/" |
| HTTP Method | get |

## Arguments

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
server_index | typing.Optional[int] | default is None | Allows one to select a different server
stream | bool | default is False | if True then the response.content will be streamed and loaded from a file like object. When downloading a file, set this to True to force the code to deserialize the content to a FileSchema file
timeout | typing.Optional[typing.Union[int, typing.Tuple]] | default is None | the timeout used by the rest client
skip_deserialization | bool | default is False | when True, headers and body will be unset and an instance of api_client.ApiResponseWithoutDeserialization will be returned

## Return Types

HTTP Status Code | Class | Description
------------- | ------------- | -------------
n/a | api_client.ApiResponseWithoutDeserialization | When skip_deserialization is True this response is returned
200 | [SuccessDescriptionOnly.response_cls](../../components/responses/response_success_description_only.md#response_success_description_onlyresponse_cls) | Success

## Servers

Set the available servers by defining your used servers in ApiConfiguration.server_info
Then select your server by setting a server index in ApiConfiguration.server_index_info or by
passing server_index in to the endpoint method.
- these servers are the general api servers
- defaults to server_index=0, server.url = http://petstore.swagger.io:80/v2

server_index | Class | Description
------------ | ----- | ------------
0 | [Server0](../../../servers/server_0.md) | petstore server
1 | [Server1](../../../servers/server_1.md) | The local server
2 | [Server2](../../../servers/server_2.md) | staging server with no variables

## Code Sample

```python
import petstore_api
from petstore_api.configurations import api_configuration
from petstore_api.apis.tags import fake_api
from pprint import pprint
used_configuration = api_configuration.ApiConfiguration(
)
# Enter a context with an instance of the API client
with petstore_api.ApiClient(used_configuration) as api_client:
# Create an instance of the API class
api_instance = fake_api.FakeApi(api_client)

# example, this endpoint has no required or optional parameters
try:
# slash route
api_response = api_instance.slash_route()
pprint(api_response)
except petstore_api.ApiException as e:
print("Exception when calling FakeApi->slash_route: %s\n" % e)
```

[[Back to top]](#top)
[[Back to FakeApi API]](../../apis/tags/fake_api.md)
[[Back to Endpoints]](../../../README.md#Endpoints) [[Back to README]](../../../README.md)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import typing
import typing_extensions

from petstore_api.apis.paths.solidus import Solidus
from petstore_api.apis.paths.another_fake_dummy import AnotherFakeDummy
from petstore_api.apis.paths.fake import Fake
from petstore_api.apis.paths.fake_additional_properties_with_array_of_enums import FakeAdditionalPropertiesWithArrayOfEnums
Expand Down Expand Up @@ -57,6 +58,7 @@
PathToApi = typing_extensions.TypedDict(
'PathToApi',
{
"/": typing.Type[Solidus],
"/another-fake/dummy": typing.Type[AnotherFakeDummy],
"/fake": typing.Type[Fake],
"/fake/additional-properties-with-array-of-enums": typing.Type[FakeAdditionalPropertiesWithArrayOfEnums],
Expand Down Expand Up @@ -114,6 +116,7 @@

path_to_api = PathToApi(
{
"/": Solidus,
"/another-fake/dummy": AnotherFakeDummy,
"/fake": Fake,
"/fake/additional-properties-with-array-of-enums": FakeAdditionalPropertiesWithArrayOfEnums,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# coding: utf-8

"""


Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator
"""

from petstore_api.paths.solidus.get.operation import ApiForGet


class Solidus(
ApiForGet,
):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from petstore_api.paths.fake_json_patch.patch.operation import JsonPatch
from petstore_api.paths.fake_upload_files.post.operation import UploadFiles
from petstore_api.paths.fake_json_form_data.get.operation import JsonFormData
from petstore_api.paths.solidus.get.operation import SlashRoute
from petstore_api.paths.fake_refs_string.post.operation import String
from petstore_api.paths.fake_response_without_schema.get.operation import ResponseWithoutSchema
from petstore_api.paths.fake_refs_object_model_with_ref_props.post.operation import ObjectModelWithRefProps
Expand Down Expand Up @@ -57,6 +58,7 @@ class FakeApi(
JsonPatch,
UploadFiles,
JsonFormData,
SlashRoute,
String,
ResponseWithoutSchema,
ObjectModelWithRefProps,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# do not import all endpoints into this module because that uses a lot of memory and stack frames
# if you need the ability to import all endpoints from this module, import them with
# from petstore_api.apis.paths.solidus import Solidus

path = "/"
Loading