forked from loafle/openapi-generator-original
Add support for string response deserialization (#12910)
* Add support for string response deserialization * updated samples * updated samples * realigned to master * fix: errors were not getting thrown * updated samples * fix: errors were not getting thrown * updated samples
This commit is contained in:
parent
cf58ac0583
commit
b8524bee23
@ -514,6 +514,10 @@ namespace {{packageName}}.Client
|
|||||||
{
|
{
|
||||||
response.Data = (T)(object)response.RawBytes;
|
response.Data = (T)(object)response.RawBytes;
|
||||||
}
|
}
|
||||||
|
else if (typeof(T).Name == "String") // for string response
|
||||||
|
{
|
||||||
|
response.Data = (T)(object)response.Content;
|
||||||
|
}
|
||||||
|
|
||||||
InterceptResponse(req, response);
|
InterceptResponse(req, response);
|
||||||
|
|
||||||
@ -619,7 +623,11 @@ namespace {{packageName}}.Client
|
|||||||
{
|
{
|
||||||
response.Data = (T)(object)response.RawBytes;
|
response.Data = (T)(object)response.RawBytes;
|
||||||
}
|
}
|
||||||
|
else if (typeof(T).Name == "String") // for string response
|
||||||
|
{
|
||||||
|
response.Data = (T)(object)response.Content;
|
||||||
|
}
|
||||||
|
|
||||||
InterceptResponse(req, response);
|
InterceptResponse(req, response);
|
||||||
|
|
||||||
var result = ToApiResponse(response);
|
var result = ToApiResponse(response);
|
||||||
|
@ -497,6 +497,10 @@ namespace Org.OpenAPITools.Client
|
|||||||
{
|
{
|
||||||
response.Data = (T)(object)response.RawBytes;
|
response.Data = (T)(object)response.RawBytes;
|
||||||
}
|
}
|
||||||
|
else if (typeof(T).Name == "String") // for string response
|
||||||
|
{
|
||||||
|
response.Data = (T)(object)response.Content;
|
||||||
|
}
|
||||||
|
|
||||||
InterceptResponse(req, response);
|
InterceptResponse(req, response);
|
||||||
|
|
||||||
@ -581,7 +585,11 @@ namespace Org.OpenAPITools.Client
|
|||||||
{
|
{
|
||||||
response.Data = (T)(object)response.RawBytes;
|
response.Data = (T)(object)response.RawBytes;
|
||||||
}
|
}
|
||||||
|
else if (typeof(T).Name == "String") // for string response
|
||||||
|
{
|
||||||
|
response.Data = (T)(object)response.Content;
|
||||||
|
}
|
||||||
|
|
||||||
InterceptResponse(req, response);
|
InterceptResponse(req, response);
|
||||||
|
|
||||||
var result = ToApiResponse(response);
|
var result = ToApiResponse(response);
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
# petstore::AllofTagApiResponse
|
|
||||||
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
**id** | **integer** | | [optional]
|
|
||||||
**name** | **character** | | [optional]
|
|
||||||
**code** | **integer** | | [optional]
|
|
||||||
**type** | **character** | | [optional]
|
|
||||||
**message** | **character** | | [optional]
|
|
||||||
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
|||||||
# FakeApi
|
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
|
||||||
|
|
||||||
Method | HTTP request | Description
|
|
||||||
------------- | ------------- | -------------
|
|
||||||
[**FakeDataFile**](FakeApi.md#FakeDataFile) | **GET** /fake/data_file | test data_file to ensure it's escaped correctly
|
|
||||||
|
|
||||||
|
|
||||||
# **FakeDataFile**
|
|
||||||
> User FakeDataFile(dummy, var_data_file = var.var_data_file)
|
|
||||||
|
|
||||||
test data_file to ensure it's escaped correctly
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Example
|
|
||||||
```R
|
|
||||||
library(petstore)
|
|
||||||
|
|
||||||
var_dummy <- "dummy_example" # character | dummy required parameter
|
|
||||||
var_var_data_file <- "var_data_file_example" # character | header data file
|
|
||||||
|
|
||||||
#test data_file to ensure it's escaped correctly
|
|
||||||
api_instance <- FakeApi$new()
|
|
||||||
result <- tryCatch(
|
|
||||||
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
|
|
||||||
# api_instance$FakeDataFile(var_dummy, var_data_file = var_var_data_file, data_file = "result.txt"),
|
|
||||||
api_instance$FakeDataFile(var_dummy, var_data_file = var_var_data_file),
|
|
||||||
ApiException = function(ex) ex
|
|
||||||
)
|
|
||||||
# In case of error, print the error object
|
|
||||||
if (!is.null(result$ApiException)) {
|
|
||||||
cat(result$ApiException$toString())
|
|
||||||
} else {
|
|
||||||
# deserialized response object
|
|
||||||
response.object <- result$content
|
|
||||||
# response headers
|
|
||||||
response.headers <- result$response$headers
|
|
||||||
# response status code
|
|
||||||
response.status.code <- result$response$status_code
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------- | ------------- | ------------- | -------------
|
|
||||||
**dummy** | **character**| dummy required parameter |
|
|
||||||
**var_data_file** | **character**| header data file | [optional]
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
[**User**](User.md)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
|
||||||
- **Accept**: application/xml, application/json
|
|
||||||
|
|
||||||
### HTTP response details
|
|
||||||
| Status code | Description | Response headers |
|
|
||||||
|-------------|-------------|------------------|
|
|
||||||
| **200** | successful operation | - |
|
|
||||||
|
|
@ -512,6 +512,10 @@ namespace Org.OpenAPITools.Client
|
|||||||
{
|
{
|
||||||
response.Data = (T)(object)response.RawBytes;
|
response.Data = (T)(object)response.RawBytes;
|
||||||
}
|
}
|
||||||
|
else if (typeof(T).Name == "String") // for string response
|
||||||
|
{
|
||||||
|
response.Data = (T)(object)response.Content;
|
||||||
|
}
|
||||||
|
|
||||||
InterceptResponse(req, response);
|
InterceptResponse(req, response);
|
||||||
|
|
||||||
@ -610,7 +614,11 @@ namespace Org.OpenAPITools.Client
|
|||||||
{
|
{
|
||||||
response.Data = (T)(object)response.RawBytes;
|
response.Data = (T)(object)response.RawBytes;
|
||||||
}
|
}
|
||||||
|
else if (typeof(T).Name == "String") // for string response
|
||||||
|
{
|
||||||
|
response.Data = (T)(object)response.Content;
|
||||||
|
}
|
||||||
|
|
||||||
InterceptResponse(req, response);
|
InterceptResponse(req, response);
|
||||||
|
|
||||||
var result = ToApiResponse(response);
|
var result = ToApiResponse(response);
|
||||||
|
@ -513,6 +513,10 @@ namespace Org.OpenAPITools.Client
|
|||||||
{
|
{
|
||||||
response.Data = (T)(object)response.RawBytes;
|
response.Data = (T)(object)response.RawBytes;
|
||||||
}
|
}
|
||||||
|
else if (typeof(T).Name == "String") // for string response
|
||||||
|
{
|
||||||
|
response.Data = (T)(object)response.Content;
|
||||||
|
}
|
||||||
|
|
||||||
InterceptResponse(req, response);
|
InterceptResponse(req, response);
|
||||||
|
|
||||||
@ -611,7 +615,11 @@ namespace Org.OpenAPITools.Client
|
|||||||
{
|
{
|
||||||
response.Data = (T)(object)response.RawBytes;
|
response.Data = (T)(object)response.RawBytes;
|
||||||
}
|
}
|
||||||
|
else if (typeof(T).Name == "String") // for string response
|
||||||
|
{
|
||||||
|
response.Data = (T)(object)response.Content;
|
||||||
|
}
|
||||||
|
|
||||||
InterceptResponse(req, response);
|
InterceptResponse(req, response);
|
||||||
|
|
||||||
var result = ToApiResponse(response);
|
var result = ToApiResponse(response);
|
||||||
|
@ -513,6 +513,10 @@ namespace Org.OpenAPITools.Client
|
|||||||
{
|
{
|
||||||
response.Data = (T)(object)response.RawBytes;
|
response.Data = (T)(object)response.RawBytes;
|
||||||
}
|
}
|
||||||
|
else if (typeof(T).Name == "String") // for string response
|
||||||
|
{
|
||||||
|
response.Data = (T)(object)response.Content;
|
||||||
|
}
|
||||||
|
|
||||||
InterceptResponse(req, response);
|
InterceptResponse(req, response);
|
||||||
|
|
||||||
@ -611,7 +615,11 @@ namespace Org.OpenAPITools.Client
|
|||||||
{
|
{
|
||||||
response.Data = (T)(object)response.RawBytes;
|
response.Data = (T)(object)response.RawBytes;
|
||||||
}
|
}
|
||||||
|
else if (typeof(T).Name == "String") // for string response
|
||||||
|
{
|
||||||
|
response.Data = (T)(object)response.Content;
|
||||||
|
}
|
||||||
|
|
||||||
InterceptResponse(req, response);
|
InterceptResponse(req, response);
|
||||||
|
|
||||||
var result = ToApiResponse(response);
|
var result = ToApiResponse(response);
|
||||||
|
@ -512,6 +512,10 @@ namespace Org.OpenAPITools.Client
|
|||||||
{
|
{
|
||||||
response.Data = (T)(object)response.RawBytes;
|
response.Data = (T)(object)response.RawBytes;
|
||||||
}
|
}
|
||||||
|
else if (typeof(T).Name == "String") // for string response
|
||||||
|
{
|
||||||
|
response.Data = (T)(object)response.Content;
|
||||||
|
}
|
||||||
|
|
||||||
InterceptResponse(req, response);
|
InterceptResponse(req, response);
|
||||||
|
|
||||||
@ -610,7 +614,11 @@ namespace Org.OpenAPITools.Client
|
|||||||
{
|
{
|
||||||
response.Data = (T)(object)response.RawBytes;
|
response.Data = (T)(object)response.RawBytes;
|
||||||
}
|
}
|
||||||
|
else if (typeof(T).Name == "String") // for string response
|
||||||
|
{
|
||||||
|
response.Data = (T)(object)response.Content;
|
||||||
|
}
|
||||||
|
|
||||||
InterceptResponse(req, response);
|
InterceptResponse(req, response);
|
||||||
|
|
||||||
var result = ToApiResponse(response);
|
var result = ToApiResponse(response);
|
||||||
|
@ -513,6 +513,10 @@ namespace Org.OpenAPITools.Client
|
|||||||
{
|
{
|
||||||
response.Data = (T)(object)response.RawBytes;
|
response.Data = (T)(object)response.RawBytes;
|
||||||
}
|
}
|
||||||
|
else if (typeof(T).Name == "String") // for string response
|
||||||
|
{
|
||||||
|
response.Data = (T)(object)response.Content;
|
||||||
|
}
|
||||||
|
|
||||||
InterceptResponse(req, response);
|
InterceptResponse(req, response);
|
||||||
|
|
||||||
@ -611,7 +615,11 @@ namespace Org.OpenAPITools.Client
|
|||||||
{
|
{
|
||||||
response.Data = (T)(object)response.RawBytes;
|
response.Data = (T)(object)response.RawBytes;
|
||||||
}
|
}
|
||||||
|
else if (typeof(T).Name == "String") // for string response
|
||||||
|
{
|
||||||
|
response.Data = (T)(object)response.Content;
|
||||||
|
}
|
||||||
|
|
||||||
InterceptResponse(req, response);
|
InterceptResponse(req, response);
|
||||||
|
|
||||||
var result = ToApiResponse(response);
|
var result = ToApiResponse(response);
|
||||||
|
@ -512,6 +512,10 @@ namespace Org.OpenAPITools.Client
|
|||||||
{
|
{
|
||||||
response.Data = (T)(object)response.RawBytes;
|
response.Data = (T)(object)response.RawBytes;
|
||||||
}
|
}
|
||||||
|
else if (typeof(T).Name == "String") // for string response
|
||||||
|
{
|
||||||
|
response.Data = (T)(object)response.Content;
|
||||||
|
}
|
||||||
|
|
||||||
InterceptResponse(req, response);
|
InterceptResponse(req, response);
|
||||||
|
|
||||||
@ -610,7 +614,11 @@ namespace Org.OpenAPITools.Client
|
|||||||
{
|
{
|
||||||
response.Data = (T)(object)response.RawBytes;
|
response.Data = (T)(object)response.RawBytes;
|
||||||
}
|
}
|
||||||
|
else if (typeof(T).Name == "String") // for string response
|
||||||
|
{
|
||||||
|
response.Data = (T)(object)response.Content;
|
||||||
|
}
|
||||||
|
|
||||||
InterceptResponse(req, response);
|
InterceptResponse(req, response);
|
||||||
|
|
||||||
var result = ToApiResponse(response);
|
var result = ToApiResponse(response);
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
# WWW::OpenAPIClient::Object::Pet
|
|
||||||
|
|
||||||
## Load the model package
|
|
||||||
```perl
|
|
||||||
use WWW::OpenAPIClient::Object::Pet;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
**id** | **int** | | [optional]
|
|
||||||
**category** | [**Category**](Category.md) | | [optional]
|
|
||||||
**name** | **string** | |
|
|
||||||
**photo_urls** | **ARRAY[string]** | |
|
|
||||||
**tags** | [**ARRAY[Tag]**](Tag.md) | | [optional]
|
|
||||||
**status** | **string** | pet status in the store | [optional]
|
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
|
||||||
|
|
||||||
|
|
@ -1,170 +0,0 @@
|
|||||||
=begin comment
|
|
||||||
|
|
||||||
OpenAPI Petstore
|
|
||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 1.0.0
|
|
||||||
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
|
|
||||||
=end comment
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
#
|
|
||||||
# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
# Do not edit the class manually.
|
|
||||||
# Ref: https://openapi-generator.tech
|
|
||||||
#
|
|
||||||
package WWW::OpenAPIClient::Configuration;
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use warnings;
|
|
||||||
use utf8;
|
|
||||||
|
|
||||||
use Log::Any qw($log);
|
|
||||||
use Carp;
|
|
||||||
|
|
||||||
use constant VERSION => '1.0.0';
|
|
||||||
|
|
||||||
=head1 Name
|
|
||||||
|
|
||||||
WWW::OpenAPIClient::Configuration - holds the configuration for all WWW::OpenAPIClient Modules
|
|
||||||
|
|
||||||
=head1 new(%parameters)
|
|
||||||
|
|
||||||
=over 4
|
|
||||||
|
|
||||||
=item http_timeout: (optional)
|
|
||||||
|
|
||||||
Integer. timeout for HTTP requests in seconds
|
|
||||||
|
|
||||||
default: 180
|
|
||||||
|
|
||||||
=item http_user_agent: (optional)
|
|
||||||
|
|
||||||
String. custom UserAgent header
|
|
||||||
|
|
||||||
default: OpenAPI-Generator/1.0.0/perl
|
|
||||||
|
|
||||||
=item api_key: (optional)
|
|
||||||
|
|
||||||
Hashref. Keyed on the name of each key (there can be multiple tokens).
|
|
||||||
|
|
||||||
api_key => {
|
|
||||||
secretKey => 'aaaabbbbccccdddd',
|
|
||||||
anotherKey => '1111222233334444',
|
|
||||||
};
|
|
||||||
|
|
||||||
=item api_key_prefix: (optional)
|
|
||||||
|
|
||||||
Hashref. Keyed on the name of each key (there can be multiple tokens). Note not all api keys require a prefix.
|
|
||||||
|
|
||||||
api_key_prefix => {
|
|
||||||
secretKey => 'string',
|
|
||||||
anotherKey => 'same or some other string',
|
|
||||||
};
|
|
||||||
|
|
||||||
=item api_key_in: (optional)
|
|
||||||
|
|
||||||
=item username: (optional)
|
|
||||||
|
|
||||||
String. The username for basic auth.
|
|
||||||
|
|
||||||
=item password: (optional)
|
|
||||||
|
|
||||||
String. The password for basic auth.
|
|
||||||
|
|
||||||
=item access_token: (optional)
|
|
||||||
|
|
||||||
String. The OAuth access token.
|
|
||||||
|
|
||||||
=item base_url: (optional)
|
|
||||||
|
|
||||||
String. The base URL of the API
|
|
||||||
|
|
||||||
default: http://petstore.swagger.io:80/v2
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=cut
|
|
||||||
|
|
||||||
sub new {
|
|
||||||
my ($self, %p) = (shift,@_);
|
|
||||||
|
|
||||||
# class/static variables
|
|
||||||
$p{http_timeout} //= 180;
|
|
||||||
$p{http_user_agent} //= 'OpenAPI-Generator/1.0.0/perl';
|
|
||||||
|
|
||||||
# authentication setting
|
|
||||||
$p{api_key} //= {};
|
|
||||||
$p{api_key_prefix} //= {};
|
|
||||||
$p{api_key_in} //= {};
|
|
||||||
|
|
||||||
# username and password for HTTP basic authentication
|
|
||||||
$p{username} //= '';
|
|
||||||
$p{password} //= '';
|
|
||||||
|
|
||||||
# access token for OAuth
|
|
||||||
$p{access_token} //= '';
|
|
||||||
|
|
||||||
# base_url
|
|
||||||
$p{base_url} //= 'http://petstore.swagger.io:80/v2';
|
|
||||||
|
|
||||||
return bless \%p => $self;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
sub get_tokens {
|
|
||||||
my $self = shift;
|
|
||||||
|
|
||||||
my $tokens = {};
|
|
||||||
$tokens->{username} = $self->{username} if $self->{username};
|
|
||||||
$tokens->{password} = $self->{password} if $self->{password};
|
|
||||||
$tokens->{access_token} = $self->{access_token} if $self->{access_token};
|
|
||||||
|
|
||||||
foreach my $token_name (keys %{ $self->{api_key} }) {
|
|
||||||
$tokens->{$token_name}->{token} = $self->{api_key}{$token_name};
|
|
||||||
$tokens->{$token_name}->{prefix} = $self->{api_key_prefix}{$token_name};
|
|
||||||
$tokens->{$token_name}->{in} = $self->{api_key_in}{$token_name};
|
|
||||||
}
|
|
||||||
|
|
||||||
return $tokens;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub clear_tokens {
|
|
||||||
my $self = shift;
|
|
||||||
my %tokens = %{$self->get_tokens}; # copy
|
|
||||||
|
|
||||||
$self->{username} = '';
|
|
||||||
$self->{password} = '';
|
|
||||||
$self->{access_token} = '';
|
|
||||||
|
|
||||||
$self->{api_key} = {};
|
|
||||||
$self->{api_key_prefix} = {};
|
|
||||||
$self->{api_key_in} = {};
|
|
||||||
|
|
||||||
return \%tokens;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub accept_tokens {
|
|
||||||
my ($self, $tokens) = @_;
|
|
||||||
|
|
||||||
foreach my $known_name (qw(username password access_token)) {
|
|
||||||
next unless $tokens->{$known_name};
|
|
||||||
$self->{$known_name} = delete $tokens->{$known_name};
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach my $token_name (keys %$tokens) {
|
|
||||||
$self->{api_key}{$token_name} = $tokens->{$token_name}{token};
|
|
||||||
if ($tokens->{$token_name}{prefix}) {
|
|
||||||
$self->{api_key_prefix}{$token_name} = $tokens->{$token_name}{prefix};
|
|
||||||
}
|
|
||||||
my $in = $tokens->{$token_name}->{in} || 'head';
|
|
||||||
croak "Tokens can only go in 'head' or 'query' (not in '$in')" unless $in =~ /^(?:head|query)$/;
|
|
||||||
$self->{api_key_in}{$token_name} = $in;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
|
@ -1,533 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* MapTest
|
|
||||||
*
|
|
||||||
* PHP version 7.4
|
|
||||||
*
|
|
||||||
* @category Class
|
|
||||||
* @package OpenAPI\Client
|
|
||||||
* @author OpenAPI Generator team
|
|
||||||
* @link https://openapi-generator.tech
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* OpenAPI Petstore
|
|
||||||
*
|
|
||||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
|
||||||
*
|
|
||||||
* The version of the OpenAPI document: 1.0.0
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
* OpenAPI Generator version: 6.1.0-SNAPSHOT
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
||||||
* https://openapi-generator.tech
|
|
||||||
* Do not edit the class manually.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace OpenAPI\Client\Model;
|
|
||||||
|
|
||||||
use \ArrayAccess;
|
|
||||||
use \OpenAPI\Client\ObjectSerializer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* MapTest Class Doc Comment
|
|
||||||
*
|
|
||||||
* @category Class
|
|
||||||
* @package OpenAPI\Client
|
|
||||||
* @author OpenAPI Generator team
|
|
||||||
* @link https://openapi-generator.tech
|
|
||||||
* @implements \ArrayAccess<string, mixed>
|
|
||||||
*/
|
|
||||||
class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
|
|
||||||
{
|
|
||||||
public const DISCRIMINATOR = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The original name of the model.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected static $openAPIModelName = 'MapTest';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Array of property to type mappings. Used for (de)serialization
|
|
||||||
*
|
|
||||||
* @var string[]
|
|
||||||
*/
|
|
||||||
protected static $openAPITypes = [
|
|
||||||
'map_map_of_string' => 'array<string,array<string,string>>',
|
|
||||||
'map_of_enum_string' => 'array<string,string>',
|
|
||||||
'direct_map' => 'array<string,bool>',
|
|
||||||
'indirect_map' => 'array<string,bool>'
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Array of property to format mappings. Used for (de)serialization
|
|
||||||
*
|
|
||||||
* @var string[]
|
|
||||||
* @phpstan-var array<string, string|null>
|
|
||||||
* @psalm-var array<string, string|null>
|
|
||||||
*/
|
|
||||||
protected static $openAPIFormats = [
|
|
||||||
'map_map_of_string' => null,
|
|
||||||
'map_of_enum_string' => null,
|
|
||||||
'direct_map' => null,
|
|
||||||
'indirect_map' => null
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Array of nullable properties. Used for (de)serialization
|
|
||||||
*
|
|
||||||
* @var boolean[]
|
|
||||||
*/
|
|
||||||
protected static array $openAPINullables = [
|
|
||||||
'map_map_of_string' => false,
|
|
||||||
'map_of_enum_string' => false,
|
|
||||||
'direct_map' => false,
|
|
||||||
'indirect_map' => false
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If a nullable field gets set to null, insert it here
|
|
||||||
*
|
|
||||||
* @var boolean[]
|
|
||||||
*/
|
|
||||||
protected array $openAPINullablesSetToNull = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Array of property to type mappings. Used for (de)serialization
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public static function openAPITypes()
|
|
||||||
{
|
|
||||||
return self::$openAPITypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Array of property to format mappings. Used for (de)serialization
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public static function openAPIFormats()
|
|
||||||
{
|
|
||||||
return self::$openAPIFormats;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Array of nullable properties
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
protected static function openAPINullables(): array
|
|
||||||
{
|
|
||||||
return self::$openAPINullables;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Array of nullable field names deliberately set to null
|
|
||||||
*
|
|
||||||
* @return boolean[]
|
|
||||||
*/
|
|
||||||
private function getOpenAPINullablesSetToNull(): array
|
|
||||||
{
|
|
||||||
return $this->openAPINullablesSetToNull;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if a property is nullable
|
|
||||||
*
|
|
||||||
* @param string $property
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public static function isNullable(string $property): bool
|
|
||||||
{
|
|
||||||
return self::openAPINullables()[$property] ?? false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if a nullable property is set to null.
|
|
||||||
*
|
|
||||||
* @param string $property
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function isNullableSetToNull(string $property): bool
|
|
||||||
{
|
|
||||||
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Array of attributes where the key is the local name,
|
|
||||||
* and the value is the original name
|
|
||||||
*
|
|
||||||
* @var string[]
|
|
||||||
*/
|
|
||||||
protected static $attributeMap = [
|
|
||||||
'map_map_of_string' => 'map_map_of_string',
|
|
||||||
'map_of_enum_string' => 'map_of_enum_string',
|
|
||||||
'direct_map' => 'direct_map',
|
|
||||||
'indirect_map' => 'indirect_map'
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Array of attributes to setter functions (for deserialization of responses)
|
|
||||||
*
|
|
||||||
* @var string[]
|
|
||||||
*/
|
|
||||||
protected static $setters = [
|
|
||||||
'map_map_of_string' => 'setMapMapOfString',
|
|
||||||
'map_of_enum_string' => 'setMapOfEnumString',
|
|
||||||
'direct_map' => 'setDirectMap',
|
|
||||||
'indirect_map' => 'setIndirectMap'
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Array of attributes to getter functions (for serialization of requests)
|
|
||||||
*
|
|
||||||
* @var string[]
|
|
||||||
*/
|
|
||||||
protected static $getters = [
|
|
||||||
'map_map_of_string' => 'getMapMapOfString',
|
|
||||||
'map_of_enum_string' => 'getMapOfEnumString',
|
|
||||||
'direct_map' => 'getDirectMap',
|
|
||||||
'indirect_map' => 'getIndirectMap'
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Array of attributes where the key is the local name,
|
|
||||||
* and the value is the original name
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public static function attributeMap()
|
|
||||||
{
|
|
||||||
return self::$attributeMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Array of attributes to setter functions (for deserialization of responses)
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public static function setters()
|
|
||||||
{
|
|
||||||
return self::$setters;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Array of attributes to getter functions (for serialization of requests)
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public static function getters()
|
|
||||||
{
|
|
||||||
return self::$getters;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The original name of the model.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getModelName()
|
|
||||||
{
|
|
||||||
return self::$openAPIModelName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public const MAP_OF_ENUM_STRING_UPPER = 'UPPER';
|
|
||||||
public const MAP_OF_ENUM_STRING_LOWER = 'lower';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets allowable values of the enum
|
|
||||||
*
|
|
||||||
* @return string[]
|
|
||||||
*/
|
|
||||||
public function getMapOfEnumStringAllowableValues()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
self::MAP_OF_ENUM_STRING_UPPER,
|
|
||||||
self::MAP_OF_ENUM_STRING_LOWER,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Associative array for storing property values
|
|
||||||
*
|
|
||||||
* @var mixed[]
|
|
||||||
*/
|
|
||||||
protected $container = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param mixed[] $data Associated array of property values
|
|
||||||
* initializing the model
|
|
||||||
*/
|
|
||||||
public function __construct(array $data = null)
|
|
||||||
{
|
|
||||||
$this->setIfExists('map_map_of_string', $data ?? [], null);
|
|
||||||
$this->setIfExists('map_of_enum_string', $data ?? [], null);
|
|
||||||
$this->setIfExists('direct_map', $data ?? [], null);
|
|
||||||
$this->setIfExists('indirect_map', $data ?? [], null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
|
|
||||||
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
|
|
||||||
* $this->openAPINullablesSetToNull array
|
|
||||||
*
|
|
||||||
* @param string $variableName
|
|
||||||
* @param array $fields
|
|
||||||
* @param mixed $defaultValue
|
|
||||||
*/
|
|
||||||
private function setIfExists(string $variableName, array $fields, $defaultValue): void
|
|
||||||
{
|
|
||||||
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
|
|
||||||
$this->openAPINullablesSetToNull[] = $variableName;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show all the invalid properties with reasons.
|
|
||||||
*
|
|
||||||
* @return array invalid properties with reasons
|
|
||||||
*/
|
|
||||||
public function listInvalidProperties()
|
|
||||||
{
|
|
||||||
$invalidProperties = [];
|
|
||||||
|
|
||||||
return $invalidProperties;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validate all the properties in the model
|
|
||||||
* return true if all passed
|
|
||||||
*
|
|
||||||
* @return bool True if all properties are valid
|
|
||||||
*/
|
|
||||||
public function valid()
|
|
||||||
{
|
|
||||||
return count($this->listInvalidProperties()) === 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets map_map_of_string
|
|
||||||
*
|
|
||||||
* @return array<string,array<string,string>>|null
|
|
||||||
*/
|
|
||||||
public function getMapMapOfString()
|
|
||||||
{
|
|
||||||
return $this->container['map_map_of_string'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets map_map_of_string
|
|
||||||
*
|
|
||||||
* @param array<string,array<string,string>>|null $map_map_of_string map_map_of_string
|
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
public function setMapMapOfString($map_map_of_string)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (is_null($map_map_of_string)) {
|
|
||||||
throw new \InvalidArgumentException('non-nullable map_map_of_string cannot be null');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->container['map_map_of_string'] = $map_map_of_string;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets map_of_enum_string
|
|
||||||
*
|
|
||||||
* @return array<string,string>|null
|
|
||||||
*/
|
|
||||||
public function getMapOfEnumString()
|
|
||||||
{
|
|
||||||
return $this->container['map_of_enum_string'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets map_of_enum_string
|
|
||||||
*
|
|
||||||
* @param array<string,string>|null $map_of_enum_string map_of_enum_string
|
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
public function setMapOfEnumString($map_of_enum_string)
|
|
||||||
{
|
|
||||||
$allowedValues = $this->getMapOfEnumStringAllowableValues();
|
|
||||||
if (!is_null($map_of_enum_string) && array_diff($map_of_enum_string, $allowedValues)) {
|
|
||||||
throw new \InvalidArgumentException(
|
|
||||||
sprintf(
|
|
||||||
"Invalid value for 'map_of_enum_string', must be one of '%s'",
|
|
||||||
implode("', '", $allowedValues)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_null($map_of_enum_string)) {
|
|
||||||
throw new \InvalidArgumentException('non-nullable map_of_enum_string cannot be null');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->container['map_of_enum_string'] = $map_of_enum_string;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets direct_map
|
|
||||||
*
|
|
||||||
* @return array<string,bool>|null
|
|
||||||
*/
|
|
||||||
public function getDirectMap()
|
|
||||||
{
|
|
||||||
return $this->container['direct_map'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets direct_map
|
|
||||||
*
|
|
||||||
* @param array<string,bool>|null $direct_map direct_map
|
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
public function setDirectMap($direct_map)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (is_null($direct_map)) {
|
|
||||||
throw new \InvalidArgumentException('non-nullable direct_map cannot be null');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->container['direct_map'] = $direct_map;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets indirect_map
|
|
||||||
*
|
|
||||||
* @return array<string,bool>|null
|
|
||||||
*/
|
|
||||||
public function getIndirectMap()
|
|
||||||
{
|
|
||||||
return $this->container['indirect_map'];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets indirect_map
|
|
||||||
*
|
|
||||||
* @param array<string,bool>|null $indirect_map indirect_map
|
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
public function setIndirectMap($indirect_map)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (is_null($indirect_map)) {
|
|
||||||
throw new \InvalidArgumentException('non-nullable indirect_map cannot be null');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->container['indirect_map'] = $indirect_map;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Returns true if offset exists. False otherwise.
|
|
||||||
*
|
|
||||||
* @param integer $offset Offset
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public function offsetExists($offset): bool
|
|
||||||
{
|
|
||||||
return isset($this->container[$offset]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets offset.
|
|
||||||
*
|
|
||||||
* @param integer $offset Offset
|
|
||||||
*
|
|
||||||
* @return mixed|null
|
|
||||||
*/
|
|
||||||
#[\ReturnTypeWillChange]
|
|
||||||
public function offsetGet($offset)
|
|
||||||
{
|
|
||||||
return $this->container[$offset] ?? null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets value based on offset.
|
|
||||||
*
|
|
||||||
* @param int|null $offset Offset
|
|
||||||
* @param mixed $value Value to be set
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function offsetSet($offset, $value): void
|
|
||||||
{
|
|
||||||
if (is_null($offset)) {
|
|
||||||
$this->container[] = $value;
|
|
||||||
} else {
|
|
||||||
$this->container[$offset] = $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unsets offset.
|
|
||||||
*
|
|
||||||
* @param integer $offset Offset
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function offsetUnset($offset): void
|
|
||||||
{
|
|
||||||
unset($this->container[$offset]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Serializes the object to a value that can be serialized natively by json_encode().
|
|
||||||
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
|
|
||||||
*
|
|
||||||
* @return mixed Returns data which can be serialized by json_encode(), which is a value
|
|
||||||
* of any type other than a resource.
|
|
||||||
*/
|
|
||||||
#[\ReturnTypeWillChange]
|
|
||||||
public function jsonSerialize()
|
|
||||||
{
|
|
||||||
return ObjectSerializer::sanitizeForSerialization($this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the string presentation of the object
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function __toString()
|
|
||||||
{
|
|
||||||
return json_encode(
|
|
||||||
ObjectSerializer::sanitizeForSerialization($this),
|
|
||||||
JSON_PRETTY_PRINT
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a header-safe presentation of the object
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function toHeaderValue()
|
|
||||||
{
|
|
||||||
return json_encode(ObjectSerializer::sanitizeForSerialization($this));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
|||||||
# OuterEnumDefaultValue
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
- Prepare the resource
|
|
||||||
```powershell
|
|
||||||
$OuterEnumDefaultValue = Initialize-PSPetstoreOuterEnumDefaultValue
|
|
||||||
```
|
|
||||||
|
|
||||||
- Convert the resource to JSON
|
|
||||||
```powershell
|
|
||||||
$OuterEnumDefaultValue | ConvertTo-JSON
|
|
||||||
```
|
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
|
||||||
|
|
@ -1,97 +0,0 @@
|
|||||||
#
|
|
||||||
# OpenAPI Petstore
|
|
||||||
# This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: "" \
|
|
||||||
# Version: 1.0.0
|
|
||||||
# Generated by OpenAPI Generator: https://openapi-generator.tech
|
|
||||||
#
|
|
||||||
|
|
||||||
<#
|
|
||||||
.SYNOPSIS
|
|
||||||
|
|
||||||
No summary available.
|
|
||||||
|
|
||||||
.DESCRIPTION
|
|
||||||
|
|
||||||
No description available.
|
|
||||||
|
|
||||||
.PARAMETER Breed
|
|
||||||
No description available.
|
|
||||||
.OUTPUTS
|
|
||||||
|
|
||||||
DogAllOf<PSCustomObject>
|
|
||||||
#>
|
|
||||||
|
|
||||||
function Initialize-PSDogAllOf {
|
|
||||||
[CmdletBinding()]
|
|
||||||
Param (
|
|
||||||
[Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
|
|
||||||
[String]
|
|
||||||
${Breed}
|
|
||||||
)
|
|
||||||
|
|
||||||
Process {
|
|
||||||
'Creating PSCustomObject: PSPetstore => PSDogAllOf' | Write-Debug
|
|
||||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
|
||||||
|
|
||||||
|
|
||||||
$PSO = [PSCustomObject]@{
|
|
||||||
"breed" = ${Breed}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return $PSO
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
<#
|
|
||||||
.SYNOPSIS
|
|
||||||
|
|
||||||
Convert from JSON to DogAllOf<PSCustomObject>
|
|
||||||
|
|
||||||
.DESCRIPTION
|
|
||||||
|
|
||||||
Convert from JSON to DogAllOf<PSCustomObject>
|
|
||||||
|
|
||||||
.PARAMETER Json
|
|
||||||
|
|
||||||
Json object
|
|
||||||
|
|
||||||
.OUTPUTS
|
|
||||||
|
|
||||||
DogAllOf<PSCustomObject>
|
|
||||||
#>
|
|
||||||
function ConvertFrom-PSJsonToDogAllOf {
|
|
||||||
Param(
|
|
||||||
[AllowEmptyString()]
|
|
||||||
[string]$Json
|
|
||||||
)
|
|
||||||
|
|
||||||
Process {
|
|
||||||
'Converting JSON to PSCustomObject: PSPetstore => PSDogAllOf' | Write-Debug
|
|
||||||
$PSBoundParameters | Out-DebugParameter | Write-Debug
|
|
||||||
|
|
||||||
$JsonParameters = ConvertFrom-Json -InputObject $Json
|
|
||||||
|
|
||||||
# check if Json contains properties not defined in PSDogAllOf
|
|
||||||
$AllProperties = ("breed")
|
|
||||||
foreach ($name in $JsonParameters.PsObject.Properties.Name) {
|
|
||||||
if (!($AllProperties.Contains($name))) {
|
|
||||||
throw "Error! JSON key '$name' not found in the properties: $($AllProperties)"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!([bool]($JsonParameters.PSobject.Properties.name -match "breed"))) { #optional property not found
|
|
||||||
$Breed = $null
|
|
||||||
} else {
|
|
||||||
$Breed = $JsonParameters.PSobject.Properties["breed"].value
|
|
||||||
}
|
|
||||||
|
|
||||||
$PSO = [PSCustomObject]@{
|
|
||||||
"breed" = ${Breed}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $PSO
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
|||||||
# Pet
|
|
||||||
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
**id** | **int** | | [optional]
|
|
||||||
**category** | [**Category**](Category.md) | | [optional]
|
|
||||||
**name** | **str** | |
|
|
||||||
**photo_urls** | **list[str]** | |
|
|
||||||
**tags** | [**list[Tag]**](Tag.md) | | [optional]
|
|
||||||
**status** | **str** | pet status in the store | [optional]
|
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
|
||||||
|
|
||||||
|
|
@ -1,131 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
OpenAPI Petstore
|
|
||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 1.0.0
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
|
||||||
from inspect import getfullargspec
|
|
||||||
except ImportError:
|
|
||||||
from inspect import getargspec as getfullargspec
|
|
||||||
import pprint
|
|
||||||
import re # noqa: F401
|
|
||||||
import six
|
|
||||||
|
|
||||||
from petstore_api.configuration import Configuration
|
|
||||||
|
|
||||||
|
|
||||||
class ClassModel(object):
|
|
||||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
|
||||||
Ref: https://openapi-generator.tech
|
|
||||||
|
|
||||||
Do not edit the class manually.
|
|
||||||
"""
|
|
||||||
|
|
||||||
"""
|
|
||||||
Attributes:
|
|
||||||
openapi_types (dict): The key is attribute name
|
|
||||||
and the value is attribute type.
|
|
||||||
attribute_map (dict): The key is attribute name
|
|
||||||
and the value is json key in definition.
|
|
||||||
"""
|
|
||||||
openapi_types = {
|
|
||||||
'_class': 'str'
|
|
||||||
}
|
|
||||||
|
|
||||||
attribute_map = {
|
|
||||||
'_class': '_class'
|
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(self, _class=None, local_vars_configuration=None): # noqa: E501
|
|
||||||
"""ClassModel - a model defined in OpenAPI""" # noqa: E501
|
|
||||||
if local_vars_configuration is None:
|
|
||||||
local_vars_configuration = Configuration.get_default_copy()
|
|
||||||
self.local_vars_configuration = local_vars_configuration
|
|
||||||
|
|
||||||
self.__class = None
|
|
||||||
self.discriminator = None
|
|
||||||
|
|
||||||
if _class is not None:
|
|
||||||
self._class = _class
|
|
||||||
|
|
||||||
@property
|
|
||||||
def _class(self):
|
|
||||||
"""Gets the _class of this ClassModel. # noqa: E501
|
|
||||||
|
|
||||||
|
|
||||||
:return: The _class of this ClassModel. # noqa: E501
|
|
||||||
:rtype: str
|
|
||||||
"""
|
|
||||||
return self.__class
|
|
||||||
|
|
||||||
@_class.setter
|
|
||||||
def _class(self, _class):
|
|
||||||
"""Sets the _class of this ClassModel.
|
|
||||||
|
|
||||||
|
|
||||||
:param _class: The _class of this ClassModel. # noqa: E501
|
|
||||||
:type _class: str
|
|
||||||
"""
|
|
||||||
|
|
||||||
self.__class = _class
|
|
||||||
|
|
||||||
def to_dict(self, serialize=False):
|
|
||||||
"""Returns the model properties as a dict"""
|
|
||||||
result = {}
|
|
||||||
|
|
||||||
def convert(x):
|
|
||||||
if hasattr(x, "to_dict"):
|
|
||||||
args = getfullargspec(x.to_dict).args
|
|
||||||
if len(args) == 1:
|
|
||||||
return x.to_dict()
|
|
||||||
else:
|
|
||||||
return x.to_dict(serialize)
|
|
||||||
else:
|
|
||||||
return x
|
|
||||||
|
|
||||||
for attr, _ in six.iteritems(self.openapi_types):
|
|
||||||
value = getattr(self, attr)
|
|
||||||
attr = self.attribute_map.get(attr, attr) if serialize else attr
|
|
||||||
if isinstance(value, list):
|
|
||||||
result[attr] = list(map(
|
|
||||||
lambda x: convert(x),
|
|
||||||
value
|
|
||||||
))
|
|
||||||
elif isinstance(value, dict):
|
|
||||||
result[attr] = dict(map(
|
|
||||||
lambda item: (item[0], convert(item[1])),
|
|
||||||
value.items()
|
|
||||||
))
|
|
||||||
else:
|
|
||||||
result[attr] = convert(value)
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
def to_str(self):
|
|
||||||
"""Returns the string representation of the model"""
|
|
||||||
return pprint.pformat(self.to_dict())
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
"""For `print` and `pprint`"""
|
|
||||||
return self.to_str()
|
|
||||||
|
|
||||||
def __eq__(self, other):
|
|
||||||
"""Returns true if both objects are equal"""
|
|
||||||
if not isinstance(other, ClassModel):
|
|
||||||
return False
|
|
||||||
|
|
||||||
return self.to_dict() == other.to_dict()
|
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
"""Returns true if both objects are not equal"""
|
|
||||||
if not isinstance(other, ClassModel):
|
|
||||||
return True
|
|
||||||
|
|
||||||
return self.to_dict() != other.to_dict()
|
|
@ -1,131 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
OpenAPI Petstore
|
|
||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 1.0.0
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
|
||||||
from inspect import getfullargspec
|
|
||||||
except ImportError:
|
|
||||||
from inspect import getargspec as getfullargspec
|
|
||||||
import pprint
|
|
||||||
import re # noqa: F401
|
|
||||||
import six
|
|
||||||
|
|
||||||
from petstore_api.configuration import Configuration
|
|
||||||
|
|
||||||
|
|
||||||
class AdditionalPropertiesArray(object):
|
|
||||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
|
||||||
Ref: https://openapi-generator.tech
|
|
||||||
|
|
||||||
Do not edit the class manually.
|
|
||||||
"""
|
|
||||||
|
|
||||||
"""
|
|
||||||
Attributes:
|
|
||||||
openapi_types (dict): The key is attribute name
|
|
||||||
and the value is attribute type.
|
|
||||||
attribute_map (dict): The key is attribute name
|
|
||||||
and the value is json key in definition.
|
|
||||||
"""
|
|
||||||
openapi_types = {
|
|
||||||
'name': 'str'
|
|
||||||
}
|
|
||||||
|
|
||||||
attribute_map = {
|
|
||||||
'name': 'name'
|
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(self, name=None, local_vars_configuration=None): # noqa: E501
|
|
||||||
"""AdditionalPropertiesArray - a model defined in OpenAPI""" # noqa: E501
|
|
||||||
if local_vars_configuration is None:
|
|
||||||
local_vars_configuration = Configuration.get_default_copy()
|
|
||||||
self.local_vars_configuration = local_vars_configuration
|
|
||||||
|
|
||||||
self._name = None
|
|
||||||
self.discriminator = None
|
|
||||||
|
|
||||||
if name is not None:
|
|
||||||
self.name = name
|
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self):
|
|
||||||
"""Gets the name of this AdditionalPropertiesArray. # noqa: E501
|
|
||||||
|
|
||||||
|
|
||||||
:return: The name of this AdditionalPropertiesArray. # noqa: E501
|
|
||||||
:rtype: str
|
|
||||||
"""
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
@name.setter
|
|
||||||
def name(self, name):
|
|
||||||
"""Sets the name of this AdditionalPropertiesArray.
|
|
||||||
|
|
||||||
|
|
||||||
:param name: The name of this AdditionalPropertiesArray. # noqa: E501
|
|
||||||
:type name: str
|
|
||||||
"""
|
|
||||||
|
|
||||||
self._name = name
|
|
||||||
|
|
||||||
def to_dict(self, serialize=False):
|
|
||||||
"""Returns the model properties as a dict"""
|
|
||||||
result = {}
|
|
||||||
|
|
||||||
def convert(x):
|
|
||||||
if hasattr(x, "to_dict"):
|
|
||||||
args = getfullargspec(x.to_dict).args
|
|
||||||
if len(args) == 1:
|
|
||||||
return x.to_dict()
|
|
||||||
else:
|
|
||||||
return x.to_dict(serialize)
|
|
||||||
else:
|
|
||||||
return x
|
|
||||||
|
|
||||||
for attr, _ in six.iteritems(self.openapi_types):
|
|
||||||
value = getattr(self, attr)
|
|
||||||
attr = self.attribute_map.get(attr, attr) if serialize else attr
|
|
||||||
if isinstance(value, list):
|
|
||||||
result[attr] = list(map(
|
|
||||||
lambda x: convert(x),
|
|
||||||
value
|
|
||||||
))
|
|
||||||
elif isinstance(value, dict):
|
|
||||||
result[attr] = dict(map(
|
|
||||||
lambda item: (item[0], convert(item[1])),
|
|
||||||
value.items()
|
|
||||||
))
|
|
||||||
else:
|
|
||||||
result[attr] = convert(value)
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
def to_str(self):
|
|
||||||
"""Returns the string representation of the model"""
|
|
||||||
return pprint.pformat(self.to_dict())
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
"""For `print` and `pprint`"""
|
|
||||||
return self.to_str()
|
|
||||||
|
|
||||||
def __eq__(self, other):
|
|
||||||
"""Returns true if both objects are equal"""
|
|
||||||
if not isinstance(other, AdditionalPropertiesArray):
|
|
||||||
return False
|
|
||||||
|
|
||||||
return self.to_dict() == other.to_dict()
|
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
"""Returns true if both objects are not equal"""
|
|
||||||
if not isinstance(other, AdditionalPropertiesArray):
|
|
||||||
return True
|
|
||||||
|
|
||||||
return self.to_dict() != other.to_dict()
|
|
@ -1,21 +0,0 @@
|
|||||||
# AdditionalPropertiesClass
|
|
||||||
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
**map_string** | **dict(str, str)** | | [optional]
|
|
||||||
**map_number** | **dict(str, float)** | | [optional]
|
|
||||||
**map_integer** | **dict(str, int)** | | [optional]
|
|
||||||
**map_boolean** | **dict(str, bool)** | | [optional]
|
|
||||||
**map_array_integer** | **dict(str, list[int])** | | [optional]
|
|
||||||
**map_array_anytype** | **dict(str, list[object])** | | [optional]
|
|
||||||
**map_map_string** | **dict(str, dict(str, str))** | | [optional]
|
|
||||||
**map_map_anytype** | **dict(str, dict(str, object))** | | [optional]
|
|
||||||
**anytype_1** | **object** | | [optional]
|
|
||||||
**anytype_2** | **object** | | [optional]
|
|
||||||
**anytype_3** | **object** | | [optional]
|
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
|
||||||
|
|
||||||
|
|
@ -1,183 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
OpenAPI Petstore
|
|
||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 1.0.0
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
|
||||||
from inspect import getfullargspec
|
|
||||||
except ImportError:
|
|
||||||
from inspect import getargspec as getfullargspec
|
|
||||||
import pprint
|
|
||||||
import re # noqa: F401
|
|
||||||
import six
|
|
||||||
|
|
||||||
from petstore_api.configuration import Configuration
|
|
||||||
|
|
||||||
|
|
||||||
class ApiResponse(object):
|
|
||||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
|
||||||
Ref: https://openapi-generator.tech
|
|
||||||
|
|
||||||
Do not edit the class manually.
|
|
||||||
"""
|
|
||||||
|
|
||||||
"""
|
|
||||||
Attributes:
|
|
||||||
openapi_types (dict): The key is attribute name
|
|
||||||
and the value is attribute type.
|
|
||||||
attribute_map (dict): The key is attribute name
|
|
||||||
and the value is json key in definition.
|
|
||||||
"""
|
|
||||||
openapi_types = {
|
|
||||||
'code': 'int',
|
|
||||||
'type': 'str',
|
|
||||||
'message': 'str'
|
|
||||||
}
|
|
||||||
|
|
||||||
attribute_map = {
|
|
||||||
'code': 'code',
|
|
||||||
'type': 'type',
|
|
||||||
'message': 'message'
|
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(self, code=None, type=None, message=None, local_vars_configuration=None): # noqa: E501
|
|
||||||
"""ApiResponse - a model defined in OpenAPI""" # noqa: E501
|
|
||||||
if local_vars_configuration is None:
|
|
||||||
local_vars_configuration = Configuration.get_default_copy()
|
|
||||||
self.local_vars_configuration = local_vars_configuration
|
|
||||||
|
|
||||||
self._code = None
|
|
||||||
self._type = None
|
|
||||||
self._message = None
|
|
||||||
self.discriminator = None
|
|
||||||
|
|
||||||
if code is not None:
|
|
||||||
self.code = code
|
|
||||||
if type is not None:
|
|
||||||
self.type = type
|
|
||||||
if message is not None:
|
|
||||||
self.message = message
|
|
||||||
|
|
||||||
@property
|
|
||||||
def code(self):
|
|
||||||
"""Gets the code of this ApiResponse. # noqa: E501
|
|
||||||
|
|
||||||
|
|
||||||
:return: The code of this ApiResponse. # noqa: E501
|
|
||||||
:rtype: int
|
|
||||||
"""
|
|
||||||
return self._code
|
|
||||||
|
|
||||||
@code.setter
|
|
||||||
def code(self, code):
|
|
||||||
"""Sets the code of this ApiResponse.
|
|
||||||
|
|
||||||
|
|
||||||
:param code: The code of this ApiResponse. # noqa: E501
|
|
||||||
:type code: int
|
|
||||||
"""
|
|
||||||
|
|
||||||
self._code = code
|
|
||||||
|
|
||||||
@property
|
|
||||||
def type(self):
|
|
||||||
"""Gets the type of this ApiResponse. # noqa: E501
|
|
||||||
|
|
||||||
|
|
||||||
:return: The type of this ApiResponse. # noqa: E501
|
|
||||||
:rtype: str
|
|
||||||
"""
|
|
||||||
return self._type
|
|
||||||
|
|
||||||
@type.setter
|
|
||||||
def type(self, type):
|
|
||||||
"""Sets the type of this ApiResponse.
|
|
||||||
|
|
||||||
|
|
||||||
:param type: The type of this ApiResponse. # noqa: E501
|
|
||||||
:type type: str
|
|
||||||
"""
|
|
||||||
|
|
||||||
self._type = type
|
|
||||||
|
|
||||||
@property
|
|
||||||
def message(self):
|
|
||||||
"""Gets the message of this ApiResponse. # noqa: E501
|
|
||||||
|
|
||||||
|
|
||||||
:return: The message of this ApiResponse. # noqa: E501
|
|
||||||
:rtype: str
|
|
||||||
"""
|
|
||||||
return self._message
|
|
||||||
|
|
||||||
@message.setter
|
|
||||||
def message(self, message):
|
|
||||||
"""Sets the message of this ApiResponse.
|
|
||||||
|
|
||||||
|
|
||||||
:param message: The message of this ApiResponse. # noqa: E501
|
|
||||||
:type message: str
|
|
||||||
"""
|
|
||||||
|
|
||||||
self._message = message
|
|
||||||
|
|
||||||
def to_dict(self, serialize=False):
|
|
||||||
"""Returns the model properties as a dict"""
|
|
||||||
result = {}
|
|
||||||
|
|
||||||
def convert(x):
|
|
||||||
if hasattr(x, "to_dict"):
|
|
||||||
args = getfullargspec(x.to_dict).args
|
|
||||||
if len(args) == 1:
|
|
||||||
return x.to_dict()
|
|
||||||
else:
|
|
||||||
return x.to_dict(serialize)
|
|
||||||
else:
|
|
||||||
return x
|
|
||||||
|
|
||||||
for attr, _ in six.iteritems(self.openapi_types):
|
|
||||||
value = getattr(self, attr)
|
|
||||||
attr = self.attribute_map.get(attr, attr) if serialize else attr
|
|
||||||
if isinstance(value, list):
|
|
||||||
result[attr] = list(map(
|
|
||||||
lambda x: convert(x),
|
|
||||||
value
|
|
||||||
))
|
|
||||||
elif isinstance(value, dict):
|
|
||||||
result[attr] = dict(map(
|
|
||||||
lambda item: (item[0], convert(item[1])),
|
|
||||||
value.items()
|
|
||||||
))
|
|
||||||
else:
|
|
||||||
result[attr] = convert(value)
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
def to_str(self):
|
|
||||||
"""Returns the string representation of the model"""
|
|
||||||
return pprint.pformat(self.to_dict())
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
"""For `print` and `pprint`"""
|
|
||||||
return self.to_str()
|
|
||||||
|
|
||||||
def __eq__(self, other):
|
|
||||||
"""Returns true if both objects are equal"""
|
|
||||||
if not isinstance(other, ApiResponse):
|
|
||||||
return False
|
|
||||||
|
|
||||||
return self.to_dict() == other.to_dict()
|
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
"""Returns true if both objects are not equal"""
|
|
||||||
if not isinstance(other, ApiResponse):
|
|
||||||
return True
|
|
||||||
|
|
||||||
return self.to_dict() != other.to_dict()
|
|
@ -1,12 +0,0 @@
|
|||||||
# AdditionalPropertiesNumber
|
|
||||||
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
Name | Type | Description | Notes
|
|
||||||
------------ | ------------- | ------------- | -------------
|
|
||||||
**name** | **str** | | [optional]
|
|
||||||
**any string name** | **float** | any string name can be used but the value must be the correct type | [optional]
|
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
|
||||||
|
|
||||||
|
|
@ -1,263 +0,0 @@
|
|||||||
"""
|
|
||||||
OpenAPI Petstore
|
|
||||||
|
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 1.0.0
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
import re # noqa: F401
|
|
||||||
import sys # noqa: F401
|
|
||||||
|
|
||||||
from petstore_api.model_utils import ( # noqa: F401
|
|
||||||
ApiTypeError,
|
|
||||||
ModelComposed,
|
|
||||||
ModelNormal,
|
|
||||||
ModelSimple,
|
|
||||||
cached_property,
|
|
||||||
change_keys_js_to_python,
|
|
||||||
convert_js_args_to_python_args,
|
|
||||||
date,
|
|
||||||
datetime,
|
|
||||||
file_type,
|
|
||||||
none_type,
|
|
||||||
validate_get_composed_info,
|
|
||||||
OpenApiModel
|
|
||||||
)
|
|
||||||
from petstore_api.exceptions import ApiAttributeError
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class AdditionalPropertiesNumber(ModelNormal):
|
|
||||||
"""NOTE: This class is auto generated by OpenAPI Generator.
|
|
||||||
Ref: https://openapi-generator.tech
|
|
||||||
|
|
||||||
Do not edit the class manually.
|
|
||||||
|
|
||||||
Attributes:
|
|
||||||
allowed_values (dict): The key is the tuple path to the attribute
|
|
||||||
and the for var_name this is (var_name,). The value is a dict
|
|
||||||
with a capitalized key describing the allowed value and an allowed
|
|
||||||
value. These dicts store the allowed enum values.
|
|
||||||
attribute_map (dict): The key is attribute name
|
|
||||||
and the value is json key in definition.
|
|
||||||
discriminator_value_class_map (dict): A dict to go from the discriminator
|
|
||||||
variable value to the discriminator class name.
|
|
||||||
validations (dict): The key is the tuple path to the attribute
|
|
||||||
and the for var_name this is (var_name,). The value is a dict
|
|
||||||
that stores validations for max_length, min_length, max_items,
|
|
||||||
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
|
|
||||||
inclusive_minimum, and regex.
|
|
||||||
additional_properties_type (tuple): A tuple of classes accepted
|
|
||||||
as additional properties values.
|
|
||||||
"""
|
|
||||||
|
|
||||||
allowed_values = {
|
|
||||||
}
|
|
||||||
|
|
||||||
validations = {
|
|
||||||
}
|
|
||||||
|
|
||||||
@cached_property
|
|
||||||
def additional_properties_type():
|
|
||||||
"""
|
|
||||||
This must be a method because a model may have properties that are
|
|
||||||
of type self, this must run after the class is loaded
|
|
||||||
"""
|
|
||||||
return (float,) # noqa: E501
|
|
||||||
|
|
||||||
_nullable = False
|
|
||||||
|
|
||||||
@cached_property
|
|
||||||
def openapi_types():
|
|
||||||
"""
|
|
||||||
This must be a method because a model may have properties that are
|
|
||||||
of type self, this must run after the class is loaded
|
|
||||||
|
|
||||||
Returns
|
|
||||||
openapi_types (dict): The key is attribute name
|
|
||||||
and the value is attribute type.
|
|
||||||
"""
|
|
||||||
return {
|
|
||||||
'name': (str,), # noqa: E501
|
|
||||||
}
|
|
||||||
|
|
||||||
@cached_property
|
|
||||||
def discriminator():
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
attribute_map = {
|
|
||||||
'name': 'name', # noqa: E501
|
|
||||||
}
|
|
||||||
|
|
||||||
read_only_vars = {
|
|
||||||
}
|
|
||||||
|
|
||||||
_composed_schemas = {}
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
@convert_js_args_to_python_args
|
|
||||||
def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
|
|
||||||
"""AdditionalPropertiesNumber - a model defined in OpenAPI
|
|
||||||
|
|
||||||
Keyword Args:
|
|
||||||
_check_type (bool): if True, values for parameters in openapi_types
|
|
||||||
will be type checked and a TypeError will be
|
|
||||||
raised if the wrong type is input.
|
|
||||||
Defaults to True
|
|
||||||
_path_to_item (tuple/list): This is a list of keys or values to
|
|
||||||
drill down to the model in received_data
|
|
||||||
when deserializing a response
|
|
||||||
_spec_property_naming (bool): True if the variable names in the input data
|
|
||||||
are serialized names, as specified in the OpenAPI document.
|
|
||||||
False if the variable names in the input data
|
|
||||||
are pythonic names, e.g. snake case (default)
|
|
||||||
_configuration (Configuration): the instance to use when
|
|
||||||
deserializing a file_type parameter.
|
|
||||||
If passed, type conversion is attempted
|
|
||||||
If omitted no type conversion is done.
|
|
||||||
_visited_composed_classes (tuple): This stores a tuple of
|
|
||||||
classes that we have traveled through so that
|
|
||||||
if we see that class again we will not use its
|
|
||||||
discriminator again.
|
|
||||||
When traveling through a discriminator, the
|
|
||||||
composed schema that is
|
|
||||||
is traveled through is added to this set.
|
|
||||||
For example if Animal has a discriminator
|
|
||||||
petType and we pass in "Dog", and the class Dog
|
|
||||||
allOf includes Animal, we move through Animal
|
|
||||||
once using the discriminator, and pick Dog.
|
|
||||||
Then in Dog, we will make an instance of the
|
|
||||||
Animal class but this time we won't travel
|
|
||||||
through its discriminator because we passed in
|
|
||||||
_visited_composed_classes = (Animal,)
|
|
||||||
name (str): [optional] # noqa: E501
|
|
||||||
"""
|
|
||||||
|
|
||||||
_check_type = kwargs.pop('_check_type', True)
|
|
||||||
_spec_property_naming = kwargs.pop('_spec_property_naming', True)
|
|
||||||
_path_to_item = kwargs.pop('_path_to_item', ())
|
|
||||||
_configuration = kwargs.pop('_configuration', None)
|
|
||||||
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
|
|
||||||
|
|
||||||
self = super(OpenApiModel, cls).__new__(cls)
|
|
||||||
|
|
||||||
if args:
|
|
||||||
for arg in args:
|
|
||||||
if isinstance(arg, dict):
|
|
||||||
kwargs.update(arg)
|
|
||||||
else:
|
|
||||||
raise ApiTypeError(
|
|
||||||
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
|
|
||||||
args,
|
|
||||||
self.__class__.__name__,
|
|
||||||
),
|
|
||||||
path_to_item=_path_to_item,
|
|
||||||
valid_classes=(self.__class__,),
|
|
||||||
)
|
|
||||||
|
|
||||||
self._data_store = {}
|
|
||||||
self._check_type = _check_type
|
|
||||||
self._spec_property_naming = _spec_property_naming
|
|
||||||
self._path_to_item = _path_to_item
|
|
||||||
self._configuration = _configuration
|
|
||||||
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
|
|
||||||
|
|
||||||
for var_name, var_value in kwargs.items():
|
|
||||||
if var_name not in self.attribute_map and \
|
|
||||||
self._configuration is not None and \
|
|
||||||
self._configuration.discard_unknown_keys and \
|
|
||||||
self.additional_properties_type is None:
|
|
||||||
# discard variable.
|
|
||||||
continue
|
|
||||||
setattr(self, var_name, var_value)
|
|
||||||
return self
|
|
||||||
|
|
||||||
required_properties = set([
|
|
||||||
'_data_store',
|
|
||||||
'_check_type',
|
|
||||||
'_spec_property_naming',
|
|
||||||
'_path_to_item',
|
|
||||||
'_configuration',
|
|
||||||
'_visited_composed_classes',
|
|
||||||
])
|
|
||||||
|
|
||||||
@convert_js_args_to_python_args
|
|
||||||
def __init__(self, *args, **kwargs): # noqa: E501
|
|
||||||
"""AdditionalPropertiesNumber - a model defined in OpenAPI
|
|
||||||
|
|
||||||
Keyword Args:
|
|
||||||
_check_type (bool): if True, values for parameters in openapi_types
|
|
||||||
will be type checked and a TypeError will be
|
|
||||||
raised if the wrong type is input.
|
|
||||||
Defaults to True
|
|
||||||
_path_to_item (tuple/list): This is a list of keys or values to
|
|
||||||
drill down to the model in received_data
|
|
||||||
when deserializing a response
|
|
||||||
_spec_property_naming (bool): True if the variable names in the input data
|
|
||||||
are serialized names, as specified in the OpenAPI document.
|
|
||||||
False if the variable names in the input data
|
|
||||||
are pythonic names, e.g. snake case (default)
|
|
||||||
_configuration (Configuration): the instance to use when
|
|
||||||
deserializing a file_type parameter.
|
|
||||||
If passed, type conversion is attempted
|
|
||||||
If omitted no type conversion is done.
|
|
||||||
_visited_composed_classes (tuple): This stores a tuple of
|
|
||||||
classes that we have traveled through so that
|
|
||||||
if we see that class again we will not use its
|
|
||||||
discriminator again.
|
|
||||||
When traveling through a discriminator, the
|
|
||||||
composed schema that is
|
|
||||||
is traveled through is added to this set.
|
|
||||||
For example if Animal has a discriminator
|
|
||||||
petType and we pass in "Dog", and the class Dog
|
|
||||||
allOf includes Animal, we move through Animal
|
|
||||||
once using the discriminator, and pick Dog.
|
|
||||||
Then in Dog, we will make an instance of the
|
|
||||||
Animal class but this time we won't travel
|
|
||||||
through its discriminator because we passed in
|
|
||||||
_visited_composed_classes = (Animal,)
|
|
||||||
name (str): [optional] # noqa: E501
|
|
||||||
"""
|
|
||||||
|
|
||||||
_check_type = kwargs.pop('_check_type', True)
|
|
||||||
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
|
|
||||||
_path_to_item = kwargs.pop('_path_to_item', ())
|
|
||||||
_configuration = kwargs.pop('_configuration', None)
|
|
||||||
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
|
|
||||||
|
|
||||||
if args:
|
|
||||||
for arg in args:
|
|
||||||
if isinstance(arg, dict):
|
|
||||||
kwargs.update(arg)
|
|
||||||
else:
|
|
||||||
raise ApiTypeError(
|
|
||||||
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
|
|
||||||
args,
|
|
||||||
self.__class__.__name__,
|
|
||||||
),
|
|
||||||
path_to_item=_path_to_item,
|
|
||||||
valid_classes=(self.__class__,),
|
|
||||||
)
|
|
||||||
|
|
||||||
self._data_store = {}
|
|
||||||
self._check_type = _check_type
|
|
||||||
self._spec_property_naming = _spec_property_naming
|
|
||||||
self._path_to_item = _path_to_item
|
|
||||||
self._configuration = _configuration
|
|
||||||
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
|
|
||||||
|
|
||||||
for var_name, var_value in kwargs.items():
|
|
||||||
if var_name not in self.attribute_map and \
|
|
||||||
self._configuration is not None and \
|
|
||||||
self._configuration.discard_unknown_keys and \
|
|
||||||
self.additional_properties_type is None:
|
|
||||||
# discard variable.
|
|
||||||
continue
|
|
||||||
setattr(self, var_name, var_value)
|
|
||||||
if var_name in self.read_only_vars:
|
|
||||||
raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
|
|
||||||
f"class with read only attributes.")
|
|
@ -1,20 +0,0 @@
|
|||||||
# Petstore::AllOfWithSingleRef
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
| Name | Type | Description | Notes |
|
|
||||||
| ---- | ---- | ----------- | ----- |
|
|
||||||
| **username** | **String** | | [optional] |
|
|
||||||
| **single_ref_type** | [**SingleRefType**](SingleRefType.md) | | [optional] |
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
```ruby
|
|
||||||
require 'petstore'
|
|
||||||
|
|
||||||
instance = Petstore::AllOfWithSingleRef.new(
|
|
||||||
username: null,
|
|
||||||
single_ref_type: null
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
@ -1,221 +0,0 @@
|
|||||||
=begin
|
|
||||||
#OpenAPI Petstore
|
|
||||||
|
|
||||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 1.0.0
|
|
||||||
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
OpenAPI Generator version: 6.1.0-SNAPSHOT
|
|
||||||
|
|
||||||
=end
|
|
||||||
|
|
||||||
require 'date'
|
|
||||||
require 'time'
|
|
||||||
|
|
||||||
module Petstore
|
|
||||||
class ArrayOfArrayOfNumberOnly
|
|
||||||
attr_accessor :array_array_number
|
|
||||||
|
|
||||||
# Attribute mapping from ruby-style variable name to JSON key.
|
|
||||||
def self.attribute_map
|
|
||||||
{
|
|
||||||
:'array_array_number' => :'ArrayArrayNumber'
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
# Returns all the JSON keys this model knows about
|
|
||||||
def self.acceptable_attributes
|
|
||||||
attribute_map.values
|
|
||||||
end
|
|
||||||
|
|
||||||
# Attribute type mapping.
|
|
||||||
def self.openapi_types
|
|
||||||
{
|
|
||||||
:'array_array_number' => :'Array<Array<Float>>'
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
# List of attributes with nullable: true
|
|
||||||
def self.openapi_nullable
|
|
||||||
Set.new([
|
|
||||||
])
|
|
||||||
end
|
|
||||||
|
|
||||||
# Initializes the object
|
|
||||||
# @param [Hash] attributes Model attributes in the form of hash
|
|
||||||
def initialize(attributes = {})
|
|
||||||
if (!attributes.is_a?(Hash))
|
|
||||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::ArrayOfArrayOfNumberOnly` initialize method"
|
|
||||||
end
|
|
||||||
|
|
||||||
# check to see if the attribute exists and convert string to symbol for hash key
|
|
||||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
||||||
if (!self.class.attribute_map.key?(k.to_sym))
|
|
||||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::ArrayOfArrayOfNumberOnly`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
||||||
end
|
|
||||||
h[k.to_sym] = v
|
|
||||||
}
|
|
||||||
|
|
||||||
if attributes.key?(:'array_array_number')
|
|
||||||
if (value = attributes[:'array_array_number']).is_a?(Array)
|
|
||||||
self.array_array_number = value
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Show invalid properties with the reasons. Usually used together with valid?
|
|
||||||
# @return Array for valid properties with the reasons
|
|
||||||
def list_invalid_properties
|
|
||||||
invalid_properties = Array.new
|
|
||||||
invalid_properties
|
|
||||||
end
|
|
||||||
|
|
||||||
# Check to see if the all the properties in the model are valid
|
|
||||||
# @return true if the model is valid
|
|
||||||
def valid?
|
|
||||||
true
|
|
||||||
end
|
|
||||||
|
|
||||||
# Checks equality by comparing each attribute.
|
|
||||||
# @param [Object] Object to be compared
|
|
||||||
def ==(o)
|
|
||||||
return true if self.equal?(o)
|
|
||||||
self.class == o.class &&
|
|
||||||
array_array_number == o.array_array_number
|
|
||||||
end
|
|
||||||
|
|
||||||
# @see the `==` method
|
|
||||||
# @param [Object] Object to be compared
|
|
||||||
def eql?(o)
|
|
||||||
self == o
|
|
||||||
end
|
|
||||||
|
|
||||||
# Calculates hash code according to all attributes.
|
|
||||||
# @return [Integer] Hash code
|
|
||||||
def hash
|
|
||||||
[array_array_number].hash
|
|
||||||
end
|
|
||||||
|
|
||||||
# Builds the object from hash
|
|
||||||
# @param [Hash] attributes Model attributes in the form of hash
|
|
||||||
# @return [Object] Returns the model itself
|
|
||||||
def self.build_from_hash(attributes)
|
|
||||||
new.build_from_hash(attributes)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Builds the object from hash
|
|
||||||
# @param [Hash] attributes Model attributes in the form of hash
|
|
||||||
# @return [Object] Returns the model itself
|
|
||||||
def build_from_hash(attributes)
|
|
||||||
return nil unless attributes.is_a?(Hash)
|
|
||||||
attributes = attributes.transform_keys(&:to_sym)
|
|
||||||
self.class.openapi_types.each_pair do |key, type|
|
|
||||||
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
||||||
self.send("#{key}=", nil)
|
|
||||||
elsif type =~ /\AArray<(.*)>/i
|
|
||||||
# check to ensure the input is an array given that the attribute
|
|
||||||
# is documented as an array but the input is not
|
|
||||||
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
||||||
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
||||||
end
|
|
||||||
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
||||||
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
self
|
|
||||||
end
|
|
||||||
|
|
||||||
# Deserializes the data based on type
|
|
||||||
# @param string type Data type
|
|
||||||
# @param string value Value to be deserialized
|
|
||||||
# @return [Object] Deserialized data
|
|
||||||
def _deserialize(type, value)
|
|
||||||
case type.to_sym
|
|
||||||
when :Time
|
|
||||||
Time.parse(value)
|
|
||||||
when :Date
|
|
||||||
Date.parse(value)
|
|
||||||
when :String
|
|
||||||
value.to_s
|
|
||||||
when :Integer
|
|
||||||
value.to_i
|
|
||||||
when :Float
|
|
||||||
value.to_f
|
|
||||||
when :Boolean
|
|
||||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
||||||
true
|
|
||||||
else
|
|
||||||
false
|
|
||||||
end
|
|
||||||
when :Object
|
|
||||||
# generic object (usually a Hash), return directly
|
|
||||||
value
|
|
||||||
when /\AArray<(?<inner_type>.+)>\z/
|
|
||||||
inner_type = Regexp.last_match[:inner_type]
|
|
||||||
value.map { |v| _deserialize(inner_type, v) }
|
|
||||||
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
||||||
k_type = Regexp.last_match[:k_type]
|
|
||||||
v_type = Regexp.last_match[:v_type]
|
|
||||||
{}.tap do |hash|
|
|
||||||
value.each do |k, v|
|
|
||||||
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else # model
|
|
||||||
# models (e.g. Pet) or oneOf
|
|
||||||
klass = Petstore.const_get(type)
|
|
||||||
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Returns the string representation of the object
|
|
||||||
# @return [String] String presentation of the object
|
|
||||||
def to_s
|
|
||||||
to_hash.to_s
|
|
||||||
end
|
|
||||||
|
|
||||||
# to_body is an alias to to_hash (backward compatibility)
|
|
||||||
# @return [Hash] Returns the object in the form of hash
|
|
||||||
def to_body
|
|
||||||
to_hash
|
|
||||||
end
|
|
||||||
|
|
||||||
# Returns the object in the form of hash
|
|
||||||
# @return [Hash] Returns the object in the form of hash
|
|
||||||
def to_hash
|
|
||||||
hash = {}
|
|
||||||
self.class.attribute_map.each_pair do |attr, param|
|
|
||||||
value = self.send(attr)
|
|
||||||
if value.nil?
|
|
||||||
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
||||||
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
||||||
end
|
|
||||||
|
|
||||||
hash[param] = _to_hash(value)
|
|
||||||
end
|
|
||||||
hash
|
|
||||||
end
|
|
||||||
|
|
||||||
# Outputs non-array value in the form of hash
|
|
||||||
# For object, use to_hash. Otherwise, just return the value
|
|
||||||
# @param [Object] value Any valid value
|
|
||||||
# @return [Hash] Returns the value in the form of hash
|
|
||||||
def _to_hash(value)
|
|
||||||
if value.is_a?(Array)
|
|
||||||
value.compact.map { |v| _to_hash(v) }
|
|
||||||
elsif value.is_a?(Hash)
|
|
||||||
{}.tap do |hash|
|
|
||||||
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
||||||
end
|
|
||||||
elsif value.respond_to? :to_hash
|
|
||||||
value.to_hash
|
|
||||||
else
|
|
||||||
value
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,232 +0,0 @@
|
|||||||
=begin
|
|
||||||
#OpenAPI Petstore
|
|
||||||
|
|
||||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 1.0.0
|
|
||||||
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
OpenAPI Generator version: 6.1.0-SNAPSHOT
|
|
||||||
|
|
||||||
=end
|
|
||||||
|
|
||||||
require 'date'
|
|
||||||
require 'time'
|
|
||||||
|
|
||||||
module Petstore
|
|
||||||
class AdditionalPropertiesClass
|
|
||||||
attr_accessor :map_property
|
|
||||||
|
|
||||||
attr_accessor :map_of_map_property
|
|
||||||
|
|
||||||
# Attribute mapping from ruby-style variable name to JSON key.
|
|
||||||
def self.attribute_map
|
|
||||||
{
|
|
||||||
:'map_property' => :'map_property',
|
|
||||||
:'map_of_map_property' => :'map_of_map_property'
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
# Returns all the JSON keys this model knows about
|
|
||||||
def self.acceptable_attributes
|
|
||||||
attribute_map.values
|
|
||||||
end
|
|
||||||
|
|
||||||
# Attribute type mapping.
|
|
||||||
def self.openapi_types
|
|
||||||
{
|
|
||||||
:'map_property' => :'Hash<String, String>',
|
|
||||||
:'map_of_map_property' => :'Hash<String, Hash<String, String>>'
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
# List of attributes with nullable: true
|
|
||||||
def self.openapi_nullable
|
|
||||||
Set.new([
|
|
||||||
])
|
|
||||||
end
|
|
||||||
|
|
||||||
# Initializes the object
|
|
||||||
# @param [Hash] attributes Model attributes in the form of hash
|
|
||||||
def initialize(attributes = {})
|
|
||||||
if (!attributes.is_a?(Hash))
|
|
||||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::AdditionalPropertiesClass` initialize method"
|
|
||||||
end
|
|
||||||
|
|
||||||
# check to see if the attribute exists and convert string to symbol for hash key
|
|
||||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
||||||
if (!self.class.attribute_map.key?(k.to_sym))
|
|
||||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AdditionalPropertiesClass`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
||||||
end
|
|
||||||
h[k.to_sym] = v
|
|
||||||
}
|
|
||||||
|
|
||||||
if attributes.key?(:'map_property')
|
|
||||||
if (value = attributes[:'map_property']).is_a?(Hash)
|
|
||||||
self.map_property = value
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if attributes.key?(:'map_of_map_property')
|
|
||||||
if (value = attributes[:'map_of_map_property']).is_a?(Hash)
|
|
||||||
self.map_of_map_property = value
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Show invalid properties with the reasons. Usually used together with valid?
|
|
||||||
# @return Array for valid properties with the reasons
|
|
||||||
def list_invalid_properties
|
|
||||||
invalid_properties = Array.new
|
|
||||||
invalid_properties
|
|
||||||
end
|
|
||||||
|
|
||||||
# Check to see if the all the properties in the model are valid
|
|
||||||
# @return true if the model is valid
|
|
||||||
def valid?
|
|
||||||
true
|
|
||||||
end
|
|
||||||
|
|
||||||
# Checks equality by comparing each attribute.
|
|
||||||
# @param [Object] Object to be compared
|
|
||||||
def ==(o)
|
|
||||||
return true if self.equal?(o)
|
|
||||||
self.class == o.class &&
|
|
||||||
map_property == o.map_property &&
|
|
||||||
map_of_map_property == o.map_of_map_property
|
|
||||||
end
|
|
||||||
|
|
||||||
# @see the `==` method
|
|
||||||
# @param [Object] Object to be compared
|
|
||||||
def eql?(o)
|
|
||||||
self == o
|
|
||||||
end
|
|
||||||
|
|
||||||
# Calculates hash code according to all attributes.
|
|
||||||
# @return [Integer] Hash code
|
|
||||||
def hash
|
|
||||||
[map_property, map_of_map_property].hash
|
|
||||||
end
|
|
||||||
|
|
||||||
# Builds the object from hash
|
|
||||||
# @param [Hash] attributes Model attributes in the form of hash
|
|
||||||
# @return [Object] Returns the model itself
|
|
||||||
def self.build_from_hash(attributes)
|
|
||||||
new.build_from_hash(attributes)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Builds the object from hash
|
|
||||||
# @param [Hash] attributes Model attributes in the form of hash
|
|
||||||
# @return [Object] Returns the model itself
|
|
||||||
def build_from_hash(attributes)
|
|
||||||
return nil unless attributes.is_a?(Hash)
|
|
||||||
attributes = attributes.transform_keys(&:to_sym)
|
|
||||||
self.class.openapi_types.each_pair do |key, type|
|
|
||||||
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
||||||
self.send("#{key}=", nil)
|
|
||||||
elsif type =~ /\AArray<(.*)>/i
|
|
||||||
# check to ensure the input is an array given that the attribute
|
|
||||||
# is documented as an array but the input is not
|
|
||||||
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
||||||
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
||||||
end
|
|
||||||
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
||||||
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
self
|
|
||||||
end
|
|
||||||
|
|
||||||
# Deserializes the data based on type
|
|
||||||
# @param string type Data type
|
|
||||||
# @param string value Value to be deserialized
|
|
||||||
# @return [Object] Deserialized data
|
|
||||||
def _deserialize(type, value)
|
|
||||||
case type.to_sym
|
|
||||||
when :Time
|
|
||||||
Time.parse(value)
|
|
||||||
when :Date
|
|
||||||
Date.parse(value)
|
|
||||||
when :String
|
|
||||||
value.to_s
|
|
||||||
when :Integer
|
|
||||||
value.to_i
|
|
||||||
when :Float
|
|
||||||
value.to_f
|
|
||||||
when :Boolean
|
|
||||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
||||||
true
|
|
||||||
else
|
|
||||||
false
|
|
||||||
end
|
|
||||||
when :Object
|
|
||||||
# generic object (usually a Hash), return directly
|
|
||||||
value
|
|
||||||
when /\AArray<(?<inner_type>.+)>\z/
|
|
||||||
inner_type = Regexp.last_match[:inner_type]
|
|
||||||
value.map { |v| _deserialize(inner_type, v) }
|
|
||||||
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
||||||
k_type = Regexp.last_match[:k_type]
|
|
||||||
v_type = Regexp.last_match[:v_type]
|
|
||||||
{}.tap do |hash|
|
|
||||||
value.each do |k, v|
|
|
||||||
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else # model
|
|
||||||
# models (e.g. Pet) or oneOf
|
|
||||||
klass = Petstore.const_get(type)
|
|
||||||
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Returns the string representation of the object
|
|
||||||
# @return [String] String presentation of the object
|
|
||||||
def to_s
|
|
||||||
to_hash.to_s
|
|
||||||
end
|
|
||||||
|
|
||||||
# to_body is an alias to to_hash (backward compatibility)
|
|
||||||
# @return [Hash] Returns the object in the form of hash
|
|
||||||
def to_body
|
|
||||||
to_hash
|
|
||||||
end
|
|
||||||
|
|
||||||
# Returns the object in the form of hash
|
|
||||||
# @return [Hash] Returns the object in the form of hash
|
|
||||||
def to_hash
|
|
||||||
hash = {}
|
|
||||||
self.class.attribute_map.each_pair do |attr, param|
|
|
||||||
value = self.send(attr)
|
|
||||||
if value.nil?
|
|
||||||
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
||||||
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
||||||
end
|
|
||||||
|
|
||||||
hash[param] = _to_hash(value)
|
|
||||||
end
|
|
||||||
hash
|
|
||||||
end
|
|
||||||
|
|
||||||
# Outputs non-array value in the form of hash
|
|
||||||
# For object, use to_hash. Otherwise, just return the value
|
|
||||||
# @param [Object] value Any valid value
|
|
||||||
# @return [Hash] Returns the value in the form of hash
|
|
||||||
def _to_hash(value)
|
|
||||||
if value.is_a?(Array)
|
|
||||||
value.compact.map { |v| _to_hash(v) }
|
|
||||||
elsif value.is_a?(Hash)
|
|
||||||
{}.tap do |hash|
|
|
||||||
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
||||||
end
|
|
||||||
elsif value.respond_to? :to_hash
|
|
||||||
value.to_hash
|
|
||||||
else
|
|
||||||
value
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,229 +0,0 @@
|
|||||||
=begin
|
|
||||||
#OpenAPI Petstore
|
|
||||||
|
|
||||||
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 1.0.0
|
|
||||||
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
OpenAPI Generator version: 6.1.0-SNAPSHOT
|
|
||||||
|
|
||||||
=end
|
|
||||||
|
|
||||||
require 'date'
|
|
||||||
require 'time'
|
|
||||||
|
|
||||||
module Petstore
|
|
||||||
class AllOfWithSingleRef
|
|
||||||
attr_accessor :username
|
|
||||||
|
|
||||||
attr_accessor :single_ref_type
|
|
||||||
|
|
||||||
# Attribute mapping from ruby-style variable name to JSON key.
|
|
||||||
def self.attribute_map
|
|
||||||
{
|
|
||||||
:'username' => :'username',
|
|
||||||
:'single_ref_type' => :'SingleRefType'
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
# Returns all the JSON keys this model knows about
|
|
||||||
def self.acceptable_attributes
|
|
||||||
attribute_map.values
|
|
||||||
end
|
|
||||||
|
|
||||||
# Attribute type mapping.
|
|
||||||
def self.openapi_types
|
|
||||||
{
|
|
||||||
:'username' => :'String',
|
|
||||||
:'single_ref_type' => :'SingleRefType'
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
# List of attributes with nullable: true
|
|
||||||
def self.openapi_nullable
|
|
||||||
Set.new([
|
|
||||||
:'single_ref_type'
|
|
||||||
])
|
|
||||||
end
|
|
||||||
|
|
||||||
# Initializes the object
|
|
||||||
# @param [Hash] attributes Model attributes in the form of hash
|
|
||||||
def initialize(attributes = {})
|
|
||||||
if (!attributes.is_a?(Hash))
|
|
||||||
fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::AllOfWithSingleRef` initialize method"
|
|
||||||
end
|
|
||||||
|
|
||||||
# check to see if the attribute exists and convert string to symbol for hash key
|
|
||||||
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
||||||
if (!self.class.attribute_map.key?(k.to_sym))
|
|
||||||
fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::AllOfWithSingleRef`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
||||||
end
|
|
||||||
h[k.to_sym] = v
|
|
||||||
}
|
|
||||||
|
|
||||||
if attributes.key?(:'username')
|
|
||||||
self.username = attributes[:'username']
|
|
||||||
end
|
|
||||||
|
|
||||||
if attributes.key?(:'single_ref_type')
|
|
||||||
self.single_ref_type = attributes[:'single_ref_type']
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Show invalid properties with the reasons. Usually used together with valid?
|
|
||||||
# @return Array for valid properties with the reasons
|
|
||||||
def list_invalid_properties
|
|
||||||
invalid_properties = Array.new
|
|
||||||
invalid_properties
|
|
||||||
end
|
|
||||||
|
|
||||||
# Check to see if the all the properties in the model are valid
|
|
||||||
# @return true if the model is valid
|
|
||||||
def valid?
|
|
||||||
true
|
|
||||||
end
|
|
||||||
|
|
||||||
# Checks equality by comparing each attribute.
|
|
||||||
# @param [Object] Object to be compared
|
|
||||||
def ==(o)
|
|
||||||
return true if self.equal?(o)
|
|
||||||
self.class == o.class &&
|
|
||||||
username == o.username &&
|
|
||||||
single_ref_type == o.single_ref_type
|
|
||||||
end
|
|
||||||
|
|
||||||
# @see the `==` method
|
|
||||||
# @param [Object] Object to be compared
|
|
||||||
def eql?(o)
|
|
||||||
self == o
|
|
||||||
end
|
|
||||||
|
|
||||||
# Calculates hash code according to all attributes.
|
|
||||||
# @return [Integer] Hash code
|
|
||||||
def hash
|
|
||||||
[username, single_ref_type].hash
|
|
||||||
end
|
|
||||||
|
|
||||||
# Builds the object from hash
|
|
||||||
# @param [Hash] attributes Model attributes in the form of hash
|
|
||||||
# @return [Object] Returns the model itself
|
|
||||||
def self.build_from_hash(attributes)
|
|
||||||
new.build_from_hash(attributes)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Builds the object from hash
|
|
||||||
# @param [Hash] attributes Model attributes in the form of hash
|
|
||||||
# @return [Object] Returns the model itself
|
|
||||||
def build_from_hash(attributes)
|
|
||||||
return nil unless attributes.is_a?(Hash)
|
|
||||||
attributes = attributes.transform_keys(&:to_sym)
|
|
||||||
self.class.openapi_types.each_pair do |key, type|
|
|
||||||
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
||||||
self.send("#{key}=", nil)
|
|
||||||
elsif type =~ /\AArray<(.*)>/i
|
|
||||||
# check to ensure the input is an array given that the attribute
|
|
||||||
# is documented as an array but the input is not
|
|
||||||
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
||||||
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
||||||
end
|
|
||||||
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
||||||
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
self
|
|
||||||
end
|
|
||||||
|
|
||||||
# Deserializes the data based on type
|
|
||||||
# @param string type Data type
|
|
||||||
# @param string value Value to be deserialized
|
|
||||||
# @return [Object] Deserialized data
|
|
||||||
def _deserialize(type, value)
|
|
||||||
case type.to_sym
|
|
||||||
when :Time
|
|
||||||
Time.parse(value)
|
|
||||||
when :Date
|
|
||||||
Date.parse(value)
|
|
||||||
when :String
|
|
||||||
value.to_s
|
|
||||||
when :Integer
|
|
||||||
value.to_i
|
|
||||||
when :Float
|
|
||||||
value.to_f
|
|
||||||
when :Boolean
|
|
||||||
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
||||||
true
|
|
||||||
else
|
|
||||||
false
|
|
||||||
end
|
|
||||||
when :Object
|
|
||||||
# generic object (usually a Hash), return directly
|
|
||||||
value
|
|
||||||
when /\AArray<(?<inner_type>.+)>\z/
|
|
||||||
inner_type = Regexp.last_match[:inner_type]
|
|
||||||
value.map { |v| _deserialize(inner_type, v) }
|
|
||||||
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
||||||
k_type = Regexp.last_match[:k_type]
|
|
||||||
v_type = Regexp.last_match[:v_type]
|
|
||||||
{}.tap do |hash|
|
|
||||||
value.each do |k, v|
|
|
||||||
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else # model
|
|
||||||
# models (e.g. Pet) or oneOf
|
|
||||||
klass = Petstore.const_get(type)
|
|
||||||
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Returns the string representation of the object
|
|
||||||
# @return [String] String presentation of the object
|
|
||||||
def to_s
|
|
||||||
to_hash.to_s
|
|
||||||
end
|
|
||||||
|
|
||||||
# to_body is an alias to to_hash (backward compatibility)
|
|
||||||
# @return [Hash] Returns the object in the form of hash
|
|
||||||
def to_body
|
|
||||||
to_hash
|
|
||||||
end
|
|
||||||
|
|
||||||
# Returns the object in the form of hash
|
|
||||||
# @return [Hash] Returns the object in the form of hash
|
|
||||||
def to_hash
|
|
||||||
hash = {}
|
|
||||||
self.class.attribute_map.each_pair do |attr, param|
|
|
||||||
value = self.send(attr)
|
|
||||||
if value.nil?
|
|
||||||
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
||||||
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
||||||
end
|
|
||||||
|
|
||||||
hash[param] = _to_hash(value)
|
|
||||||
end
|
|
||||||
hash
|
|
||||||
end
|
|
||||||
|
|
||||||
# Outputs non-array value in the form of hash
|
|
||||||
# For object, use to_hash. Otherwise, just return the value
|
|
||||||
# @param [Object] value Any valid value
|
|
||||||
# @return [Hash] Returns the value in the form of hash
|
|
||||||
def _to_hash(value)
|
|
||||||
if value.is_a?(Array)
|
|
||||||
value.compact.map { |v| _to_hash(v) }
|
|
||||||
elsif value.is_a?(Hash)
|
|
||||||
{}.tap do |hash|
|
|
||||||
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
||||||
end
|
|
||||||
elsif value.respond_to? :to_hash
|
|
||||||
value.to_hash
|
|
||||||
else
|
|
||||||
value
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
**uuid** | Option<[**uuid::Uuid**](uuid::Uuid.md)> | | [optional]
|
**uuid** | Option<**String**> | | [optional]
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
|
||||||
pub struct PropertyTest {
|
pub struct PropertyTest {
|
||||||
#[serde(rename = "uuid", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "uuid", skip_serializing_if = "Option::is_none")]
|
||||||
pub uuid: Option<uuid::Uuid>,
|
pub uuid: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PropertyTest {
|
impl PropertyTest {
|
||||||
|
@ -1,129 +0,0 @@
|
|||||||
# \StoreApi
|
|
||||||
|
|
||||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
|
||||||
|
|
||||||
Method | HTTP request | Description
|
|
||||||
------------- | ------------- | -------------
|
|
||||||
[**delete_order**](StoreApi.md#delete_order) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
|
||||||
[**get_inventory**](StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status
|
|
||||||
[**get_order_by_id**](StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID
|
|
||||||
[**place_order**](StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## delete_order
|
|
||||||
|
|
||||||
> delete_order(order_id)
|
|
||||||
Delete purchase order by ID
|
|
||||||
|
|
||||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
|
|
||||||
Name | Type | Description | Required | Notes
|
|
||||||
------------- | ------------- | ------------- | ------------- | -------------
|
|
||||||
**order_id** | **String** | ID of the order that needs to be deleted | [required] |
|
|
||||||
|
|
||||||
### 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)
|
|
||||||
|
|
||||||
|
|
||||||
## get_inventory
|
|
||||||
|
|
||||||
> ::std::collections::HashMap<String, i32> get_inventory()
|
|
||||||
Returns pet inventories by status
|
|
||||||
|
|
||||||
Returns a map of status codes to quantities
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
This endpoint does not need any parameter.
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
**::std::collections::HashMap<String, i32>**
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
[api_key](../README.md#api_key)
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
|
||||||
- **Accept**: application/json
|
|
||||||
|
|
||||||
[[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)
|
|
||||||
|
|
||||||
|
|
||||||
## get_order_by_id
|
|
||||||
|
|
||||||
> crate::models::Order get_order_by_id(order_id)
|
|
||||||
Find purchase order by ID
|
|
||||||
|
|
||||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
|
|
||||||
Name | Type | Description | Required | Notes
|
|
||||||
------------- | ------------- | ------------- | ------------- | -------------
|
|
||||||
**order_id** | **i64** | ID of pet that needs to be fetched | [required] |
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
[**crate::models::Order**](Order.md)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: Not defined
|
|
||||||
- **Accept**: application/xml, application/json
|
|
||||||
|
|
||||||
[[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)
|
|
||||||
|
|
||||||
|
|
||||||
## place_order
|
|
||||||
|
|
||||||
> crate::models::Order place_order(order)
|
|
||||||
Place an order for a pet
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
|
|
||||||
|
|
||||||
Name | Type | Description | Required | Notes
|
|
||||||
------------- | ------------- | ------------- | ------------- | -------------
|
|
||||||
**order** | [**Order**](Order.md) | order placed for purchasing the pet | [required] |
|
|
||||||
|
|
||||||
### Return type
|
|
||||||
|
|
||||||
[**crate::models::Order**](Order.md)
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
|
|
||||||
No authorization required
|
|
||||||
|
|
||||||
### HTTP request headers
|
|
||||||
|
|
||||||
- **Content-Type**: application/json
|
|
||||||
- **Accept**: application/xml, application/json
|
|
||||||
|
|
||||||
[[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)
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
**uuid** | Option<[**uuid::Uuid**](uuid::Uuid.md)> | | [optional]
|
**uuid** | Option<**String**> | | [optional]
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
@ -1,62 +0,0 @@
|
|||||||
/*
|
|
||||||
* OpenAPI Petstore
|
|
||||||
*
|
|
||||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
|
||||||
*
|
|
||||||
* The version of the OpenAPI document: 1.0.0
|
|
||||||
*
|
|
||||||
* Generated by: https://openapi-generator.tech
|
|
||||||
*/
|
|
||||||
|
|
||||||
/// Order : An order for a pets from the pet store
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
|
|
||||||
pub struct Order {
|
|
||||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
|
||||||
pub id: Option<i64>,
|
|
||||||
#[serde(rename = "petId", skip_serializing_if = "Option::is_none")]
|
|
||||||
pub pet_id: Option<i64>,
|
|
||||||
#[serde(rename = "quantity", skip_serializing_if = "Option::is_none")]
|
|
||||||
pub quantity: Option<i32>,
|
|
||||||
#[serde(rename = "shipDate", skip_serializing_if = "Option::is_none")]
|
|
||||||
pub ship_date: Option<String>,
|
|
||||||
/// Order Status
|
|
||||||
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
|
|
||||||
pub status: Option<Status>,
|
|
||||||
#[serde(rename = "complete", skip_serializing_if = "Option::is_none")]
|
|
||||||
pub complete: Option<bool>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Order {
|
|
||||||
/// An order for a pets from the pet store
|
|
||||||
pub fn new() -> Order {
|
|
||||||
Order {
|
|
||||||
id: None,
|
|
||||||
pet_id: None,
|
|
||||||
quantity: None,
|
|
||||||
ship_date: None,
|
|
||||||
status: None,
|
|
||||||
complete: None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Order Status
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
|
|
||||||
pub enum Status {
|
|
||||||
#[serde(rename = "placed")]
|
|
||||||
Placed,
|
|
||||||
#[serde(rename = "approved")]
|
|
||||||
Approved,
|
|
||||||
#[serde(rename = "delivered")]
|
|
||||||
Delivered,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for Status {
|
|
||||||
fn default() -> Status {
|
|
||||||
Self::Placed
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
|||||||
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
|
||||||
pub struct PropertyTest {
|
pub struct PropertyTest {
|
||||||
#[serde(rename = "uuid", skip_serializing_if = "Option::is_none")]
|
#[serde(rename = "uuid", skip_serializing_if = "Option::is_none")]
|
||||||
pub uuid: Option<uuid::Uuid>,
|
pub uuid: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PropertyTest {
|
impl PropertyTest {
|
||||||
|
@ -1,64 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.additionalproperties_allows_a_schema_which_should_validate import AdditionalpropertiesAllowsASchemaWhichShouldValidate
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestAdditionalpropertiesAllowsASchemaWhichShouldValidate(unittest.TestCase):
|
|
||||||
"""AdditionalpropertiesAllowsASchemaWhichShouldValidate unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_no_additional_properties_is_valid_passes(self):
|
|
||||||
# no additional properties is valid
|
|
||||||
AdditionalpropertiesAllowsASchemaWhichShouldValidate._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
1,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_an_additional_invalid_property_is_invalid_fails(self):
|
|
||||||
# an additional invalid property is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
AdditionalpropertiesAllowsASchemaWhichShouldValidate._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
1,
|
|
||||||
"bar":
|
|
||||||
2,
|
|
||||||
"quux":
|
|
||||||
12,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_an_additional_valid_property_is_valid_passes(self):
|
|
||||||
# an additional valid property is valid
|
|
||||||
AdditionalpropertiesAllowsASchemaWhichShouldValidate._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
1,
|
|
||||||
"bar":
|
|
||||||
2,
|
|
||||||
"quux":
|
|
||||||
True,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,39 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.additionalproperties_are_allowed_by_default import AdditionalpropertiesAreAllowedByDefault
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestAdditionalpropertiesAreAllowedByDefault(unittest.TestCase):
|
|
||||||
"""AdditionalpropertiesAreAllowedByDefault unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_additional_properties_are_allowed_passes(self):
|
|
||||||
# additional properties are allowed
|
|
||||||
AdditionalpropertiesAreAllowedByDefault._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
1,
|
|
||||||
"bar":
|
|
||||||
2,
|
|
||||||
"quux":
|
|
||||||
True,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,46 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.additionalproperties_can_exist_by_itself import AdditionalpropertiesCanExistByItself
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestAdditionalpropertiesCanExistByItself(unittest.TestCase):
|
|
||||||
"""AdditionalpropertiesCanExistByItself unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_an_additional_invalid_property_is_invalid_fails(self):
|
|
||||||
# an additional invalid property is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
AdditionalpropertiesCanExistByItself._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
1,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_an_additional_valid_property_is_valid_passes(self):
|
|
||||||
# an additional valid property is valid
|
|
||||||
AdditionalpropertiesCanExistByItself._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
True,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,38 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.additionalproperties_should_not_look_in_applicators import AdditionalpropertiesShouldNotLookInApplicators
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestAdditionalpropertiesShouldNotLookInApplicators(unittest.TestCase):
|
|
||||||
"""AdditionalpropertiesShouldNotLookInApplicators unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_properties_defined_in_allof_are_not_examined_fails(self):
|
|
||||||
# properties defined in allOf are not examined
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
AdditionalpropertiesShouldNotLookInApplicators._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
1,
|
|
||||||
"bar":
|
|
||||||
True,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,72 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.allof import Allof
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestAllof(unittest.TestCase):
|
|
||||||
"""Allof unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_allof_passes(self):
|
|
||||||
# allOf
|
|
||||||
Allof._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
"baz",
|
|
||||||
"bar":
|
|
||||||
2,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_mismatch_first_fails(self):
|
|
||||||
# mismatch first
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
Allof._from_openapi_data(
|
|
||||||
{
|
|
||||||
"bar":
|
|
||||||
2,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_mismatch_second_fails(self):
|
|
||||||
# mismatch second
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
Allof._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
"baz",
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_wrong_type_fails(self):
|
|
||||||
# wrong type
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
Allof._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
"baz",
|
|
||||||
"bar":
|
|
||||||
"quux",
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,88 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.allof_combined_with_anyof_oneof import AllofCombinedWithAnyofOneof
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestAllofCombinedWithAnyofOneof(unittest.TestCase):
|
|
||||||
"""AllofCombinedWithAnyofOneof unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_allof_true_anyof_false_oneof_false_fails(self):
|
|
||||||
# allOf: true, anyOf: false, oneOf: false
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
AllofCombinedWithAnyofOneof._from_openapi_data(
|
|
||||||
2,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_allof_false_anyof_false_oneof_true_fails(self):
|
|
||||||
# allOf: false, anyOf: false, oneOf: true
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
AllofCombinedWithAnyofOneof._from_openapi_data(
|
|
||||||
5,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_allof_false_anyof_true_oneof_true_fails(self):
|
|
||||||
# allOf: false, anyOf: true, oneOf: true
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
AllofCombinedWithAnyofOneof._from_openapi_data(
|
|
||||||
15,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_allof_true_anyof_true_oneof_false_fails(self):
|
|
||||||
# allOf: true, anyOf: true, oneOf: false
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
AllofCombinedWithAnyofOneof._from_openapi_data(
|
|
||||||
6,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_allof_true_anyof_true_oneof_true_passes(self):
|
|
||||||
# allOf: true, anyOf: true, oneOf: true
|
|
||||||
AllofCombinedWithAnyofOneof._from_openapi_data(
|
|
||||||
30,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_allof_true_anyof_false_oneof_true_fails(self):
|
|
||||||
# allOf: true, anyOf: false, oneOf: true
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
AllofCombinedWithAnyofOneof._from_openapi_data(
|
|
||||||
10,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_allof_false_anyof_true_oneof_false_fails(self):
|
|
||||||
# allOf: false, anyOf: true, oneOf: false
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
AllofCombinedWithAnyofOneof._from_openapi_data(
|
|
||||||
3,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_allof_false_anyof_false_oneof_false_fails(self):
|
|
||||||
# allOf: false, anyOf: false, oneOf: false
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
AllofCombinedWithAnyofOneof._from_openapi_data(
|
|
||||||
1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,40 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.allof_simple_types import AllofSimpleTypes
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestAllofSimpleTypes(unittest.TestCase):
|
|
||||||
"""AllofSimpleTypes unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_valid_passes(self):
|
|
||||||
# valid
|
|
||||||
AllofSimpleTypes._from_openapi_data(
|
|
||||||
25,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_mismatch_one_fails(self):
|
|
||||||
# mismatch one
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
AllofSimpleTypes._from_openapi_data(
|
|
||||||
35,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,89 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.allof_with_base_schema import AllofWithBaseSchema
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestAllofWithBaseSchema(unittest.TestCase):
|
|
||||||
"""AllofWithBaseSchema unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_valid_passes(self):
|
|
||||||
# valid
|
|
||||||
AllofWithBaseSchema._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
"quux",
|
|
||||||
"bar":
|
|
||||||
2,
|
|
||||||
"baz":
|
|
||||||
None,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_mismatch_first_allof_fails(self):
|
|
||||||
# mismatch first allOf
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
AllofWithBaseSchema._from_openapi_data(
|
|
||||||
{
|
|
||||||
"bar":
|
|
||||||
2,
|
|
||||||
"baz":
|
|
||||||
None,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_mismatch_base_schema_fails(self):
|
|
||||||
# mismatch base schema
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
AllofWithBaseSchema._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
"quux",
|
|
||||||
"baz":
|
|
||||||
None,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_mismatch_both_fails(self):
|
|
||||||
# mismatch both
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
AllofWithBaseSchema._from_openapi_data(
|
|
||||||
{
|
|
||||||
"bar":
|
|
||||||
2,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_mismatch_second_allof_fails(self):
|
|
||||||
# mismatch second allOf
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
AllofWithBaseSchema._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
"quux",
|
|
||||||
"bar":
|
|
||||||
2,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,32 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.allof_with_one_empty_schema import AllofWithOneEmptySchema
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestAllofWithOneEmptySchema(unittest.TestCase):
|
|
||||||
"""AllofWithOneEmptySchema unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_any_data_is_valid_passes(self):
|
|
||||||
# any data is valid
|
|
||||||
AllofWithOneEmptySchema._from_openapi_data(
|
|
||||||
1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,40 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.allof_with_the_first_empty_schema import AllofWithTheFirstEmptySchema
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestAllofWithTheFirstEmptySchema(unittest.TestCase):
|
|
||||||
"""AllofWithTheFirstEmptySchema unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_string_is_invalid_fails(self):
|
|
||||||
# string is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
AllofWithTheFirstEmptySchema._from_openapi_data(
|
|
||||||
"foo",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_number_is_valid_passes(self):
|
|
||||||
# number is valid
|
|
||||||
AllofWithTheFirstEmptySchema._from_openapi_data(
|
|
||||||
1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,40 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.allof_with_the_last_empty_schema import AllofWithTheLastEmptySchema
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestAllofWithTheLastEmptySchema(unittest.TestCase):
|
|
||||||
"""AllofWithTheLastEmptySchema unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_string_is_invalid_fails(self):
|
|
||||||
# string is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
AllofWithTheLastEmptySchema._from_openapi_data(
|
|
||||||
"foo",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_number_is_valid_passes(self):
|
|
||||||
# number is valid
|
|
||||||
AllofWithTheLastEmptySchema._from_openapi_data(
|
|
||||||
1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,32 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.allof_with_two_empty_schemas import AllofWithTwoEmptySchemas
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestAllofWithTwoEmptySchemas(unittest.TestCase):
|
|
||||||
"""AllofWithTwoEmptySchemas unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_any_data_is_valid_passes(self):
|
|
||||||
# any data is valid
|
|
||||||
AllofWithTwoEmptySchemas._from_openapi_data(
|
|
||||||
1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,54 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.anyof import Anyof
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestAnyof(unittest.TestCase):
|
|
||||||
"""Anyof unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_second_anyof_valid_passes(self):
|
|
||||||
# second anyOf valid
|
|
||||||
Anyof._from_openapi_data(
|
|
||||||
2.5,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_neither_anyof_valid_fails(self):
|
|
||||||
# neither anyOf valid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
Anyof._from_openapi_data(
|
|
||||||
1.5,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_both_anyof_valid_passes(self):
|
|
||||||
# both anyOf valid
|
|
||||||
Anyof._from_openapi_data(
|
|
||||||
3,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_first_anyof_valid_passes(self):
|
|
||||||
# first anyOf valid
|
|
||||||
Anyof._from_openapi_data(
|
|
||||||
1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,70 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.anyof_complex_types import AnyofComplexTypes
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestAnyofComplexTypes(unittest.TestCase):
|
|
||||||
"""AnyofComplexTypes unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_second_anyof_valid_complex_passes(self):
|
|
||||||
# second anyOf valid (complex)
|
|
||||||
AnyofComplexTypes._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
"baz",
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_neither_anyof_valid_complex_fails(self):
|
|
||||||
# neither anyOf valid (complex)
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
AnyofComplexTypes._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
2,
|
|
||||||
"bar":
|
|
||||||
"quux",
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_both_anyof_valid_complex_passes(self):
|
|
||||||
# both anyOf valid (complex)
|
|
||||||
AnyofComplexTypes._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
"baz",
|
|
||||||
"bar":
|
|
||||||
2,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_first_anyof_valid_complex_passes(self):
|
|
||||||
# first anyOf valid (complex)
|
|
||||||
AnyofComplexTypes._from_openapi_data(
|
|
||||||
{
|
|
||||||
"bar":
|
|
||||||
2,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,48 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.anyof_with_base_schema import AnyofWithBaseSchema
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestAnyofWithBaseSchema(unittest.TestCase):
|
|
||||||
"""AnyofWithBaseSchema unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_one_anyof_valid_passes(self):
|
|
||||||
# one anyOf valid
|
|
||||||
AnyofWithBaseSchema._from_openapi_data(
|
|
||||||
"foobar",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_both_anyof_invalid_fails(self):
|
|
||||||
# both anyOf invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
AnyofWithBaseSchema._from_openapi_data(
|
|
||||||
"foo",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_mismatch_base_schema_fails(self):
|
|
||||||
# mismatch base schema
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
AnyofWithBaseSchema._from_openapi_data(
|
|
||||||
3,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,39 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.anyof_with_one_empty_schema import AnyofWithOneEmptySchema
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestAnyofWithOneEmptySchema(unittest.TestCase):
|
|
||||||
"""AnyofWithOneEmptySchema unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_string_is_valid_passes(self):
|
|
||||||
# string is valid
|
|
||||||
AnyofWithOneEmptySchema._from_openapi_data(
|
|
||||||
"foo",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_number_is_valid_passes(self):
|
|
||||||
# number is valid
|
|
||||||
AnyofWithOneEmptySchema._from_openapi_data(
|
|
||||||
123,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,82 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.array_type_matches_arrays import ArrayTypeMatchesArrays
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestArrayTypeMatchesArrays(unittest.TestCase):
|
|
||||||
"""ArrayTypeMatchesArrays unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_a_float_is_not_an_array_fails(self):
|
|
||||||
# a float is not an array
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
ArrayTypeMatchesArrays._from_openapi_data(
|
|
||||||
1.1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_a_boolean_is_not_an_array_fails(self):
|
|
||||||
# a boolean is not an array
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
ArrayTypeMatchesArrays._from_openapi_data(
|
|
||||||
True,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_null_is_not_an_array_fails(self):
|
|
||||||
# null is not an array
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
ArrayTypeMatchesArrays._from_openapi_data(
|
|
||||||
None,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_an_object_is_not_an_array_fails(self):
|
|
||||||
# an object is not an array
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
ArrayTypeMatchesArrays._from_openapi_data(
|
|
||||||
{
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_a_string_is_not_an_array_fails(self):
|
|
||||||
# a string is not an array
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
ArrayTypeMatchesArrays._from_openapi_data(
|
|
||||||
"foo",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_an_array_is_an_array_passes(self):
|
|
||||||
# an array is an array
|
|
||||||
ArrayTypeMatchesArrays._from_openapi_data(
|
|
||||||
[
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_an_integer_is_not_an_array_fails(self):
|
|
||||||
# an integer is not an array
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
ArrayTypeMatchesArrays._from_openapi_data(
|
|
||||||
1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,105 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.boolean_type_matches_booleans import BooleanTypeMatchesBooleans
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestBooleanTypeMatchesBooleans(unittest.TestCase):
|
|
||||||
"""BooleanTypeMatchesBooleans unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_an_empty_string_is_not_a_boolean_fails(self):
|
|
||||||
# an empty string is not a boolean
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
BooleanTypeMatchesBooleans._from_openapi_data(
|
|
||||||
"",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_a_float_is_not_a_boolean_fails(self):
|
|
||||||
# a float is not a boolean
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
BooleanTypeMatchesBooleans._from_openapi_data(
|
|
||||||
1.1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_null_is_not_a_boolean_fails(self):
|
|
||||||
# null is not a boolean
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
BooleanTypeMatchesBooleans._from_openapi_data(
|
|
||||||
None,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_zero_is_not_a_boolean_fails(self):
|
|
||||||
# zero is not a boolean
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
BooleanTypeMatchesBooleans._from_openapi_data(
|
|
||||||
0,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_an_array_is_not_a_boolean_fails(self):
|
|
||||||
# an array is not a boolean
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
BooleanTypeMatchesBooleans._from_openapi_data(
|
|
||||||
[
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_a_string_is_not_a_boolean_fails(self):
|
|
||||||
# a string is not a boolean
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
BooleanTypeMatchesBooleans._from_openapi_data(
|
|
||||||
"foo",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_false_is_a_boolean_passes(self):
|
|
||||||
# false is a boolean
|
|
||||||
BooleanTypeMatchesBooleans._from_openapi_data(
|
|
||||||
False,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_an_integer_is_not_a_boolean_fails(self):
|
|
||||||
# an integer is not a boolean
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
BooleanTypeMatchesBooleans._from_openapi_data(
|
|
||||||
1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_true_is_a_boolean_passes(self):
|
|
||||||
# true is a boolean
|
|
||||||
BooleanTypeMatchesBooleans._from_openapi_data(
|
|
||||||
True,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_an_object_is_not_a_boolean_fails(self):
|
|
||||||
# an object is not a boolean
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
BooleanTypeMatchesBooleans._from_openapi_data(
|
|
||||||
{
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,47 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.by_int import ByInt
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestByInt(unittest.TestCase):
|
|
||||||
"""ByInt unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_int_by_int_fail_fails(self):
|
|
||||||
# int by int fail
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
ByInt._from_openapi_data(
|
|
||||||
7,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_int_by_int_passes(self):
|
|
||||||
# int by int
|
|
||||||
ByInt._from_openapi_data(
|
|
||||||
10,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_ignores_non_numbers_passes(self):
|
|
||||||
# ignores non-numbers
|
|
||||||
ByInt._from_openapi_data(
|
|
||||||
"foo",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,47 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.by_number import ByNumber
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestByNumber(unittest.TestCase):
|
|
||||||
"""ByNumber unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_45_is_multiple_of15_passes(self):
|
|
||||||
# 4.5 is multiple of 1.5
|
|
||||||
ByNumber._from_openapi_data(
|
|
||||||
4.5,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_35_is_not_multiple_of15_fails(self):
|
|
||||||
# 35 is not multiple of 1.5
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
ByNumber._from_openapi_data(
|
|
||||||
35,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_zero_is_multiple_of_anything_passes(self):
|
|
||||||
# zero is multiple of anything
|
|
||||||
ByNumber._from_openapi_data(
|
|
||||||
0,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,40 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.by_small_number import BySmallNumber
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestBySmallNumber(unittest.TestCase):
|
|
||||||
"""BySmallNumber unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_000751_is_not_multiple_of00001_fails(self):
|
|
||||||
# 0.00751 is not multiple of 0.0001
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
BySmallNumber._from_openapi_data(
|
|
||||||
0.00751,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_00075_is_multiple_of00001_passes(self):
|
|
||||||
# 0.0075 is multiple of 0.0001
|
|
||||||
BySmallNumber._from_openapi_data(
|
|
||||||
0.0075,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,69 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.date_time_format import DateTimeFormat
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestDateTimeFormat(unittest.TestCase):
|
|
||||||
"""DateTimeFormat unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_objects_passes(self):
|
|
||||||
# all string formats ignore objects
|
|
||||||
DateTimeFormat._from_openapi_data(
|
|
||||||
{
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_booleans_passes(self):
|
|
||||||
# all string formats ignore booleans
|
|
||||||
DateTimeFormat._from_openapi_data(
|
|
||||||
False,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_integers_passes(self):
|
|
||||||
# all string formats ignore integers
|
|
||||||
DateTimeFormat._from_openapi_data(
|
|
||||||
12,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_floats_passes(self):
|
|
||||||
# all string formats ignore floats
|
|
||||||
DateTimeFormat._from_openapi_data(
|
|
||||||
13.7,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_arrays_passes(self):
|
|
||||||
# all string formats ignore arrays
|
|
||||||
DateTimeFormat._from_openapi_data(
|
|
||||||
[
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_nulls_passes(self):
|
|
||||||
# all string formats ignore nulls
|
|
||||||
DateTimeFormat._from_openapi_data(
|
|
||||||
None,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,69 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.email_format import EmailFormat
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestEmailFormat(unittest.TestCase):
|
|
||||||
"""EmailFormat unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_objects_passes(self):
|
|
||||||
# all string formats ignore objects
|
|
||||||
EmailFormat._from_openapi_data(
|
|
||||||
{
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_booleans_passes(self):
|
|
||||||
# all string formats ignore booleans
|
|
||||||
EmailFormat._from_openapi_data(
|
|
||||||
False,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_integers_passes(self):
|
|
||||||
# all string formats ignore integers
|
|
||||||
EmailFormat._from_openapi_data(
|
|
||||||
12,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_floats_passes(self):
|
|
||||||
# all string formats ignore floats
|
|
||||||
EmailFormat._from_openapi_data(
|
|
||||||
13.7,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_arrays_passes(self):
|
|
||||||
# all string formats ignore arrays
|
|
||||||
EmailFormat._from_openapi_data(
|
|
||||||
[
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_nulls_passes(self):
|
|
||||||
# all string formats ignore nulls
|
|
||||||
EmailFormat._from_openapi_data(
|
|
||||||
None,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,47 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.enum_with0_does_not_match_false import EnumWith0DoesNotMatchFalse
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestEnumWith0DoesNotMatchFalse(unittest.TestCase):
|
|
||||||
"""EnumWith0DoesNotMatchFalse unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_integer_zero_is_valid_passes(self):
|
|
||||||
# integer zero is valid
|
|
||||||
EnumWith0DoesNotMatchFalse._from_openapi_data(
|
|
||||||
0,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_float_zero_is_valid_passes(self):
|
|
||||||
# float zero is valid
|
|
||||||
EnumWith0DoesNotMatchFalse._from_openapi_data(
|
|
||||||
0.0,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_false_is_invalid_fails(self):
|
|
||||||
# false is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
EnumWith0DoesNotMatchFalse._from_openapi_data(
|
|
||||||
False,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,47 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.enum_with1_does_not_match_true import EnumWith1DoesNotMatchTrue
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestEnumWith1DoesNotMatchTrue(unittest.TestCase):
|
|
||||||
"""EnumWith1DoesNotMatchTrue unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_true_is_invalid_fails(self):
|
|
||||||
# true is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
EnumWith1DoesNotMatchTrue._from_openapi_data(
|
|
||||||
True,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_integer_one_is_valid_passes(self):
|
|
||||||
# integer one is valid
|
|
||||||
EnumWith1DoesNotMatchTrue._from_openapi_data(
|
|
||||||
1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_float_one_is_valid_passes(self):
|
|
||||||
# float one is valid
|
|
||||||
EnumWith1DoesNotMatchTrue._from_openapi_data(
|
|
||||||
1.0,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,47 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.enum_with_escaped_characters import EnumWithEscapedCharacters
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestEnumWithEscapedCharacters(unittest.TestCase):
|
|
||||||
"""EnumWithEscapedCharacters unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_member2_is_valid_passes(self):
|
|
||||||
# member 2 is valid
|
|
||||||
EnumWithEscapedCharacters._from_openapi_data(
|
|
||||||
"foo\rbar",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_member1_is_valid_passes(self):
|
|
||||||
# member 1 is valid
|
|
||||||
EnumWithEscapedCharacters._from_openapi_data(
|
|
||||||
"foo\nbar",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_another_string_is_invalid_fails(self):
|
|
||||||
# another string is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
EnumWithEscapedCharacters._from_openapi_data(
|
|
||||||
"abc",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,48 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.enum_with_false_does_not_match0 import EnumWithFalseDoesNotMatch0
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestEnumWithFalseDoesNotMatch0(unittest.TestCase):
|
|
||||||
"""EnumWithFalseDoesNotMatch0 unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_false_is_valid_passes(self):
|
|
||||||
# false is valid
|
|
||||||
EnumWithFalseDoesNotMatch0._from_openapi_data(
|
|
||||||
False,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_float_zero_is_invalid_fails(self):
|
|
||||||
# float zero is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
EnumWithFalseDoesNotMatch0._from_openapi_data(
|
|
||||||
0.0,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_integer_zero_is_invalid_fails(self):
|
|
||||||
# integer zero is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
EnumWithFalseDoesNotMatch0._from_openapi_data(
|
|
||||||
0,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,48 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.enum_with_true_does_not_match1 import EnumWithTrueDoesNotMatch1
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestEnumWithTrueDoesNotMatch1(unittest.TestCase):
|
|
||||||
"""EnumWithTrueDoesNotMatch1 unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_float_one_is_invalid_fails(self):
|
|
||||||
# float one is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
EnumWithTrueDoesNotMatch1._from_openapi_data(
|
|
||||||
1.0,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_true_is_valid_passes(self):
|
|
||||||
# true is valid
|
|
||||||
EnumWithTrueDoesNotMatch1._from_openapi_data(
|
|
||||||
True,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_integer_one_is_invalid_fails(self):
|
|
||||||
# integer one is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
EnumWithTrueDoesNotMatch1._from_openapi_data(
|
|
||||||
1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,93 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.enums_in_properties import EnumsInProperties
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestEnumsInProperties(unittest.TestCase):
|
|
||||||
"""EnumsInProperties unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_missing_optional_property_is_valid_passes(self):
|
|
||||||
# missing optional property is valid
|
|
||||||
EnumsInProperties._from_openapi_data(
|
|
||||||
{
|
|
||||||
"bar":
|
|
||||||
"bar",
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_wrong_foo_value_fails(self):
|
|
||||||
# wrong foo value
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
EnumsInProperties._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
"foot",
|
|
||||||
"bar":
|
|
||||||
"bar",
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_both_properties_are_valid_passes(self):
|
|
||||||
# both properties are valid
|
|
||||||
EnumsInProperties._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
"foo",
|
|
||||||
"bar":
|
|
||||||
"bar",
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_wrong_bar_value_fails(self):
|
|
||||||
# wrong bar value
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
EnumsInProperties._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
"foo",
|
|
||||||
"bar":
|
|
||||||
"bart",
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_missing_all_properties_is_invalid_fails(self):
|
|
||||||
# missing all properties is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
EnumsInProperties._from_openapi_data(
|
|
||||||
{
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_missing_required_property_is_invalid_fails(self):
|
|
||||||
# missing required property is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
EnumsInProperties._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
"foo",
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,50 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.forbidden_property import ForbiddenProperty
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestForbiddenProperty(unittest.TestCase):
|
|
||||||
"""ForbiddenProperty unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_property_present_fails(self):
|
|
||||||
# property present
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
ForbiddenProperty._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
1,
|
|
||||||
"bar":
|
|
||||||
2,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_property_absent_passes(self):
|
|
||||||
# property absent
|
|
||||||
ForbiddenProperty._from_openapi_data(
|
|
||||||
{
|
|
||||||
"bar":
|
|
||||||
1,
|
|
||||||
"baz":
|
|
||||||
2,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,69 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.hostname_format import HostnameFormat
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestHostnameFormat(unittest.TestCase):
|
|
||||||
"""HostnameFormat unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_objects_passes(self):
|
|
||||||
# all string formats ignore objects
|
|
||||||
HostnameFormat._from_openapi_data(
|
|
||||||
{
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_booleans_passes(self):
|
|
||||||
# all string formats ignore booleans
|
|
||||||
HostnameFormat._from_openapi_data(
|
|
||||||
False,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_integers_passes(self):
|
|
||||||
# all string formats ignore integers
|
|
||||||
HostnameFormat._from_openapi_data(
|
|
||||||
12,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_floats_passes(self):
|
|
||||||
# all string formats ignore floats
|
|
||||||
HostnameFormat._from_openapi_data(
|
|
||||||
13.7,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_arrays_passes(self):
|
|
||||||
# all string formats ignore arrays
|
|
||||||
HostnameFormat._from_openapi_data(
|
|
||||||
[
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_nulls_passes(self):
|
|
||||||
# all string formats ignore nulls
|
|
||||||
HostnameFormat._from_openapi_data(
|
|
||||||
None,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,97 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.integer_type_matches_integers import IntegerTypeMatchesIntegers
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestIntegerTypeMatchesIntegers(unittest.TestCase):
|
|
||||||
"""IntegerTypeMatchesIntegers unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_an_object_is_not_an_integer_fails(self):
|
|
||||||
# an object is not an integer
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
IntegerTypeMatchesIntegers._from_openapi_data(
|
|
||||||
{
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_a_string_is_not_an_integer_fails(self):
|
|
||||||
# a string is not an integer
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
IntegerTypeMatchesIntegers._from_openapi_data(
|
|
||||||
"foo",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_null_is_not_an_integer_fails(self):
|
|
||||||
# null is not an integer
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
IntegerTypeMatchesIntegers._from_openapi_data(
|
|
||||||
None,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_a_float_with_zero_fractional_part_is_an_integer_passes(self):
|
|
||||||
# a float with zero fractional part is an integer
|
|
||||||
IntegerTypeMatchesIntegers._from_openapi_data(
|
|
||||||
1.0,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_a_float_is_not_an_integer_fails(self):
|
|
||||||
# a float is not an integer
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
IntegerTypeMatchesIntegers._from_openapi_data(
|
|
||||||
1.1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_a_boolean_is_not_an_integer_fails(self):
|
|
||||||
# a boolean is not an integer
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
IntegerTypeMatchesIntegers._from_openapi_data(
|
|
||||||
True,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_an_integer_is_an_integer_passes(self):
|
|
||||||
# an integer is an integer
|
|
||||||
IntegerTypeMatchesIntegers._from_openapi_data(
|
|
||||||
1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_a_string_is_still_not_an_integer_even_if_it_looks_like_one_fails(self):
|
|
||||||
# a string is still not an integer, even if it looks like one
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
IntegerTypeMatchesIntegers._from_openapi_data(
|
|
||||||
"1",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_an_array_is_not_an_integer_fails(self):
|
|
||||||
# an array is not an integer
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
IntegerTypeMatchesIntegers._from_openapi_data(
|
|
||||||
[
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,33 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.invalid_instance_should_not_raise_error_when_float_division_inf import InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestInvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf(unittest.TestCase):
|
|
||||||
"""InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_always_invalid_but_naive_implementations_may_raise_an_overflow_error_fails(self):
|
|
||||||
# always invalid, but naive implementations may raise an overflow error
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
InvalidInstanceShouldNotRaiseErrorWhenFloatDivisionInf._from_openapi_data(
|
|
||||||
1.0E308,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,43 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.invalid_string_value_for_default import InvalidStringValueForDefault
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestInvalidStringValueForDefault(unittest.TestCase):
|
|
||||||
"""InvalidStringValueForDefault unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_valid_when_property_is_specified_passes(self):
|
|
||||||
# valid when property is specified
|
|
||||||
InvalidStringValueForDefault._from_openapi_data(
|
|
||||||
{
|
|
||||||
"bar":
|
|
||||||
"good",
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_still_valid_when_the_invalid_default_is_used_passes(self):
|
|
||||||
# still valid when the invalid default is used
|
|
||||||
InvalidStringValueForDefault._from_openapi_data(
|
|
||||||
{
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,69 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.ipv4_format import Ipv4Format
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestIpv4Format(unittest.TestCase):
|
|
||||||
"""Ipv4Format unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_objects_passes(self):
|
|
||||||
# all string formats ignore objects
|
|
||||||
Ipv4Format._from_openapi_data(
|
|
||||||
{
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_booleans_passes(self):
|
|
||||||
# all string formats ignore booleans
|
|
||||||
Ipv4Format._from_openapi_data(
|
|
||||||
False,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_integers_passes(self):
|
|
||||||
# all string formats ignore integers
|
|
||||||
Ipv4Format._from_openapi_data(
|
|
||||||
12,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_floats_passes(self):
|
|
||||||
# all string formats ignore floats
|
|
||||||
Ipv4Format._from_openapi_data(
|
|
||||||
13.7,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_arrays_passes(self):
|
|
||||||
# all string formats ignore arrays
|
|
||||||
Ipv4Format._from_openapi_data(
|
|
||||||
[
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_nulls_passes(self):
|
|
||||||
# all string formats ignore nulls
|
|
||||||
Ipv4Format._from_openapi_data(
|
|
||||||
None,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,69 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.ipv6_format import Ipv6Format
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestIpv6Format(unittest.TestCase):
|
|
||||||
"""Ipv6Format unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_objects_passes(self):
|
|
||||||
# all string formats ignore objects
|
|
||||||
Ipv6Format._from_openapi_data(
|
|
||||||
{
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_booleans_passes(self):
|
|
||||||
# all string formats ignore booleans
|
|
||||||
Ipv6Format._from_openapi_data(
|
|
||||||
False,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_integers_passes(self):
|
|
||||||
# all string formats ignore integers
|
|
||||||
Ipv6Format._from_openapi_data(
|
|
||||||
12,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_floats_passes(self):
|
|
||||||
# all string formats ignore floats
|
|
||||||
Ipv6Format._from_openapi_data(
|
|
||||||
13.7,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_arrays_passes(self):
|
|
||||||
# all string formats ignore arrays
|
|
||||||
Ipv6Format._from_openapi_data(
|
|
||||||
[
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_nulls_passes(self):
|
|
||||||
# all string formats ignore nulls
|
|
||||||
Ipv6Format._from_openapi_data(
|
|
||||||
None,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,69 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.json_pointer_format import JsonPointerFormat
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestJsonPointerFormat(unittest.TestCase):
|
|
||||||
"""JsonPointerFormat unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_objects_passes(self):
|
|
||||||
# all string formats ignore objects
|
|
||||||
JsonPointerFormat._from_openapi_data(
|
|
||||||
{
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_booleans_passes(self):
|
|
||||||
# all string formats ignore booleans
|
|
||||||
JsonPointerFormat._from_openapi_data(
|
|
||||||
False,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_integers_passes(self):
|
|
||||||
# all string formats ignore integers
|
|
||||||
JsonPointerFormat._from_openapi_data(
|
|
||||||
12,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_floats_passes(self):
|
|
||||||
# all string formats ignore floats
|
|
||||||
JsonPointerFormat._from_openapi_data(
|
|
||||||
13.7,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_arrays_passes(self):
|
|
||||||
# all string formats ignore arrays
|
|
||||||
JsonPointerFormat._from_openapi_data(
|
|
||||||
[
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_all_string_formats_ignore_nulls_passes(self):
|
|
||||||
# all string formats ignore nulls
|
|
||||||
JsonPointerFormat._from_openapi_data(
|
|
||||||
None,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,54 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.maximum_validation import MaximumValidation
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestMaximumValidation(unittest.TestCase):
|
|
||||||
"""MaximumValidation unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_below_the_maximum_is_valid_passes(self):
|
|
||||||
# below the maximum is valid
|
|
||||||
MaximumValidation._from_openapi_data(
|
|
||||||
2.6,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_boundary_point_is_valid_passes(self):
|
|
||||||
# boundary point is valid
|
|
||||||
MaximumValidation._from_openapi_data(
|
|
||||||
3.0,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_above_the_maximum_is_invalid_fails(self):
|
|
||||||
# above the maximum is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
MaximumValidation._from_openapi_data(
|
|
||||||
3.5,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_ignores_non_numbers_passes(self):
|
|
||||||
# ignores non-numbers
|
|
||||||
MaximumValidation._from_openapi_data(
|
|
||||||
"x",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,54 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.maximum_validation_with_unsigned_integer import MaximumValidationWithUnsignedInteger
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestMaximumValidationWithUnsignedInteger(unittest.TestCase):
|
|
||||||
"""MaximumValidationWithUnsignedInteger unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_below_the_maximum_is_invalid_passes(self):
|
|
||||||
# below the maximum is invalid
|
|
||||||
MaximumValidationWithUnsignedInteger._from_openapi_data(
|
|
||||||
299.97,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_above_the_maximum_is_invalid_fails(self):
|
|
||||||
# above the maximum is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
MaximumValidationWithUnsignedInteger._from_openapi_data(
|
|
||||||
300.5,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_boundary_point_integer_is_valid_passes(self):
|
|
||||||
# boundary point integer is valid
|
|
||||||
MaximumValidationWithUnsignedInteger._from_openapi_data(
|
|
||||||
300,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_boundary_point_float_is_valid_passes(self):
|
|
||||||
# boundary point float is valid
|
|
||||||
MaximumValidationWithUnsignedInteger._from_openapi_data(
|
|
||||||
300.0,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,63 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.maxitems_validation import MaxitemsValidation
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestMaxitemsValidation(unittest.TestCase):
|
|
||||||
"""MaxitemsValidation unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_too_long_is_invalid_fails(self):
|
|
||||||
# too long is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
MaxitemsValidation._from_openapi_data(
|
|
||||||
[
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
3,
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_ignores_non_arrays_passes(self):
|
|
||||||
# ignores non-arrays
|
|
||||||
MaxitemsValidation._from_openapi_data(
|
|
||||||
"foobar",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_shorter_is_valid_passes(self):
|
|
||||||
# shorter is valid
|
|
||||||
MaxitemsValidation._from_openapi_data(
|
|
||||||
[
|
|
||||||
1,
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_exact_length_is_valid_passes(self):
|
|
||||||
# exact length is valid
|
|
||||||
MaxitemsValidation._from_openapi_data(
|
|
||||||
[
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,61 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.maxlength_validation import MaxlengthValidation
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestMaxlengthValidation(unittest.TestCase):
|
|
||||||
"""MaxlengthValidation unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_too_long_is_invalid_fails(self):
|
|
||||||
# too long is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
MaxlengthValidation._from_openapi_data(
|
|
||||||
"foo",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_ignores_non_strings_passes(self):
|
|
||||||
# ignores non-strings
|
|
||||||
MaxlengthValidation._from_openapi_data(
|
|
||||||
100,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_shorter_is_valid_passes(self):
|
|
||||||
# shorter is valid
|
|
||||||
MaxlengthValidation._from_openapi_data(
|
|
||||||
"f",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_two_supplementary_unicode_code_points_is_long_enough_passes(self):
|
|
||||||
# two supplementary Unicode code points is long enough
|
|
||||||
MaxlengthValidation._from_openapi_data(
|
|
||||||
"💩💩",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_exact_length_is_valid_passes(self):
|
|
||||||
# exact length is valid
|
|
||||||
MaxlengthValidation._from_openapi_data(
|
|
||||||
"fo",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,44 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.maxproperties0_means_the_object_is_empty import Maxproperties0MeansTheObjectIsEmpty
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestMaxproperties0MeansTheObjectIsEmpty(unittest.TestCase):
|
|
||||||
"""Maxproperties0MeansTheObjectIsEmpty unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_no_properties_is_valid_passes(self):
|
|
||||||
# no properties is valid
|
|
||||||
Maxproperties0MeansTheObjectIsEmpty._from_openapi_data(
|
|
||||||
{
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_one_property_is_invalid_fails(self):
|
|
||||||
# one property is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
Maxproperties0MeansTheObjectIsEmpty._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
1,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,87 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.maxproperties_validation import MaxpropertiesValidation
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestMaxpropertiesValidation(unittest.TestCase):
|
|
||||||
"""MaxpropertiesValidation unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_too_long_is_invalid_fails(self):
|
|
||||||
# too long is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
MaxpropertiesValidation._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
1,
|
|
||||||
"bar":
|
|
||||||
2,
|
|
||||||
"baz":
|
|
||||||
3,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_ignores_arrays_passes(self):
|
|
||||||
# ignores arrays
|
|
||||||
MaxpropertiesValidation._from_openapi_data(
|
|
||||||
[
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
3,
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_ignores_other_non_objects_passes(self):
|
|
||||||
# ignores other non-objects
|
|
||||||
MaxpropertiesValidation._from_openapi_data(
|
|
||||||
12,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_ignores_strings_passes(self):
|
|
||||||
# ignores strings
|
|
||||||
MaxpropertiesValidation._from_openapi_data(
|
|
||||||
"foobar",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_shorter_is_valid_passes(self):
|
|
||||||
# shorter is valid
|
|
||||||
MaxpropertiesValidation._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
1,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_exact_length_is_valid_passes(self):
|
|
||||||
# exact length is valid
|
|
||||||
MaxpropertiesValidation._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
1,
|
|
||||||
"bar":
|
|
||||||
2,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,54 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.minimum_validation import MinimumValidation
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestMinimumValidation(unittest.TestCase):
|
|
||||||
"""MinimumValidation unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_boundary_point_is_valid_passes(self):
|
|
||||||
# boundary point is valid
|
|
||||||
MinimumValidation._from_openapi_data(
|
|
||||||
1.1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_below_the_minimum_is_invalid_fails(self):
|
|
||||||
# below the minimum is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
MinimumValidation._from_openapi_data(
|
|
||||||
0.6,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_above_the_minimum_is_valid_passes(self):
|
|
||||||
# above the minimum is valid
|
|
||||||
MinimumValidation._from_openapi_data(
|
|
||||||
2.6,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_ignores_non_numbers_passes(self):
|
|
||||||
# ignores non-numbers
|
|
||||||
MinimumValidation._from_openapi_data(
|
|
||||||
"x",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,76 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.minimum_validation_with_signed_integer import MinimumValidationWithSignedInteger
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestMinimumValidationWithSignedInteger(unittest.TestCase):
|
|
||||||
"""MinimumValidationWithSignedInteger unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_boundary_point_is_valid_passes(self):
|
|
||||||
# boundary point is valid
|
|
||||||
MinimumValidationWithSignedInteger._from_openapi_data(
|
|
||||||
-2,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_positive_above_the_minimum_is_valid_passes(self):
|
|
||||||
# positive above the minimum is valid
|
|
||||||
MinimumValidationWithSignedInteger._from_openapi_data(
|
|
||||||
0,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_int_below_the_minimum_is_invalid_fails(self):
|
|
||||||
# int below the minimum is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
MinimumValidationWithSignedInteger._from_openapi_data(
|
|
||||||
-3,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_float_below_the_minimum_is_invalid_fails(self):
|
|
||||||
# float below the minimum is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
MinimumValidationWithSignedInteger._from_openapi_data(
|
|
||||||
-2.0001,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_boundary_point_with_float_is_valid_passes(self):
|
|
||||||
# boundary point with float is valid
|
|
||||||
MinimumValidationWithSignedInteger._from_openapi_data(
|
|
||||||
-2.0,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_negative_above_the_minimum_is_valid_passes(self):
|
|
||||||
# negative above the minimum is valid
|
|
||||||
MinimumValidationWithSignedInteger._from_openapi_data(
|
|
||||||
-1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_ignores_non_numbers_passes(self):
|
|
||||||
# ignores non-numbers
|
|
||||||
MinimumValidationWithSignedInteger._from_openapi_data(
|
|
||||||
"x",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,60 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.minitems_validation import MinitemsValidation
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestMinitemsValidation(unittest.TestCase):
|
|
||||||
"""MinitemsValidation unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_too_short_is_invalid_fails(self):
|
|
||||||
# too short is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
MinitemsValidation._from_openapi_data(
|
|
||||||
[
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_ignores_non_arrays_passes(self):
|
|
||||||
# ignores non-arrays
|
|
||||||
MinitemsValidation._from_openapi_data(
|
|
||||||
"",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_longer_is_valid_passes(self):
|
|
||||||
# longer is valid
|
|
||||||
MinitemsValidation._from_openapi_data(
|
|
||||||
[
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_exact_length_is_valid_passes(self):
|
|
||||||
# exact length is valid
|
|
||||||
MinitemsValidation._from_openapi_data(
|
|
||||||
[
|
|
||||||
1,
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,62 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.minlength_validation import MinlengthValidation
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestMinlengthValidation(unittest.TestCase):
|
|
||||||
"""MinlengthValidation unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_too_short_is_invalid_fails(self):
|
|
||||||
# too short is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
MinlengthValidation._from_openapi_data(
|
|
||||||
"f",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_one_supplementary_unicode_code_point_is_not_long_enough_fails(self):
|
|
||||||
# one supplementary Unicode code point is not long enough
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
MinlengthValidation._from_openapi_data(
|
|
||||||
"💩",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_longer_is_valid_passes(self):
|
|
||||||
# longer is valid
|
|
||||||
MinlengthValidation._from_openapi_data(
|
|
||||||
"foo",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_ignores_non_strings_passes(self):
|
|
||||||
# ignores non-strings
|
|
||||||
MinlengthValidation._from_openapi_data(
|
|
||||||
1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_exact_length_is_valid_passes(self):
|
|
||||||
# exact length is valid
|
|
||||||
MinlengthValidation._from_openapi_data(
|
|
||||||
"fo",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,78 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.minproperties_validation import MinpropertiesValidation
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestMinpropertiesValidation(unittest.TestCase):
|
|
||||||
"""MinpropertiesValidation unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_ignores_arrays_passes(self):
|
|
||||||
# ignores arrays
|
|
||||||
MinpropertiesValidation._from_openapi_data(
|
|
||||||
[
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_ignores_other_non_objects_passes(self):
|
|
||||||
# ignores other non-objects
|
|
||||||
MinpropertiesValidation._from_openapi_data(
|
|
||||||
12,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_too_short_is_invalid_fails(self):
|
|
||||||
# too short is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
MinpropertiesValidation._from_openapi_data(
|
|
||||||
{
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_ignores_strings_passes(self):
|
|
||||||
# ignores strings
|
|
||||||
MinpropertiesValidation._from_openapi_data(
|
|
||||||
"",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_longer_is_valid_passes(self):
|
|
||||||
# longer is valid
|
|
||||||
MinpropertiesValidation._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
1,
|
|
||||||
"bar":
|
|
||||||
2,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_exact_length_is_valid_passes(self):
|
|
||||||
# exact length is valid
|
|
||||||
MinpropertiesValidation._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
1,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,40 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.model_not import ModelNot
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestModelNot(unittest.TestCase):
|
|
||||||
"""ModelNot unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_allowed_passes(self):
|
|
||||||
# allowed
|
|
||||||
ModelNot._from_openapi_data(
|
|
||||||
"foo",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_disallowed_fails(self):
|
|
||||||
# disallowed
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
ModelNot._from_openapi_data(
|
|
||||||
1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,40 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.nested_allof_to_check_validation_semantics import NestedAllofToCheckValidationSemantics
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestNestedAllofToCheckValidationSemantics(unittest.TestCase):
|
|
||||||
"""NestedAllofToCheckValidationSemantics unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_anything_non_null_is_invalid_fails(self):
|
|
||||||
# anything non-null is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
NestedAllofToCheckValidationSemantics._from_openapi_data(
|
|
||||||
123,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_null_is_valid_passes(self):
|
|
||||||
# null is valid
|
|
||||||
NestedAllofToCheckValidationSemantics._from_openapi_data(
|
|
||||||
None,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,40 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.nested_anyof_to_check_validation_semantics import NestedAnyofToCheckValidationSemantics
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestNestedAnyofToCheckValidationSemantics(unittest.TestCase):
|
|
||||||
"""NestedAnyofToCheckValidationSemantics unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_anything_non_null_is_invalid_fails(self):
|
|
||||||
# anything non-null is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
NestedAnyofToCheckValidationSemantics._from_openapi_data(
|
|
||||||
123,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_null_is_valid_passes(self):
|
|
||||||
# null is valid
|
|
||||||
NestedAnyofToCheckValidationSemantics._from_openapi_data(
|
|
||||||
None,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,129 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.nested_items import NestedItems
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestNestedItems(unittest.TestCase):
|
|
||||||
"""NestedItems unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_valid_nested_array_passes(self):
|
|
||||||
# valid nested array
|
|
||||||
NestedItems._from_openapi_data(
|
|
||||||
[
|
|
||||||
[
|
|
||||||
[
|
|
||||||
[
|
|
||||||
1,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
[
|
|
||||||
2,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
3,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
[
|
|
||||||
[
|
|
||||||
4,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
5,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
6,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_nested_array_with_invalid_type_fails(self):
|
|
||||||
# nested array with invalid type
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
NestedItems._from_openapi_data(
|
|
||||||
[
|
|
||||||
[
|
|
||||||
[
|
|
||||||
[
|
|
||||||
"1",
|
|
||||||
],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
[
|
|
||||||
2,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
3,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
[
|
|
||||||
[
|
|
||||||
4,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
5,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
6,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_not_deep_enough_fails(self):
|
|
||||||
# not deep enough
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
NestedItems._from_openapi_data(
|
|
||||||
[
|
|
||||||
[
|
|
||||||
[
|
|
||||||
1,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
2,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
3,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
[
|
|
||||||
4,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
5,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
6,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,40 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.nested_oneof_to_check_validation_semantics import NestedOneofToCheckValidationSemantics
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestNestedOneofToCheckValidationSemantics(unittest.TestCase):
|
|
||||||
"""NestedOneofToCheckValidationSemantics unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_anything_non_null_is_invalid_fails(self):
|
|
||||||
# anything non-null is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
NestedOneofToCheckValidationSemantics._from_openapi_data(
|
|
||||||
123,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_null_is_valid_passes(self):
|
|
||||||
# null is valid
|
|
||||||
NestedOneofToCheckValidationSemantics._from_openapi_data(
|
|
||||||
None,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,53 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.not_more_complex_schema import NotMoreComplexSchema
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestNotMoreComplexSchema(unittest.TestCase):
|
|
||||||
"""NotMoreComplexSchema unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_other_match_passes(self):
|
|
||||||
# other match
|
|
||||||
NotMoreComplexSchema._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
1,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_mismatch_fails(self):
|
|
||||||
# mismatch
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
NotMoreComplexSchema._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
"bar",
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_match_passes(self):
|
|
||||||
# match
|
|
||||||
NotMoreComplexSchema._from_openapi_data(
|
|
||||||
1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,40 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.nul_characters_in_strings import NulCharactersInStrings
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestNulCharactersInStrings(unittest.TestCase):
|
|
||||||
"""NulCharactersInStrings unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_match_string_with_nul_passes(self):
|
|
||||||
# match string with nul
|
|
||||||
NulCharactersInStrings._from_openapi_data(
|
|
||||||
"hello\x00there",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_do_not_match_string_lacking_nul_fails(self):
|
|
||||||
# do not match string lacking nul
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
NulCharactersInStrings._from_openapi_data(
|
|
||||||
"hellothere",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,106 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.null_type_matches_only_the_null_object import NullTypeMatchesOnlyTheNullObject
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestNullTypeMatchesOnlyTheNullObject(unittest.TestCase):
|
|
||||||
"""NullTypeMatchesOnlyTheNullObject unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_a_float_is_not_null_fails(self):
|
|
||||||
# a float is not null
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
NullTypeMatchesOnlyTheNullObject._from_openapi_data(
|
|
||||||
1.1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_an_object_is_not_null_fails(self):
|
|
||||||
# an object is not null
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
NullTypeMatchesOnlyTheNullObject._from_openapi_data(
|
|
||||||
{
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_false_is_not_null_fails(self):
|
|
||||||
# false is not null
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
NullTypeMatchesOnlyTheNullObject._from_openapi_data(
|
|
||||||
False,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_an_integer_is_not_null_fails(self):
|
|
||||||
# an integer is not null
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
NullTypeMatchesOnlyTheNullObject._from_openapi_data(
|
|
||||||
1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_true_is_not_null_fails(self):
|
|
||||||
# true is not null
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
NullTypeMatchesOnlyTheNullObject._from_openapi_data(
|
|
||||||
True,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_zero_is_not_null_fails(self):
|
|
||||||
# zero is not null
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
NullTypeMatchesOnlyTheNullObject._from_openapi_data(
|
|
||||||
0,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_an_empty_string_is_not_null_fails(self):
|
|
||||||
# an empty string is not null
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
NullTypeMatchesOnlyTheNullObject._from_openapi_data(
|
|
||||||
"",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_null_is_null_passes(self):
|
|
||||||
# null is null
|
|
||||||
NullTypeMatchesOnlyTheNullObject._from_openapi_data(
|
|
||||||
None,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_an_array_is_not_null_fails(self):
|
|
||||||
# an array is not null
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
NullTypeMatchesOnlyTheNullObject._from_openapi_data(
|
|
||||||
[
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_a_string_is_not_null_fails(self):
|
|
||||||
# a string is not null
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
NullTypeMatchesOnlyTheNullObject._from_openapi_data(
|
|
||||||
"foo",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,96 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.number_type_matches_numbers import NumberTypeMatchesNumbers
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestNumberTypeMatchesNumbers(unittest.TestCase):
|
|
||||||
"""NumberTypeMatchesNumbers unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_an_array_is_not_a_number_fails(self):
|
|
||||||
# an array is not a number
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
NumberTypeMatchesNumbers._from_openapi_data(
|
|
||||||
[
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_null_is_not_a_number_fails(self):
|
|
||||||
# null is not a number
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
NumberTypeMatchesNumbers._from_openapi_data(
|
|
||||||
None,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_an_object_is_not_a_number_fails(self):
|
|
||||||
# an object is not a number
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
NumberTypeMatchesNumbers._from_openapi_data(
|
|
||||||
{
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_a_boolean_is_not_a_number_fails(self):
|
|
||||||
# a boolean is not a number
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
NumberTypeMatchesNumbers._from_openapi_data(
|
|
||||||
True,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_a_float_is_a_number_passes(self):
|
|
||||||
# a float is a number
|
|
||||||
NumberTypeMatchesNumbers._from_openapi_data(
|
|
||||||
1.1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_a_string_is_still_not_a_number_even_if_it_looks_like_one_fails(self):
|
|
||||||
# a string is still not a number, even if it looks like one
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
NumberTypeMatchesNumbers._from_openapi_data(
|
|
||||||
"1",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_a_string_is_not_a_number_fails(self):
|
|
||||||
# a string is not a number
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
NumberTypeMatchesNumbers._from_openapi_data(
|
|
||||||
"foo",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_an_integer_is_a_number_passes(self):
|
|
||||||
# an integer is a number
|
|
||||||
NumberTypeMatchesNumbers._from_openapi_data(
|
|
||||||
1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_a_float_with_zero_fractional_part_is_a_number_and_an_integer_passes(self):
|
|
||||||
# a float with zero fractional part is a number (and an integer)
|
|
||||||
NumberTypeMatchesNumbers._from_openapi_data(
|
|
||||||
1.0,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,92 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.object_properties_validation import ObjectPropertiesValidation
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestObjectPropertiesValidation(unittest.TestCase):
|
|
||||||
"""ObjectPropertiesValidation unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_ignores_arrays_passes(self):
|
|
||||||
# ignores arrays
|
|
||||||
ObjectPropertiesValidation._from_openapi_data(
|
|
||||||
[
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_ignores_other_non_objects_passes(self):
|
|
||||||
# ignores other non-objects
|
|
||||||
ObjectPropertiesValidation._from_openapi_data(
|
|
||||||
12,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_one_property_invalid_is_invalid_fails(self):
|
|
||||||
# one property invalid is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
ObjectPropertiesValidation._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
1,
|
|
||||||
"bar":
|
|
||||||
{
|
|
||||||
},
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_both_properties_present_and_valid_is_valid_passes(self):
|
|
||||||
# both properties present and valid is valid
|
|
||||||
ObjectPropertiesValidation._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
1,
|
|
||||||
"bar":
|
|
||||||
"baz",
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_doesn_t_invalidate_other_properties_passes(self):
|
|
||||||
# doesn't invalidate other properties
|
|
||||||
ObjectPropertiesValidation._from_openapi_data(
|
|
||||||
{
|
|
||||||
"quux":
|
|
||||||
[
|
|
||||||
],
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_both_properties_invalid_is_invalid_fails(self):
|
|
||||||
# both properties invalid is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
ObjectPropertiesValidation._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
[
|
|
||||||
],
|
|
||||||
"bar":
|
|
||||||
{
|
|
||||||
},
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,55 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.oneof import Oneof
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestOneof(unittest.TestCase):
|
|
||||||
"""Oneof unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_second_oneof_valid_passes(self):
|
|
||||||
# second oneOf valid
|
|
||||||
Oneof._from_openapi_data(
|
|
||||||
2.5,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_both_oneof_valid_fails(self):
|
|
||||||
# both oneOf valid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
Oneof._from_openapi_data(
|
|
||||||
3,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_first_oneof_valid_passes(self):
|
|
||||||
# first oneOf valid
|
|
||||||
Oneof._from_openapi_data(
|
|
||||||
1,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_neither_oneof_valid_fails(self):
|
|
||||||
# neither oneOf valid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
Oneof._from_openapi_data(
|
|
||||||
1.5,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,71 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.oneof_complex_types import OneofComplexTypes
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestOneofComplexTypes(unittest.TestCase):
|
|
||||||
"""OneofComplexTypes unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_first_oneof_valid_complex_passes(self):
|
|
||||||
# first oneOf valid (complex)
|
|
||||||
OneofComplexTypes._from_openapi_data(
|
|
||||||
{
|
|
||||||
"bar":
|
|
||||||
2,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_neither_oneof_valid_complex_fails(self):
|
|
||||||
# neither oneOf valid (complex)
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
OneofComplexTypes._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
2,
|
|
||||||
"bar":
|
|
||||||
"quux",
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_both_oneof_valid_complex_fails(self):
|
|
||||||
# both oneOf valid (complex)
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
OneofComplexTypes._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
"baz",
|
|
||||||
"bar":
|
|
||||||
2,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_second_oneof_valid_complex_passes(self):
|
|
||||||
# second oneOf valid (complex)
|
|
||||||
OneofComplexTypes._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo":
|
|
||||||
"baz",
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,48 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.oneof_with_base_schema import OneofWithBaseSchema
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestOneofWithBaseSchema(unittest.TestCase):
|
|
||||||
"""OneofWithBaseSchema unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_both_oneof_valid_fails(self):
|
|
||||||
# both oneOf valid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
OneofWithBaseSchema._from_openapi_data(
|
|
||||||
"foo",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_mismatch_base_schema_fails(self):
|
|
||||||
# mismatch base schema
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
OneofWithBaseSchema._from_openapi_data(
|
|
||||||
3,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_one_oneof_valid_passes(self):
|
|
||||||
# one oneOf valid
|
|
||||||
OneofWithBaseSchema._from_openapi_data(
|
|
||||||
"foobar",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,40 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.oneof_with_empty_schema import OneofWithEmptySchema
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestOneofWithEmptySchema(unittest.TestCase):
|
|
||||||
"""OneofWithEmptySchema unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_both_valid_invalid_fails(self):
|
|
||||||
# both valid - invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
OneofWithEmptySchema._from_openapi_data(
|
|
||||||
123,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_one_valid_valid_passes(self):
|
|
||||||
# one valid - valid
|
|
||||||
OneofWithEmptySchema._from_openapi_data(
|
|
||||||
"foo",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,32 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.pattern_is_not_anchored import PatternIsNotAnchored
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestPatternIsNotAnchored(unittest.TestCase):
|
|
||||||
"""PatternIsNotAnchored unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_matches_a_substring_passes(self):
|
|
||||||
# matches a substring
|
|
||||||
PatternIsNotAnchored._from_openapi_data(
|
|
||||||
"xxaayy",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,84 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.pattern_validation import PatternValidation
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestPatternValidation(unittest.TestCase):
|
|
||||||
"""PatternValidation unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_ignores_arrays_passes(self):
|
|
||||||
# ignores arrays
|
|
||||||
PatternValidation._from_openapi_data(
|
|
||||||
[
|
|
||||||
],
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_ignores_objects_passes(self):
|
|
||||||
# ignores objects
|
|
||||||
PatternValidation._from_openapi_data(
|
|
||||||
{
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_ignores_null_passes(self):
|
|
||||||
# ignores null
|
|
||||||
PatternValidation._from_openapi_data(
|
|
||||||
None,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_ignores_floats_passes(self):
|
|
||||||
# ignores floats
|
|
||||||
PatternValidation._from_openapi_data(
|
|
||||||
1.0,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_a_non_matching_pattern_is_invalid_fails(self):
|
|
||||||
# a non-matching pattern is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
PatternValidation._from_openapi_data(
|
|
||||||
"abc",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_ignores_booleans_passes(self):
|
|
||||||
# ignores booleans
|
|
||||||
PatternValidation._from_openapi_data(
|
|
||||||
True,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_a_matching_pattern_is_valid_passes(self):
|
|
||||||
# a matching pattern is valid
|
|
||||||
PatternValidation._from_openapi_data(
|
|
||||||
"aaa",
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_ignores_integers_passes(self):
|
|
||||||
# ignores integers
|
|
||||||
PatternValidation._from_openapi_data(
|
|
||||||
123,
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,66 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.properties_with_escaped_characters import PropertiesWithEscapedCharacters
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestPropertiesWithEscapedCharacters(unittest.TestCase):
|
|
||||||
"""PropertiesWithEscapedCharacters unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_object_with_all_numbers_is_valid_passes(self):
|
|
||||||
# object with all numbers is valid
|
|
||||||
PropertiesWithEscapedCharacters._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo\nbar":
|
|
||||||
1,
|
|
||||||
"foo\"bar":
|
|
||||||
1,
|
|
||||||
"foo\\bar":
|
|
||||||
1,
|
|
||||||
"foo\rbar":
|
|
||||||
1,
|
|
||||||
"foo\tbar":
|
|
||||||
1,
|
|
||||||
"foo\fbar":
|
|
||||||
1,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_object_with_strings_is_invalid_fails(self):
|
|
||||||
# object with strings is invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
PropertiesWithEscapedCharacters._from_openapi_data(
|
|
||||||
{
|
|
||||||
"foo\nbar":
|
|
||||||
"1",
|
|
||||||
"foo\"bar":
|
|
||||||
"1",
|
|
||||||
"foo\\bar":
|
|
||||||
"1",
|
|
||||||
"foo\rbar":
|
|
||||||
"1",
|
|
||||||
"foo\tbar":
|
|
||||||
"1",
|
|
||||||
"foo\fbar":
|
|
||||||
"1",
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,46 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.property_named_ref_that_is_not_a_reference import PropertyNamedRefThatIsNotAReference
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestPropertyNamedRefThatIsNotAReference(unittest.TestCase):
|
|
||||||
"""PropertyNamedRefThatIsNotAReference unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_property_named_ref_valid_passes(self):
|
|
||||||
# property named $ref valid
|
|
||||||
PropertyNamedRefThatIsNotAReference._from_openapi_data(
|
|
||||||
{
|
|
||||||
"$ref":
|
|
||||||
"a",
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_property_named_ref_invalid_fails(self):
|
|
||||||
# property named $ref invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
PropertyNamedRefThatIsNotAReference._from_openapi_data(
|
|
||||||
{
|
|
||||||
"$ref":
|
|
||||||
2,
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,52 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
openapi 3.0.3 sample spec
|
|
||||||
|
|
||||||
sample spec for testing openapi functionality, built from json schema tests for draft6 # noqa: E501
|
|
||||||
|
|
||||||
The version of the OpenAPI document: 0.0.1
|
|
||||||
Generated by: https://openapi-generator.tech
|
|
||||||
"""
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import unit_test_api
|
|
||||||
from unit_test_api.model.ref_in_additionalproperties import RefInAdditionalproperties
|
|
||||||
from unit_test_api import configuration
|
|
||||||
|
|
||||||
|
|
||||||
class TestRefInAdditionalproperties(unittest.TestCase):
|
|
||||||
"""RefInAdditionalproperties unit test stubs"""
|
|
||||||
_configuration = configuration.Configuration()
|
|
||||||
|
|
||||||
def test_property_named_ref_valid_passes(self):
|
|
||||||
# property named $ref valid
|
|
||||||
RefInAdditionalproperties._from_openapi_data(
|
|
||||||
{
|
|
||||||
"someProp":
|
|
||||||
{
|
|
||||||
"$ref":
|
|
||||||
"a",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_property_named_ref_invalid_fails(self):
|
|
||||||
# property named $ref invalid
|
|
||||||
with self.assertRaises((unit_test_api.ApiValueError, unit_test_api.ApiTypeError)):
|
|
||||||
RefInAdditionalproperties._from_openapi_data(
|
|
||||||
{
|
|
||||||
"someProp":
|
|
||||||
{
|
|
||||||
"$ref":
|
|
||||||
2,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
_configuration=self._configuration
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user