RESTCLIENT.NET
Menu
EN
↗ GitHub

RESTCLIENT.NET / API REFERENCE

RestClient.Net.OpenApiGenerator.ModelGenerator

All API types · RestClient.Net.OpenApiGenerator · View source

public static class ModelGenerator

Generates C# model classes from OpenAPI schemas.

Members

GenerateModels

public static string GenerateModels(OpenApiDocument document, string @namespace);

Generates C# models from an OpenAPI document.

Parameter Type Default Description
document OpenApiDocument Required The OpenAPI document.
namespace string Required The namespace for the generated models.

Returns: The generated models code.

View source: RestClient.Net.OpenApiGenerator/ModelGenerator.cs:10

MapOpenApiType

public static string MapOpenApiType(IOpenApiSchema? schema, IDictionary<string, IOpenApiSchema>? schemas = null);

Maps an OpenAPI schema to a C# type.

Parameter Type Default Description
schema IOpenApiSchema? Required The OpenAPI schema.
schemas IDictionary<string, IOpenApiSchema>? null Optional schemas dictionary to check for string enums.

Returns: The C# type name.

View source: RestClient.Net.OpenApiGenerator/ModelGenerator.cs:107