forked from loafle/openapi-generator-original
* [csharp] Support composition on toJson Previous implementation assumed specification only supports polymorphic associations (via discrimator), although the code didn't seem to be setup correctly for that in the first place. That is, the parent object must define the discriminator (see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#models-with-polymorphism-support), so NOT HAS parent AND HAS discriminator doesn't make sense. From a C# perspective, base classes should have the method marked virtual and derived classes should override the method. This supports both composition and polymorphic definitions. * [csharp] this.Configuration in api template Unprefixed Configuration property access leads to ambiguous references when spec defines a Configuration model. * [csharp] Models/properties support nested arrays Previous implementation didn't support multiple levels of array with array items as OpenAPI spec supports. This means an object defined as type: array with items = type: array|items=double (which is common in GIS) would not be possible. This implementation assumes generics in the nested type definitions, so the above would generate List<List<double?>> for model parent types as well as property type declarations. * [csharp] Regenerate integration test sample * [csharp] Set "Client" case sensitive as reserved * [csharp] Regenerate security sample * [csharp] Regenerate samples
8.0 KiB
8.0 KiB
IO.Swagger - the C# library for the Swagger 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: " \
This C# SDK is automatically generated by the Swagger Codegen project:
- API version: 1.0.0
- SDK version: 1.0.0
- Build package: io.swagger.codegen.languages.CSharpClientCodegen
Frameworks supported
- .NET Core >=1.0
- .NET Framework >=4.6
- Mono/Xamarin >=vNext
- UWP >=10.0
Dependencies
- FubarCoder.RestSharp.Portable.Core >=4.0.7
- FubarCoder.RestSharp.Portable.HttpClient >=4.0.7
- Newtonsoft.Json >=10.0.3
Installation
Generate the DLL using your preferred tool
Then include the DLL (under the bin
folder) in the C# project, and use the namespaces:
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
Getting Started
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class Example
{
public void main()
{
var apiInstance = new AnotherFakeApi();
var body = new ModelClient(); // ModelClient | client model
try
{
// To test special tags
ModelClient result = apiInstance.TestSpecialTags(body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message );
}
}
}
}
Documentation for API Endpoints
All URIs are relative to http://petstore.swagger.io:80/v2
Class | Method | HTTP request | Description |
---|---|---|---|
AnotherFakeApi | TestSpecialTags | PATCH /another-fake/dummy | To test special tags |
FakeApi | FakeOuterBooleanSerialize | POST /fake/outer/boolean | |
FakeApi | FakeOuterCompositeSerialize | POST /fake/outer/composite | |
FakeApi | FakeOuterNumberSerialize | POST /fake/outer/number | |
FakeApi | FakeOuterStringSerialize | POST /fake/outer/string | |
FakeApi | TestClientModel | PATCH /fake | To test "client" model |
FakeApi | TestEndpointParameters | POST /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 |
FakeApi | TestEnumParameters | GET /fake | To test enum parameters |
FakeApi | TestInlineAdditionalProperties | POST /fake/inline-additionalProperties | test inline additionalProperties |
FakeApi | TestJsonFormData | GET /fake/jsonFormData | test json serialization of form data |
FakeClassnameTags123Api | TestClassname | PATCH /fake_classname_test | To test class name in snake case |
PetApi | AddPet | POST /pet | Add a new pet to the store |
PetApi | DeletePet | DELETE /pet/{petId} | Deletes a pet |
PetApi | FindPetsByStatus | GET /pet/findByStatus | Finds Pets by status |
PetApi | FindPetsByTags | GET /pet/findByTags | Finds Pets by tags |
PetApi | GetPetById | GET /pet/{petId} | Find pet by ID |
PetApi | UpdatePet | PUT /pet | Update an existing pet |
PetApi | UpdatePetWithForm | POST /pet/{petId} | Updates a pet in the store with form data |
PetApi | UploadFile | POST /pet/{petId}/uploadImage | uploads an image |
StoreApi | DeleteOrder | DELETE /store/order/{order_id} | Delete purchase order by ID |
StoreApi | GetInventory | GET /store/inventory | Returns pet inventories by status |
StoreApi | GetOrderById | GET /store/order/{order_id} | Find purchase order by ID |
StoreApi | PlaceOrder | POST /store/order | Place an order for a pet |
UserApi | CreateUser | POST /user | Create user |
UserApi | CreateUsersWithArrayInput | POST /user/createWithArray | Creates list of users with given input array |
UserApi | CreateUsersWithListInput | POST /user/createWithList | Creates list of users with given input array |
UserApi | DeleteUser | DELETE /user/{username} | Delete user |
UserApi | GetUserByName | GET /user/{username} | Get user by user name |
UserApi | LoginUser | GET /user/login | Logs user into the system |
UserApi | LogoutUser | GET /user/logout | Logs out current logged in user session |
UserApi | UpdateUser | PUT /user/{username} | Updated user |
Documentation for Models
- Model.AdditionalPropertiesClass
- Model.Animal
- Model.AnimalFarm
- Model.ApiResponse
- Model.ArrayOfArrayOfNumberOnly
- Model.ArrayOfNumberOnly
- Model.ArrayTest
- Model.Capitalization
- Model.Category
- Model.ClassModel
- Model.EnumArrays
- Model.EnumClass
- Model.EnumTest
- Model.FormatTest
- Model.HasOnlyReadOnly
- Model.List
- Model.MapTest
- Model.MixedPropertiesAndAdditionalPropertiesClass
- Model.Model200Response
- Model.ModelClient
- Model.Name
- Model.NumberOnly
- Model.Order
- Model.OuterBoolean
- Model.OuterComposite
- Model.OuterEnum
- Model.OuterNumber
- Model.OuterString
- Model.Pet
- Model.ReadOnlyFirst
- Model.Return
- Model.SpecialModelName
- Model.Tag
- Model.User
- Model.Cat
- Model.Dog
Documentation for Authorization
api_key
- Type: API key
- API key parameter name: api_key
- Location: HTTP header
api_key_query
- Type: API key
- API key parameter name: api_key_query
- Location: URL query string
http_basic_test
- Type: HTTP basic authentication
petstore_auth
- Type: OAuth
- Flow: implicit
- Authorization URL: http://petstore.swagger.io/api/oauth/dialog
- Scopes:
- write:pets: modify pets in your account
- read:pets: read your pets