11// Copyright (c) Microsoft Corporation. All rights reserved.
22// Licensed under the MIT license.
33
4+ using System ;
5+ using System . ComponentModel ;
46using System . IO ;
57
68namespace Microsoft . OpenApi
@@ -14,7 +16,17 @@ public class OpenApiJsonWriter : OpenApiWriterBase
1416 /// Initializes a new instance of the <see cref="OpenApiJsonWriter"/> class.
1517 /// </summary>
1618 /// <param name="textWriter">The text writer.</param>
17- public OpenApiJsonWriter ( TextWriter textWriter ) : base ( textWriter , null )
19+ public OpenApiJsonWriter ( TextWriter textWriter ) : this ( textWriter , ( OpenApiWriterSettings ? ) null )
20+ {
21+ // this constructor is kept for binary compatibility
22+ // TODO remove in next major version and make the settings an optional parameter in the other constructor
23+ }
24+ /// <summary>
25+ /// Initializes a new instance of the <see cref="OpenApiJsonWriter"/> class.
26+ /// </summary>
27+ /// <param name="settings">Settings for controlling how the OpenAPI document will be written out.</param>
28+ /// <param name="textWriter">The text writer.</param>
29+ public OpenApiJsonWriter ( TextWriter textWriter , OpenApiWriterSettings ? settings ) : base ( textWriter , settings ?? new OpenApiJsonWriterSettings ( ) )
1830 {
1931 }
2032
@@ -34,9 +46,13 @@ public OpenApiJsonWriter(TextWriter textWriter, OpenApiJsonWriterSettings settin
3446 /// <param name="textWriter">The text writer.</param>
3547 /// <param name="settings">Settings for controlling how the OpenAPI document will be written out.</param>
3648 /// <param name="terseOutput"> Setting for allowing the JSON emitted to be in terse format.</param>
37- public OpenApiJsonWriter ( TextWriter textWriter , OpenApiWriterSettings ? settings , bool terseOutput = false ) : base ( textWriter , settings )
49+ [ Obsolete ( "Use OpenApiJsonWriter(TextWriter textWriter, OpenApiJsonWriterSettings settings) instead." ) ]
50+ [ EditorBrowsable ( EditorBrowsableState . Never ) ]
51+ public OpenApiJsonWriter ( TextWriter textWriter , OpenApiWriterSettings ? settings , bool terseOutput ) : base ( textWriter , settings )
3852 {
3953 _produceTerseOutput = terseOutput ;
54+ // this constructor is kept for binary compatibility, terse information should be read from the settings to avoid fork APIs.
55+ // TODO remove in next major version
4056 }
4157
4258 /// <summary>
0 commit comments