Skip to content

Commit 2d45cca

Browse files
Generated samples post-changes
1 parent d6f80cb commit 2d45cca

14 files changed

Lines changed: 448 additions & 57 deletions

File tree

samples/server/petstore/aspnetcore-8.0-abstract-class/.openapi-generator/FILES

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
.openapi-generator-ignore
21
Org.OpenAPITools.sln
32
README.md
43
build.bat

samples/server/petstore/aspnetcore-8.0-abstract-class/Org.OpenAPITools.sln

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
44
VisualStudioVersion = 15.0.27428.2043
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{3E624F8E-873F-45E1-B4B5-A119B896B68F}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{9BD1E054-7E75-4661-8583-7ADECCE30682}"
77
EndProject
88
Global
99
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1010
Debug|Any CPU = Debug|Any CPU
1111
Release|Any CPU = Release|Any CPU
1212
EndGlobalSection
1313
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14-
{3E624F8E-873F-45E1-B4B5-A119B896B68F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15-
{3E624F8E-873F-45E1-B4B5-A119B896B68F}.Debug|Any CPU.Build.0 = Debug|Any CPU
16-
{3E624F8E-873F-45E1-B4B5-A119B896B68F}.Release|Any CPU.ActiveCfg = Release|Any CPU
17-
{3E624F8E-873F-45E1-B4B5-A119B896B68F}.Release|Any CPU.Build.0 = Release|Any CPU
14+
{9BD1E054-7E75-4661-8583-7ADECCE30682}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{9BD1E054-7E75-4661-8583-7ADECCE30682}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{9BD1E054-7E75-4661-8583-7ADECCE30682}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{9BD1E054-7E75-4661-8583-7ADECCE30682}.Release|Any CPU.Build.0 = Release|Any CPU
1818
EndGlobalSection
1919
GlobalSection(SolutionProperties) = preSolution
2020
HideSolutionNode = FALSE

samples/server/petstore/aspnetcore-8.0-abstract-class/src/Org.OpenAPITools/Controllers/DefaultApi.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ public abstract class DefaultApiController : ControllerBase
3737
[Route("/v2/test")]
3838
[ValidateModelState]
3939
[SwaggerOperation("TestGet")]
40-
public abstract IActionResult TestGet([FromQuery (Name = "testQuery")]TestEnum? testQuery);
40+
public virtual IActionResult TestGet([FromQuery (Name = "testQuery")]TestEnum? testQuery)
41+
{
42+
43+
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
44+
// return StatusCode(200);
45+
46+
throw new NotImplementedException();
47+
}
4148
}
4249
}

samples/server/petstore/aspnetcore-8.0-abstract-class/src/Org.OpenAPITools/Controllers/FakeApi.cs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,20 @@ public abstract class FakeApiController : ControllerBase
3737
[ValidateModelState]
3838
[SwaggerOperation("FakeNullableExampleTest")]
3939
[SwaggerResponse(statusCode: 200, type: typeof(TestNullable), description: "Successful operation")]
40-
public abstract IActionResult FakeNullableExampleTest();
40+
public virtual IActionResult FakeNullableExampleTest()
41+
{
42+
43+
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
44+
// return StatusCode(200, default);
45+
string exampleJson = null;
46+
exampleJson = "{\r\n \"nullableName\" : \"nullableName\",\r\n \"name\" : \"name\"\r\n}";
47+
48+
var example = exampleJson != null
49+
? JsonConvert.DeserializeObject<TestNullable>(exampleJson)
50+
: default;
51+
//TODO: Change the data returned
52+
return new ObjectResult(example);
53+
}
4154

4255
/// <summary>
4356
/// fake endpoint to test parameter example (object)
@@ -48,6 +61,13 @@ public abstract class FakeApiController : ControllerBase
4861
[Route("/v2/fake/parameter_example_test")]
4962
[ValidateModelState]
5063
[SwaggerOperation("FakeParameterExampleTest")]
51-
public abstract IActionResult FakeParameterExampleTest([FromQuery (Name = "data")][Required()]Pet data);
64+
public virtual IActionResult FakeParameterExampleTest([FromQuery (Name = "data")][Required()]Pet data)
65+
{
66+
67+
//TODO: Uncomment the next line to return response 0 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
68+
// return StatusCode(0);
69+
70+
throw new NotImplementedException();
71+
}
5272
}
5373
}

samples/server/petstore/aspnetcore-8.0-abstract-class/src/Org.OpenAPITools/Controllers/PetApi.cs

Lines changed: 121 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,23 @@ public abstract class PetApiController : ControllerBase
4040
[ValidateModelState]
4141
[SwaggerOperation("AddPet")]
4242
[SwaggerResponse(statusCode: 200, type: typeof(Pet), description: "successful operation")]
43-
public abstract IActionResult AddPet([FromBody]Pet pet);
43+
public virtual IActionResult AddPet([FromBody]Pet pet)
44+
{
45+
46+
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
47+
// return StatusCode(200, default);
48+
//TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
49+
// return StatusCode(405);
50+
string exampleJson = null;
51+
exampleJson = "{\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\n}";
52+
exampleJson = "<Pet>\n <id>123456789</id>\n <Category>\n <id>123456789</id>\n <name>aeiou</name>\n </Category>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n <Tag>\n <id>123456789</id>\n <name>aeiou</name>\n </Tag>\n </tags>\n <status>aeiou</status>\n</Pet>";
53+
54+
var example = exampleJson != null
55+
? JsonConvert.DeserializeObject<Pet>(exampleJson)
56+
: default;
57+
//TODO: Change the data returned
58+
return new ObjectResult(example);
59+
}
4460

4561
/// <summary>
4662
/// Deletes a pet
@@ -52,7 +68,14 @@ public abstract class PetApiController : ControllerBase
5268
[Route("/v2/pet/{petId}")]
5369
[ValidateModelState]
5470
[SwaggerOperation("DeletePet")]
55-
public abstract IActionResult DeletePet([FromRoute (Name = "petId")][Required]long petId, [FromHeader (Name = "api_key")]string apiKey);
71+
public virtual IActionResult DeletePet([FromRoute (Name = "petId")][Required]long petId, [FromHeader (Name = "api_key")]string apiKey)
72+
{
73+
74+
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
75+
// return StatusCode(400);
76+
77+
throw new NotImplementedException();
78+
}
5679

5780
/// <summary>
5881
/// Finds Pets by status
@@ -66,7 +89,23 @@ public abstract class PetApiController : ControllerBase
6689
[ValidateModelState]
6790
[SwaggerOperation("FindPetsByStatus")]
6891
[SwaggerResponse(statusCode: 200, type: typeof(List<Pet>), description: "successful operation")]
69-
public abstract IActionResult FindPetsByStatus([FromQuery (Name = "status")][Required()]List<string> status);
92+
public virtual IActionResult FindPetsByStatus([FromQuery (Name = "status")][Required()]List<string> status)
93+
{
94+
95+
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
96+
// return StatusCode(200, default);
97+
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
98+
// return StatusCode(400);
99+
string exampleJson = null;
100+
exampleJson = "[ {\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\n}, {\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\n} ]";
101+
exampleJson = "<Pet>\n <id>123456789</id>\n <Category>\n <id>123456789</id>\n <name>aeiou</name>\n </Category>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n <Tag>\n <id>123456789</id>\n <name>aeiou</name>\n </Tag>\n </tags>\n <status>aeiou</status>\n</Pet>";
102+
103+
var example = exampleJson != null
104+
? JsonConvert.DeserializeObject<List<Pet>>(exampleJson)
105+
: default;
106+
//TODO: Change the data returned
107+
return new ObjectResult(example);
108+
}
70109

71110
/// <summary>
72111
/// Finds Pets by tags
@@ -81,7 +120,23 @@ public abstract class PetApiController : ControllerBase
81120
[SwaggerOperation("FindPetsByTags")]
82121
[SwaggerResponse(statusCode: 200, type: typeof(List<Pet>), description: "successful operation")]
83122
[Obsolete]
84-
public abstract IActionResult FindPetsByTags([FromQuery (Name = "tags")][Required()]List<string> tags);
123+
public virtual IActionResult FindPetsByTags([FromQuery (Name = "tags")][Required()]List<string> tags)
124+
{
125+
126+
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
127+
// return StatusCode(200, default);
128+
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
129+
// return StatusCode(400);
130+
string exampleJson = null;
131+
exampleJson = "[ {\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\n}, {\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\n} ]";
132+
exampleJson = "<Pet>\n <id>123456789</id>\n <Category>\n <id>123456789</id>\n <name>aeiou</name>\n </Category>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n <Tag>\n <id>123456789</id>\n <name>aeiou</name>\n </Tag>\n </tags>\n <status>aeiou</status>\n</Pet>";
133+
134+
var example = exampleJson != null
135+
? JsonConvert.DeserializeObject<List<Pet>>(exampleJson)
136+
: default;
137+
//TODO: Change the data returned
138+
return new ObjectResult(example);
139+
}
85140

86141
/// <summary>
87142
/// Find pet by ID
@@ -97,7 +152,25 @@ public abstract class PetApiController : ControllerBase
97152
[ValidateModelState]
98153
[SwaggerOperation("GetPetById")]
99154
[SwaggerResponse(statusCode: 200, type: typeof(Pet), description: "successful operation")]
100-
public abstract IActionResult GetPetById([FromRoute (Name = "petId")][Required]long petId);
155+
public virtual IActionResult GetPetById([FromRoute (Name = "petId")][Required]long petId)
156+
{
157+
158+
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
159+
// return StatusCode(200, default);
160+
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
161+
// return StatusCode(400);
162+
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
163+
// return StatusCode(404);
164+
string exampleJson = null;
165+
exampleJson = "{\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\n}";
166+
exampleJson = "<Pet>\n <id>123456789</id>\n <Category>\n <id>123456789</id>\n <name>aeiou</name>\n </Category>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n <Tag>\n <id>123456789</id>\n <name>aeiou</name>\n </Tag>\n </tags>\n <status>aeiou</status>\n</Pet>";
167+
168+
var example = exampleJson != null
169+
? JsonConvert.DeserializeObject<Pet>(exampleJson)
170+
: default;
171+
//TODO: Change the data returned
172+
return new ObjectResult(example);
173+
}
101174

102175
/// <summary>
103176
/// Update an existing pet
@@ -113,7 +186,27 @@ public abstract class PetApiController : ControllerBase
113186
[ValidateModelState]
114187
[SwaggerOperation("UpdatePet")]
115188
[SwaggerResponse(statusCode: 200, type: typeof(Pet), description: "successful operation")]
116-
public abstract IActionResult UpdatePet([FromBody]Pet pet);
189+
public virtual IActionResult UpdatePet([FromBody]Pet pet)
190+
{
191+
192+
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
193+
// return StatusCode(200, default);
194+
//TODO: Uncomment the next line to return response 400 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
195+
// return StatusCode(400);
196+
//TODO: Uncomment the next line to return response 404 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
197+
// return StatusCode(404);
198+
//TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
199+
// return StatusCode(405);
200+
string exampleJson = null;
201+
exampleJson = "{\r\n \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ],\r\n \"name\" : \"doggie\",\r\n \"id\" : 0,\r\n \"category\" : {\r\n \"name\" : \"name\",\r\n \"id\" : 6\r\n },\r\n \"tags\" : [ {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n }, {\r\n \"name\" : \"name\",\r\n \"id\" : 1\r\n } ],\r\n \"status\" : \"available\"\r\n}";
202+
exampleJson = "<Pet>\n <id>123456789</id>\n <name>doggie</name>\n <photoUrls>\n <photoUrls>aeiou</photoUrls>\n </photoUrls>\n <tags>\n </tags>\n <status>aeiou</status>\n</Pet>";
203+
204+
var example = exampleJson != null
205+
? JsonConvert.DeserializeObject<Pet>(exampleJson)
206+
: default;
207+
//TODO: Change the data returned
208+
return new ObjectResult(example);
209+
}
117210

118211
/// <summary>
119212
/// Updates a pet in the store with form data
@@ -127,7 +220,14 @@ public abstract class PetApiController : ControllerBase
127220
[Consumes("application/x-www-form-urlencoded")]
128221
[ValidateModelState]
129222
[SwaggerOperation("UpdatePetWithForm")]
130-
public abstract IActionResult UpdatePetWithForm([FromRoute (Name = "petId")][Required]long petId, [FromForm (Name = "name")]string name, [FromForm (Name = "status")]string status);
223+
public virtual IActionResult UpdatePetWithForm([FromRoute (Name = "petId")][Required]long petId, [FromForm (Name = "name")]string name, [FromForm (Name = "status")]string status)
224+
{
225+
226+
//TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
227+
// return StatusCode(405);
228+
229+
throw new NotImplementedException();
230+
}
131231

132232
/// <summary>
133233
/// uploads an image
@@ -142,6 +242,19 @@ public abstract class PetApiController : ControllerBase
142242
[ValidateModelState]
143243
[SwaggerOperation("UploadFile")]
144244
[SwaggerResponse(statusCode: 200, type: typeof(ApiResponse), description: "successful operation")]
145-
public abstract IActionResult UploadFile([FromRoute (Name = "petId")][Required]long petId, [FromForm (Name = "additionalMetadata")]string additionalMetadata, IFormFile file);
245+
public virtual IActionResult UploadFile([FromRoute (Name = "petId")][Required]long petId, [FromForm (Name = "additionalMetadata")]string additionalMetadata, IFormFile file)
246+
{
247+
248+
//TODO: Uncomment the next line to return response 200 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
249+
// return StatusCode(200, default);
250+
string exampleJson = null;
251+
exampleJson = "{\r\n \"code\" : 0,\r\n \"type\" : \"type\",\r\n \"message\" : \"message\"\r\n}";
252+
253+
var example = exampleJson != null
254+
? JsonConvert.DeserializeObject<ApiResponse>(exampleJson)
255+
: default;
256+
//TODO: Change the data returned
257+
return new ObjectResult(example);
258+
}
146259
}
147260
}

0 commit comments

Comments
 (0)