mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-03 00:43:46 +00:00
Better handling of Inline schema (#15682)
* skip allOf inline subschema created as $ref * add option for fallback * add back atleastonemodel * add log * update java, kotlin, js samples * update tests * fix native client test * fix java client errors by regenerating test files * clean up python * clean up powershell * clean up php * clean up ruby * update erlang, elixir * update dart samples * update ts samples * update r, go samples * update perl * update swift * add back files * add back files * remove outdated test files * fix test
This commit is contained in:
@@ -7,7 +7,6 @@ docs/Bird.md
|
||||
docs/BodyApi.md
|
||||
docs/Category.md
|
||||
docs/DataQuery.md
|
||||
docs/DataQueryAllOf.md
|
||||
docs/DefaultValue.md
|
||||
docs/FormApi.md
|
||||
docs/HeaderApi.md
|
||||
@@ -36,7 +35,6 @@ openapi_client/models/__init__.py
|
||||
openapi_client/models/bird.py
|
||||
openapi_client/models/category.py
|
||||
openapi_client/models/data_query.py
|
||||
openapi_client/models/data_query_all_of.py
|
||||
openapi_client/models/default_value.py
|
||||
openapi_client/models/number_properties_only.py
|
||||
openapi_client/models/pet.py
|
||||
|
||||
@@ -108,7 +108,6 @@ Class | Method | HTTP request | Description
|
||||
- [Bird](docs/Bird.md)
|
||||
- [Category](docs/Category.md)
|
||||
- [DataQuery](docs/DataQuery.md)
|
||||
- [DataQueryAllOf](docs/DataQueryAllOf.md)
|
||||
- [DefaultValue](docs/DefaultValue.md)
|
||||
- [NumberPropertiesOnly](docs/NumberPropertiesOnly.md)
|
||||
- [Pet](docs/Pet.md)
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
# DataQueryAllOf
|
||||
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**suffix** | **str** | test suffix | [optional]
|
||||
**text** | **str** | Some text containing white spaces | [optional]
|
||||
**var_date** | **datetime** | A date | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from openapi_client.models.data_query_all_of import DataQueryAllOf
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of DataQueryAllOf from a JSON string
|
||||
data_query_all_of_instance = DataQueryAllOf.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print DataQueryAllOf.to_json()
|
||||
|
||||
# convert the object into a dict
|
||||
data_query_all_of_dict = data_query_all_of_instance.to_dict()
|
||||
# create an instance of DataQueryAllOf from a dict
|
||||
data_query_all_of_form_dict = data_query_all_of.from_dict(data_query_all_of_dict)
|
||||
```
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@ from openapi_client.exceptions import ApiException
|
||||
from openapi_client.models.bird import Bird
|
||||
from openapi_client.models.category import Category
|
||||
from openapi_client.models.data_query import DataQuery
|
||||
from openapi_client.models.data_query_all_of import DataQueryAllOf
|
||||
from openapi_client.models.default_value import DefaultValue
|
||||
from openapi_client.models.number_properties_only import NumberPropertiesOnly
|
||||
from openapi_client.models.pet import Pet
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
from openapi_client.models.bird import Bird
|
||||
from openapi_client.models.category import Category
|
||||
from openapi_client.models.data_query import DataQuery
|
||||
from openapi_client.models.data_query_all_of import DataQueryAllOf
|
||||
from openapi_client.models.default_value import DefaultValue
|
||||
from openapi_client.models.number_properties_only import NumberPropertiesOnly
|
||||
from openapi_client.models.pet import Pet
|
||||
|
||||
@@ -30,7 +30,7 @@ class DataQuery(Query):
|
||||
suffix: Optional[StrictStr] = Field(None, description="test suffix")
|
||||
text: Optional[StrictStr] = Field(None, description="Some text containing white spaces")
|
||||
var_date: Optional[datetime] = Field(None, alias="date", description="A date")
|
||||
__properties = ["suffix", "text", "date", "id", "outcomes"]
|
||||
__properties = ["id", "outcomes", "suffix", "text", "date"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
@@ -68,11 +68,11 @@ class DataQuery(Query):
|
||||
return DataQuery.parse_obj(obj)
|
||||
|
||||
_obj = DataQuery.parse_obj({
|
||||
"id": obj.get("id"),
|
||||
"outcomes": obj.get("outcomes"),
|
||||
"suffix": obj.get("suffix"),
|
||||
"text": obj.get("text"),
|
||||
"var_date": obj.get("date"),
|
||||
"id": obj.get("id"),
|
||||
"outcomes": obj.get("outcomes")
|
||||
"var_date": obj.get("date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field, StrictStr
|
||||
|
||||
class DataQueryAllOf(BaseModel):
|
||||
"""
|
||||
DataQueryAllOf
|
||||
"""
|
||||
suffix: Optional[StrictStr] = Field(None, description="test suffix")
|
||||
text: Optional[StrictStr] = Field(None, description="Some text containing white spaces")
|
||||
var_date: Optional[datetime] = Field(None, alias="date", description="A date")
|
||||
__properties = ["suffix", "text", "date"]
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration"""
|
||||
allow_population_by_field_name = True
|
||||
validate_assignment = True
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.dict(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
return json.dumps(self.to_dict())
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> DataQueryAllOf:
|
||||
"""Create an instance of DataQueryAllOf from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self):
|
||||
"""Returns the dictionary representation of the model using alias"""
|
||||
_dict = self.dict(by_alias=True,
|
||||
exclude={
|
||||
},
|
||||
exclude_none=True)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: dict) -> DataQueryAllOf:
|
||||
"""Create an instance of DataQueryAllOf from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return DataQueryAllOf.parse_obj(obj)
|
||||
|
||||
_obj = DataQueryAllOf.parse_obj({
|
||||
"suffix": obj.get("suffix"),
|
||||
"text": obj.get("text"),
|
||||
"var_date": obj.get("date")
|
||||
})
|
||||
return _obj
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Echo Server API
|
||||
|
||||
Echo Server API # noqa: E501
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
Contact: team@openapitools.org
|
||||
Generated by: https://openapi-generator.tech
|
||||
"""
|
||||
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
import datetime
|
||||
|
||||
import openapi_client
|
||||
from openapi_client.models.data_query_all_of import DataQueryAllOf # noqa: E501
|
||||
from openapi_client.rest import ApiException
|
||||
|
||||
class TestDataQueryAllOf(unittest.TestCase):
|
||||
"""DataQueryAllOf unit test stubs"""
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def make_instance(self, include_optional):
|
||||
"""Test DataQueryAllOf
|
||||
include_option is a boolean, when False only required
|
||||
params are included, when True both required and
|
||||
optional params are included """
|
||||
# uncomment below to create an instance of `DataQueryAllOf`
|
||||
"""
|
||||
model = openapi_client.models.data_query_all_of.DataQueryAllOf() # noqa: E501
|
||||
if include_optional :
|
||||
return DataQueryAllOf(
|
||||
suffix = '',
|
||||
text = 'Some text',
|
||||
var_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f')
|
||||
)
|
||||
else :
|
||||
return DataQueryAllOf(
|
||||
)
|
||||
"""
|
||||
|
||||
def testDataQueryAllOf(self):
|
||||
"""Test DataQueryAllOf"""
|
||||
# inst_req_only = self.make_instance(include_optional=False)
|
||||
# inst_req_and_optional = self.make_instance(include_optional=True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user