src/Microsoft.OpenApi.OData.Reader/EdmModelOpenApiExtensions.cs
/// <summary>
/// Convert <see cref="IEdmModel"/> to <see cref="OpenApiDocument"/> using a convert settings.
/// </summary>
/// <param name="model">The Edm model.</param>
/// <param name="settings">The convert settings.</param>
/// <returns>The converted Open API document object, <see cref="OpenApiDocument"/>.</returns>
Convert  to  using a convert settings.
Convert to using a convert settings .
public static OpenApiDocument ConvertToOpenApi(this IEdmModel model, OpenApiConvertSettings settings)
        {
            Utils.CheckArgumentNull(model, nameof(model));
            Utils.CheckArgumentNull(settings, nameof(settings));
            if (settings.VerifyEdmModel)
            {
                IEnumerable<EdmError> errors;
                if (!model.Validate(out errors))
                {
                    OpenApiDocument document = new OpenApiDocument();
                    int index = 1;
                    foreach (var error in errors)
                    {
                        document.Extensions.Add(Constants.xMsEdmModelError + index++, new OpenApiString(error.ToString()));
                    }
                    return document;
                }
            }
            ODataContext context = new ODataContext(model, settings);
            return context.CreateDocument();
        }
public static OpenApiDocument ConvertToOpenApi ( this IEdmModel model , OpenApiConvertSettings settings ) { Utils . CheckArgumentNull ( model , nameof ( model ) ) ; Utils . CheckArgumentNull ( settings , nameof ( settings ) ) ; if ( settings . VerifyEdmModel ) { IEnumerable < EdmError > errors ; if ( ! model . Validate ( out errors ) ) { OpenApiDocument document = new OpenApiDocument ( ) ; int index = 1 ; foreach ( var error in errors ) { document . Extensions . Add ( Constants . xMsEdmModelError + index ++ , new OpenApiString ( error . ToString ( ) ) ) ; } return document ; } } ODataContext context = new ODataContext ( model , settings ) ; return context . CreateDocument ( ) ; }
Convert  to  using a convert settings.
Convert to using a convert settings .
The converted Open API document object, .
The converted Open API document object .
IEdmModel
this
settings
OpenApiConvertSettings
The convert settings.
The convert settings .
model
The Edm model.
The Edm model .