Table of Contents

Class OpenApiDocumentGenerator

Namespace
NSwag.Generation
Assembly
NSwag.Generation.dll

Provides services to for Swagger generators like the creation of parameters and handling of schemas.

public class OpenApiDocumentGenerator
Inheritance
OpenApiDocumentGenerator
Inherited Members

Constructors

OpenApiDocumentGenerator(OpenApiDocumentGeneratorSettings, JsonSchemaResolver)

Initializes a new instance of the OpenApiDocumentGenerator class.

public OpenApiDocumentGenerator(OpenApiDocumentGeneratorSettings settings, JsonSchemaResolver schemaResolver)

Parameters

settings OpenApiDocumentGeneratorSettings

The settings.

schemaResolver JsonSchemaResolver

The schema resolver.

Properties

SchemaGenerator

Gets or sets the schema generator.

public OpenApiSchemaGenerator SchemaGenerator { get; }

Property Value

OpenApiSchemaGenerator

Methods

CreatePrimitiveParameter(string, ContextualParameterInfo)

Creates a primitive parameter for the given parameter information reflection object.

public OpenApiParameter CreatePrimitiveParameter(string name, ContextualParameterInfo contextualParameter)

Parameters

name string

The name.

contextualParameter ContextualParameterInfo

The parameter.

Returns

OpenApiParameter

The parameter.

CreatePrimitiveParameter(string, string, ContextualType, bool)

Creates a primitive parameter for the given parameter information reflection object.

public OpenApiParameter CreatePrimitiveParameter(string name, string description, ContextualType contextualParameter, bool enforceNotNull = false)

Parameters

name string

The name.

description string

The description.

contextualParameter ContextualType

Type of the parameter.

enforceNotNull bool

Specifies whether the parameter must never be nullable.

Returns

OpenApiParameter

The parameter.

CreateUntypedPathParameter(string, string)

Creates a path parameter for a given type.

public OpenApiParameter CreateUntypedPathParameter(string parameterName, string parameterType)

Parameters

parameterName string

Name of the parameter.

parameterType string

Type of the parameter.

Returns

OpenApiParameter

The parameter.