openapiclientgen

Generate strongly typed C# and TypeScript client codes from Open API / Swagger definitions supporting jQuery, Angular, AXIOS, Fetch API, Aurelia and Angular Strictly Typed Forms

MIT License

Stars
68
Committers
5

Bot releases are visible (Hide)

openapiclientgen - Settings: CancellationTokenEnabled, UsePascalCase, PrefixWithTypeName

Published by zijianhuang over 2 years ago

New settings:

  1. CancellationTokenEnabled for C# codes.
  2. UsePascalCase, PrefixWithTypeName implemented by codertimu.
openapiclientgen - Doc comment for required along with RequiredAttribute

Published by zijianhuang over 2 years ago

openapiclientgen - Date type to DateOnly

Published by zijianhuang over 2 years ago

Map Date to DateOnly of .NET 6. Please also refer to https://www.codeproject.com/Articles/5325820/DateOnly-in-NET-6-and-ASP-NET-Core-6

openapiclientgen - ArrayAsIEnumerableDerived

Published by zijianhuang over 3 years ago

	public enum ArrayAsIEnumerableDerived
	{
		Array,

		IEnumerable,
		IList,
		ICollection,
		IReadOnlyList,
		IReadOnlyCollection,

		List,
		Collection,
		ReadOnlyCollection,
	}

based on https://github.com/zijianhuang/openapiclientgen/pull/33

openapiclientgen - More settings

Published by zijianhuang over 3 years ago

Mostly based on PR by Kim-SSi, introducing extended features for various contexts of application developments.

/// <summary>
/// Generated data types will be decorated with JsonProperty with the PropertyName in C#.
/// </summary>
public bool DecorateDataModelWithPropertyName { get; set; }

/// <summary>
/// OpenApClinetGent declares all value type properties including enum properties as nullable by default in generated C#, and all properties as nullable by default in generated TypeScript codes, unless the property is required. 
/// This is to prevent serializer from creating payload for properties not assigned.  
/// There might be situations in which you don't want such default features and want the codegen to respect OpenApi v3 option nullable. Then turn this setting to true, which affects generated C# codes only.
/// Please note, Some Open API definition files do not define nullable for some premitive types and enum, however, the respective backends do not expect some properties presented in the payload of the request.
/// therefore you need to build some integration test suites to find out what the backend would like.
/// If the YAML file defines a reference type property as nullable, the codegen ignores this setting since in C# a nullable reference type property is invalid.
/// </summary>
public bool DisableSystemNullableByDefault { get; set; }

/// <summary>
/// Use T? instead of System.Nullable<T> for value types, while by default System.Nullable<T> is used. C# 2.0 feature
/// </summary>
public bool UseNullableQuestionMark { get; set; }

/// <summary>
/// Use T? for reference types. C# 8.0 feature: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/nullable-reference-types
/// https://docs.microsoft.com/en-us/dotnet/csharp/nullable-migration-strategies: The global nullable context does not apply for generated code files.
/// Therefore it is up to you application programmers to make the compiler recognize the generated file is not generated.
/// Check test case: Test_vimeo()
/// </summary>
public bool UseNullableReferenceType { get; set; }

/// <summary>
/// Create the Model classes only
/// </summary>
public bool GenerateModelsOnly { get; set; }

/// <summary>
/// By default, array type will be array in generated C#. You may generated IEnumerable and some of its derived types.
/// </summary>
public ArrayAsIEnumerableDerived ArrayAs { get; set; }

If the generated codes is based on setting EnumToString, the serialization supports both [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] and [JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]. And WebApiClientGen v5.2 supports theses converters, thus this is handy if generated codes by OpenApiclientGen is used in a service broker on .NET or .NET Framework, and you generate client API codes using WebApiClientGen.

openapiclientgen - Enum property is optional/nullable if not required

Published by zijianhuang over 3 years ago

in C#. Generated TypeScript codes had been that way since day 1.

openapiclientgen - Settings.EnumToString

Published by zijianhuang over 3 years ago

openapiclientgen - For .NET 5 and introduced IncludeEnsureSuccessStatusCodeExBlock

Published by zijianhuang over 3 years ago

openapiclientgen - OpenApiClientGen for C#, Angular, AXIOS, Fetch API, jQuery and Aurelia

Published by zijianhuang about 4 years ago

minor bug fixes in DataContractAttribute namespace

openapiclientgen - OpenApiClientGen for C#, Angular, AXIOS, Fetch API, jQuery and Aurelia

Published by zijianhuang about 4 years ago

  • Minor bug fixes
openapiclientgen - v1.6.1 tested with over 1000 Open API definitions

Published by zijianhuang over 4 years ago

  • Support AdditionalProperties for Dictionary
  • Adjusted function names based on path, query and parameters.
  • Bug fixes
openapiclientgen - v1.6 tested with over 1000 Open API definitions

Published by zijianhuang over 4 years ago

  • Support AdditionalProperties for Dictionary
  • Adjusted function names based on path, query and parameters.
  • Bug fixes
openapiclientgen - v1.5 tested with over 900 Open API definitions

Published by zijianhuang over 4 years ago

Plugins cover Angular 5+, Aurelia, AXIOS, Fetch API and jQuery.

openapiclientgen - OpenApiClientGen with 5 Plugins

Published by zijianhuang over 4 years ago

Plugins cover Angular, Aurelia, AXIOS, Fetch API and jQuery.

openapiclientgen - OpenApiClientGen initial release

Published by zijianhuang over 4 years ago

  1. Generate C# client APIs based on a definition file of Swagger / Open API Specification 2.0/3.0.
  2. Generate Angular TypeScript client APIs with plugin OpenApiClientGen.NG2.

You may checkout the latest release tag and build for yourself.