forked from loafle/openapi-generator-original
Improve example value handling in C# generators (#11355)
* improve example value handling in C# generators * fix typo * update samples
This commit is contained in:
@@ -119,8 +119,8 @@ namespace Example
|
||||
|
||||
var apiInstance = new FakeApi(Configuration.Default);
|
||||
var pet = new Pet(); // Pet | Pet object that needs to be added to the store
|
||||
var query1 = query1_example; // string | query parameter (optional)
|
||||
var header1 = header1_example; // string | header parameter (optional)
|
||||
var query1 = "query1_example"; // string | query parameter (optional)
|
||||
var header1 = "header1_example"; // string | header parameter (optional)
|
||||
|
||||
try
|
||||
{
|
||||
@@ -347,7 +347,7 @@ namespace Example
|
||||
{
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new FakeApi(Configuration.Default);
|
||||
var body = 8.14; // decimal? | Input number as post body (optional)
|
||||
var body = 8.14D; // decimal? | Input number as post body (optional)
|
||||
|
||||
try
|
||||
{
|
||||
@@ -422,7 +422,7 @@ namespace Example
|
||||
{
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new FakeApi(Configuration.Default);
|
||||
var body = body_example; // string | Input string as post body (optional)
|
||||
var body = "body_example"; // string | Input string as post body (optional)
|
||||
|
||||
try
|
||||
{
|
||||
@@ -572,7 +572,7 @@ namespace Example
|
||||
{
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new FakeApi(Configuration.Default);
|
||||
var body = BINARY_DATA_HERE; // System.IO.Stream | image to upload
|
||||
var body = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | image to upload
|
||||
|
||||
try
|
||||
{
|
||||
@@ -718,7 +718,7 @@ namespace Example
|
||||
{
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new FakeApi(Configuration.Default);
|
||||
var query = query_example; // string |
|
||||
var query = "query_example"; // string |
|
||||
var user = new User(); // User |
|
||||
|
||||
try
|
||||
@@ -874,20 +874,20 @@ namespace Example
|
||||
Configuration.Default.Password = "YOUR_PASSWORD";
|
||||
|
||||
var apiInstance = new FakeApi(Configuration.Default);
|
||||
var number = 8.14; // decimal | None
|
||||
var number = 8.14D; // decimal | None
|
||||
var _double = 1.2D; // double | None
|
||||
var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None
|
||||
var _byte = BYTE_ARRAY_DATA_HERE; // byte[] | None
|
||||
var patternWithoutDelimiter = "patternWithoutDelimiter_example"; // string | None
|
||||
var _byte = System.Text.Encoding.ASCII.GetBytes("BYTE_ARRAY_DATA_HERE"); // byte[] | None
|
||||
var integer = 56; // int? | None (optional)
|
||||
var int32 = 56; // int? | None (optional)
|
||||
var int64 = 789; // long? | None (optional)
|
||||
var int64 = 789L; // long? | None (optional)
|
||||
var _float = 3.4F; // float? | None (optional)
|
||||
var _string = _string_example; // string | None (optional)
|
||||
var binary = BINARY_DATA_HERE; // System.IO.Stream | None (optional)
|
||||
var date = 2013-10-20; // DateTime? | None (optional)
|
||||
var dateTime = 2013-10-20T19:20:30+01:00; // DateTime? | None (optional)
|
||||
var password = password_example; // string | None (optional)
|
||||
var callback = callback_example; // string | None (optional)
|
||||
var _string = "_string_example"; // string | None (optional)
|
||||
var binary = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | None (optional)
|
||||
var date = DateTime.Parse("2013-10-20"); // DateTime? | None (optional)
|
||||
var dateTime = DateTime.Parse("2013-10-20T19:20:30+01:00"); // DateTime? | None (optional)
|
||||
var password = "password_example"; // string | None (optional)
|
||||
var callback = "callback_example"; // string | None (optional)
|
||||
|
||||
try
|
||||
{
|
||||
@@ -977,13 +977,13 @@ namespace Example
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new FakeApi(Configuration.Default);
|
||||
var enumHeaderStringArray = new List<string>(); // List<string> | Header parameter enum test (string array) (optional)
|
||||
var enumHeaderString = enumHeaderString_example; // string | Header parameter enum test (string) (optional) (default to -efg)
|
||||
var enumHeaderString = "_abc"; // string | Header parameter enum test (string) (optional) (default to -efg)
|
||||
var enumQueryStringArray = new List<string>(); // List<string> | Query parameter enum test (string array) (optional)
|
||||
var enumQueryString = enumQueryString_example; // string | Query parameter enum test (string) (optional) (default to -efg)
|
||||
var enumQueryInteger = 56; // int? | Query parameter enum test (double) (optional)
|
||||
var enumQueryDouble = 1.2D; // double? | Query parameter enum test (double) (optional)
|
||||
var enumQueryString = "_abc"; // string | Query parameter enum test (string) (optional) (default to -efg)
|
||||
var enumQueryInteger = 1; // int? | Query parameter enum test (double) (optional)
|
||||
var enumQueryDouble = 1.1D; // double? | Query parameter enum test (double) (optional)
|
||||
var enumFormStringArray = new List<string>(); // List<string> | Form parameter enum test (string array) (optional) (default to $)
|
||||
var enumFormString = enumFormString_example; // string | Form parameter enum test (string) (optional) (default to -efg)
|
||||
var enumFormString = "_abc"; // string | Form parameter enum test (string) (optional) (default to -efg)
|
||||
|
||||
try
|
||||
{
|
||||
@@ -1071,10 +1071,10 @@ namespace Example
|
||||
var apiInstance = new FakeApi(Configuration.Default);
|
||||
var requiredStringGroup = 56; // int | Required String in group parameters
|
||||
var requiredBooleanGroup = true; // bool | Required Boolean in group parameters
|
||||
var requiredInt64Group = 789; // long | Required Integer in group parameters
|
||||
var requiredInt64Group = 789L; // long | Required Integer in group parameters
|
||||
var stringGroup = 56; // int? | String in group parameters (optional)
|
||||
var booleanGroup = true; // bool? | Boolean in group parameters (optional)
|
||||
var int64Group = 789; // long? | Integer in group parameters (optional)
|
||||
var int64Group = 789L; // long? | Integer in group parameters (optional)
|
||||
|
||||
try
|
||||
{
|
||||
@@ -1225,8 +1225,8 @@ namespace Example
|
||||
{
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new FakeApi(Configuration.Default);
|
||||
var param = param_example; // string | field1
|
||||
var param2 = param2_example; // string | field2
|
||||
var param = "param_example"; // string | field1
|
||||
var param2 = "param2_example"; // string | field2
|
||||
|
||||
try
|
||||
{
|
||||
@@ -1307,7 +1307,7 @@ namespace Example
|
||||
var http = new List<string>(); // List<string> |
|
||||
var url = new List<string>(); // List<string> |
|
||||
var context = new List<string>(); // List<string> |
|
||||
var allowEmpty = allowEmpty_example; // string |
|
||||
var allowEmpty = "allowEmpty_example"; // string |
|
||||
var language = new Dictionary<string, string>(); // Dictionary<string, string> | (optional)
|
||||
|
||||
try
|
||||
|
||||
@@ -119,8 +119,8 @@ namespace Example
|
||||
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
|
||||
|
||||
var apiInstance = new PetApi(Configuration.Default);
|
||||
var petId = 789; // long | Pet id to delete
|
||||
var apiKey = apiKey_example; // string | (optional)
|
||||
var petId = 789L; // long | Pet id to delete
|
||||
var apiKey = "apiKey_example"; // string | (optional)
|
||||
|
||||
try
|
||||
{
|
||||
@@ -362,7 +362,7 @@ namespace Example
|
||||
// Configuration.Default.AddApiKeyPrefix("api_key", "Bearer");
|
||||
|
||||
var apiInstance = new PetApi(Configuration.Default);
|
||||
var petId = 789; // long | ID of pet to return
|
||||
var petId = 789L; // long | ID of pet to return
|
||||
|
||||
try
|
||||
{
|
||||
@@ -520,9 +520,9 @@ namespace Example
|
||||
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
|
||||
|
||||
var apiInstance = new PetApi(Configuration.Default);
|
||||
var petId = 789; // long | ID of pet that needs to be updated
|
||||
var name = name_example; // string | Updated name of the pet (optional)
|
||||
var status = status_example; // string | Updated status of the pet (optional)
|
||||
var petId = 789L; // long | ID of pet that needs to be updated
|
||||
var name = "name_example"; // string | Updated name of the pet (optional)
|
||||
var status = "status_example"; // string | Updated status of the pet (optional)
|
||||
|
||||
try
|
||||
{
|
||||
@@ -601,9 +601,9 @@ namespace Example
|
||||
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
|
||||
|
||||
var apiInstance = new PetApi(Configuration.Default);
|
||||
var petId = 789; // long | ID of pet to update
|
||||
var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional)
|
||||
var file = BINARY_DATA_HERE; // System.IO.Stream | file to upload (optional)
|
||||
var petId = 789L; // long | ID of pet to update
|
||||
var additionalMetadata = "additionalMetadata_example"; // string | Additional data to pass to server (optional)
|
||||
var file = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | file to upload (optional)
|
||||
|
||||
try
|
||||
{
|
||||
@@ -682,9 +682,9 @@ namespace Example
|
||||
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
|
||||
|
||||
var apiInstance = new PetApi(Configuration.Default);
|
||||
var petId = 789; // long | ID of pet to update
|
||||
var requiredFile = BINARY_DATA_HERE; // System.IO.Stream | file to upload
|
||||
var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional)
|
||||
var petId = 789L; // long | ID of pet to update
|
||||
var requiredFile = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | file to upload
|
||||
var additionalMetadata = "additionalMetadata_example"; // string | Additional data to pass to server (optional)
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Example
|
||||
{
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new StoreApi(Configuration.Default);
|
||||
var orderId = orderId_example; // string | ID of the order that needs to be deleted
|
||||
var orderId = "orderId_example"; // string | ID of the order that needs to be deleted
|
||||
|
||||
try
|
||||
{
|
||||
@@ -189,7 +189,7 @@ namespace Example
|
||||
{
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new StoreApi(Configuration.Default);
|
||||
var orderId = 789; // long | ID of pet that needs to be fetched
|
||||
var orderId = 789L; // long | ID of pet that needs to be fetched
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -261,7 +261,7 @@ namespace Example
|
||||
{
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new UserApi(Configuration.Default);
|
||||
var username = username_example; // string | The name that needs to be deleted
|
||||
var username = "username_example"; // string | The name that needs to be deleted
|
||||
|
||||
try
|
||||
{
|
||||
@@ -335,7 +335,7 @@ namespace Example
|
||||
{
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new UserApi(Configuration.Default);
|
||||
var username = username_example; // string | The name that needs to be fetched. Use user1 for testing.
|
||||
var username = "username_example"; // string | The name that needs to be fetched. Use user1 for testing.
|
||||
|
||||
try
|
||||
{
|
||||
@@ -411,8 +411,8 @@ namespace Example
|
||||
{
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new UserApi(Configuration.Default);
|
||||
var username = username_example; // string | The user name for login
|
||||
var password = password_example; // string | The password for login in clear text
|
||||
var username = "username_example"; // string | The user name for login
|
||||
var password = "password_example"; // string | The password for login in clear text
|
||||
|
||||
try
|
||||
{
|
||||
@@ -559,7 +559,7 @@ namespace Example
|
||||
{
|
||||
Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
|
||||
var apiInstance = new UserApi(Configuration.Default);
|
||||
var username = username_example; // string | name that need to be deleted
|
||||
var username = "username_example"; // string | name that need to be deleted
|
||||
var user = new User(); // User | Updated user object
|
||||
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user