Skip to content

Releases: zijianhuang/openapiclientgen

Doc comment for required along with RequiredAttribute

18 Mar 21:39
Compare
Choose a tag to compare
2.1

Doc comment for Required along with RequiredAttribute

Date type to DateOnly

17 Feb 07:48
Compare
Choose a tag to compare

ArrayAsIEnumerableDerived

29 May 10:03
Compare
Choose a tag to compare
	public enum ArrayAsIEnumerableDerived
	{
		Array,

		IEnumerable,
		IList,
		ICollection,
		IReadOnlyList,
		IReadOnlyCollection,

		List,
		Collection,
		ReadOnlyCollection,
	}

based on #33

More settings

12 May 09:35
Compare
Choose a tag to compare

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.

Enum property is optional/nullable if not required

22 Apr 09:45
Compare
Choose a tag to compare

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

Settings.EnumToString

09 Apr 07:00
Compare
Choose a tag to compare
/// <summary>

/// Serialize enum to strng. For C#, effective if DecorateDataModelWithDataContract is true, and the enum type is decorated by [JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]. For TypeScript, the output is string enums.
/// </summary>
public bool EnumToString { get; set; }

For .NET 5 and introduced IncludeEnsureSuccessStatusCodeExBlock

11 Feb 22:36
Compare
Choose a tag to compare

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

16 Sep 21:11
Compare
Choose a tag to compare

minor bug fixes in DataContractAttribute namespace

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

08 Aug 07:02
Compare
Choose a tag to compare

v1.6.1 tested with over 1000 Open API definitions

12 Jul 07:21
Compare
Choose a tag to compare
  • Support AdditionalProperties for Dictionary
  • Adjusted function names based on path, query and parameters.
  • Bug fixes