Jim Schubert 60ceded171
[ci][cli] Moving ensures script to config-based batch generation of samples (#6509)
* Ensure CLI-level generator settings are available in additional properties

* Initial conversion to yaml configs

Configs prefix with 1- need to be manually evaluated.

* Add "other" configs not in ensure-up-to-date

* Add other/openapi3 files

* Cleanup all generation scripts

* Clean up: add missed configs and fix some openapi 3 diffs

* Move generate-samples script, error on batch failures

* Temporarily disable elm which requires skip validation of spec

* CI updates (todo: run all generators through appveyor or move to github workflows)

* Add success count to batch generation command output

* [samples] Regenerate

* Remove bin/windows

* Generate swift5 samples in bitrise

* Expand user input glob pattern

* Regenerate samples

* Update PR template

* Support config based generateAliasAsModel

* [samples] Regenerate

* [rust] Generate as alias for all samples configs

* [csharp] Move test staged file changes to in-directory

* Include "live" test files and ignore test cache files from samples.ci

* Remove concept of samples.ci staging

Generators support .openapi-generator-ignore, allowing maintainers to
explicitly ignore the regeneration of files which have been modified.

Note that the tooling does not overwrite test files whenever those files
exist, and it's not entirely necessary to add test files to the ignore
file.

* Re-add meta generator scripts

* Modify ensure-up-to-date to log stdout, so script does not look like it hangs on slower machines

* [csharp] Regenerate sample

* Set generateAliasAsModel CodegenConfigurator#toContext

This ensures the property (which is effectively a thread-local) gets set
as expected if the caller resets GlobalSettings as is done in the
GenerateBatch command.

* [rust] Regenerate samples

* Re-enable elm

* [java] Support OffsetDateTime example, fail ensures script on any generation error

* [samples] Regenerate

* Fix jersey2-java8 ignore file

* Fix elm spec validation

* Force UTC in sample generation to avoid timezone conflicts during generation (user vs ci)

Co-authored-by: William Cheng <wing328hk@gmail.com>
2020-06-09 18:28:58 +08:00
..
2018-05-02 00:48:55 +08:00
2018-05-02 00:48:55 +08:00
2020-04-10 15:08:34 +08:00
2020-04-10 15:08:34 +08:00

Org.OpenAPITools - the C# library for the 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: " \

This C# SDK is automatically generated by the OpenAPI Generator project:

  • API version: 1.0.0
  • SDK version: 1.0.0
  • Build package: org.openapitools.codegen.languages.CSharpClientCodegen

Frameworks supported

  • .NET 4.0 or later
  • Windows Phone 7.1 (Mango)

Dependencies

The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742

Installation

Run the following command to generate the DLL

  • [Mac/Linux] /bin/sh build.sh
  • [Windows] build.bat

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

Packaging

A .nuspec is included with the project. You can follow the Nuget quickstart to create and publish packages.

This .nuspec uses placeholders from the .csproj, so build the .csproj directly:

nuget pack -Build -OutputDirectory out Org.OpenAPITools.csproj

Then, publish to a local feed or other host and consume the new package via Nuget as usual.

Getting Started

using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class Example
    {
        public static void Main()
        {

            Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2";
            var apiInstance = new AnotherFakeApi(Configuration.Default);
            var body = new ModelClient(); // ModelClient | client model

            try
            {
                // To test special tags
                ModelClient result = apiInstance.Call123TestSpecialTags(body);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }

        }
    }
}

Documentation for API Endpoints

All URIs are relative to http://petstore.swagger.io:80/v2

Class Method HTTP request Description
AnotherFakeApi Call123TestSpecialTags PATCH /another-fake/dummy To test special tags
FakeApi CreateXmlItem POST /fake/create_xml_item creates an XmlItem
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 TestBodyWithFileSchema PUT /fake/body-with-file-schema
FakeApi TestBodyWithQueryParams PUT /fake/body-with-query-params
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 TestGroupParameters DELETE /fake Fake endpoint to test group parameters (optional)
FakeApi TestInlineAdditionalProperties POST /fake/inline-additionalProperties test inline additionalProperties
FakeApi TestJsonFormData GET /fake/jsonFormData test json serialization of form data
FakeApi TestQueryParameterCollectionFormat PUT /fake/test-query-paramters
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
PetApi UploadFileWithRequiredFile POST /fake/{petId}/uploadImageWithRequiredFile uploads an image (required)
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

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