Skip to content

Commit d79beef

Browse files
committed
Mark all properties as virtual to be overriden in the proxy class
1 parent 883aba1 commit d79beef

File tree

1 file changed

+55
-55
lines changed

1 file changed

+55
-55
lines changed

src/Microsoft.OpenApi/Models/OpenApiSchema.cs

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -19,136 +19,136 @@ public class OpenApiSchema : IOpenApiExtensible, IOpenApiReferenceable, IOpenApi
1919
/// <summary>
2020
/// Follow JSON Schema definition. Short text providing information about the data.
2121
/// </summary>
22-
public string Title { get; set; }
22+
public virtual string Title { get; set; }
2323

2424
/// <summary>
2525
/// $schema, a JSON Schema dialect identifier. Value must be a URI
2626
/// </summary>
27-
public string Schema { get; set; }
27+
public virtual string Schema { get; set; }
2828

2929
/// <summary>
3030
/// $id - Identifies a schema resource with its canonical URI.
3131
/// </summary>
32-
public string Id { get; set; }
32+
public virtual string Id { get; set; }
3333

3434
/// <summary>
3535
/// $comment - reserves a location for comments from schema authors to readers or maintainers of the schema.
3636
/// </summary>
37-
public string Comment { get; set; }
37+
public virtual string Comment { get; set; }
3838

3939
/// <summary>
4040
/// $vocabulary- used in meta-schemas to identify the vocabularies available for use in schemas described by that meta-schema.
4141
/// </summary>
42-
public string Vocabulary { get; set; }
42+
public virtual string Vocabulary { get; set; }
4343

4444
/// <summary>
4545
/// $dynamicRef - an applicator that allows for deferring the full resolution until runtime, at which point it is resolved each time it is encountered while evaluating an instance
4646
/// </summary>
47-
public string DynamicRef { get; set; }
47+
public virtual string DynamicRef { get; set; }
4848

4949
/// <summary>
5050
/// $dynamicAnchor - used to create plain name fragments that are not tied to any particular structural location for referencing purposes, which are taken into consideration for dynamic referencing.
5151
/// </summary>
52-
public string DynamicAnchor { get; set; }
52+
public virtual string DynamicAnchor { get; set; }
5353

5454
/// <summary>
5555
/// $recursiveAnchor - used to construct recursive schemas i.e one that has a reference to its own root, identified by the empty fragment URI reference ("#")
5656
/// </summary>
57-
public string RecursiveAnchor { get; set; }
57+
public virtual string RecursiveAnchor { get; set; }
5858

5959
/// <summary>
6060
/// $recursiveRef - used to construct recursive schemas i.e one that has a reference to its own root, identified by the empty fragment URI reference ("#")
6161
/// </summary>
62-
public string RecursiveRef { get; set; }
62+
public virtual string RecursiveRef { get; set; }
6363

6464
/// <summary>
6565
/// $defs - reserves a location for schema authors to inline re-usable JSON Schemas into a more general schema.
6666
/// The keyword does not directly affect the validation result
6767
/// </summary>
68-
public IDictionary<string, OpenApiSchema> Definitions { get; set; }
68+
public virtual IDictionary<string, OpenApiSchema> Definitions { get; set; }
6969

7070
/// <summary>
7171
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
7272
/// </summary>
73-
public decimal? V31ExclusiveMaximum { get; set; }
73+
public virtual decimal? V31ExclusiveMaximum { get; set; }
7474

7575
/// <summary>
7676
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
7777
/// </summary>
78-
public decimal? V31ExclusiveMinimum { get; set; }
78+
public virtual decimal? V31ExclusiveMinimum { get; set; }
7979

8080
/// <summary>
8181
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
8282
/// </summary>
83-
public bool UnEvaluatedProperties { get; set; }
83+
public virtual bool UnEvaluatedProperties { get; set; }
8484

8585
/// <summary>
8686
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
8787
/// Value MUST be a string in V2 and V3.
8888
/// </summary>
89-
public object Type { get; set; }
89+
public virtual object Type { get; set; }
9090

9191
/// <summary>
9292
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
9393
/// While relying on JSON Schema's defined formats,
9494
/// the OAS offers a few additional predefined formats.
9595
/// </summary>
96-
public string Format { get; set; }
96+
public virtual string Format { get; set; }
9797

9898
/// <summary>
9999
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
100100
/// CommonMark syntax MAY be used for rich text representation.
101101
/// </summary>
102-
public string Description { get; set; }
102+
public virtual string Description { get; set; }
103103

104104
/// <summary>
105105
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
106106
/// </summary>
107-
public decimal? Maximum { get; set; }
107+
public virtual decimal? Maximum { get; set; }
108108

109109
/// <summary>
110110
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
111111
/// </summary>
112-
public bool? ExclusiveMaximum { get; set; }
112+
public virtual bool? ExclusiveMaximum { get; set; }
113113

114114
/// <summary>
115115
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
116116
/// </summary>
117-
public decimal? Minimum { get; set; }
117+
public virtual decimal? Minimum { get; set; }
118118

119119
/// <summary>
120120
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
121121
/// </summary>
122-
public bool? ExclusiveMinimum { get; set; }
122+
public virtual bool? ExclusiveMinimum { get; set; }
123123

124124
/// <summary>
125125
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
126126
/// </summary>
127-
public int? MaxLength { get; set; }
127+
public virtual int? MaxLength { get; set; }
128128

129129
/// <summary>
130130
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
131131
/// </summary>
132-
public int? MinLength { get; set; }
132+
public virtual int? MinLength { get; set; }
133133

134134
/// <summary>
135135
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
136136
/// This string SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect
137137
/// </summary>
138-
public string Pattern { get; set; }
138+
public virtual string Pattern { get; set; }
139139

140140
/// <summary>
141141
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
142142
/// </summary>
143-
public decimal? MultipleOf { get; set; }
143+
public virtual decimal? MultipleOf { get; set; }
144144

145145
/// <summary>
146146
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
147147
/// The default value represents what would be assumed by the consumer of the input as the value of the schema if one is not provided.
148148
/// Unlike JSON Schema, the value MUST conform to the defined type for the Schema Object defined at the same level.
149149
/// For example, if type is string, then default can be "foo" but cannot be 1.
150150
/// </summary>
151-
public OpenApiAny Default { get; set; }
151+
public virtual OpenApiAny Default { get; set; }
152152

153153
/// <summary>
154154
/// Relevant only for Schema "properties" definitions. Declares the property as "read only".
@@ -158,7 +158,7 @@ public class OpenApiSchema : IOpenApiExtensible, IOpenApiReferenceable, IOpenApi
158158
/// A property MUST NOT be marked as both readOnly and writeOnly being true.
159159
/// Default value is false.
160160
/// </summary>
161-
public bool ReadOnly { get; set; }
161+
public virtual bool ReadOnly { get; set; }
162162

163163
/// <summary>
164164
/// Relevant only for Schema "properties" definitions. Declares the property as "write only".
@@ -168,64 +168,64 @@ public class OpenApiSchema : IOpenApiExtensible, IOpenApiReferenceable, IOpenApi
168168
/// A property MUST NOT be marked as both readOnly and writeOnly being true.
169169
/// Default value is false.
170170
/// </summary>
171-
public bool WriteOnly { get; set; }
171+
public virtual bool WriteOnly { get; set; }
172172

173173
/// <summary>
174174
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
175175
/// Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
176176
/// </summary>
177-
public IList<OpenApiSchema> AllOf { get; set; } = new List<OpenApiSchema>();
177+
public virtual IList<OpenApiSchema> AllOf { get; set; } = new List<OpenApiSchema>();
178178

179179
/// <summary>
180180
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
181181
/// Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
182182
/// </summary>
183-
public IList<OpenApiSchema> OneOf { get; set; } = new List<OpenApiSchema>();
183+
public virtual IList<OpenApiSchema> OneOf { get; set; } = new List<OpenApiSchema>();
184184

185185
/// <summary>
186186
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
187187
/// Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
188188
/// </summary>
189-
public IList<OpenApiSchema> AnyOf { get; set; } = new List<OpenApiSchema>();
189+
public virtual IList<OpenApiSchema> AnyOf { get; set; } = new List<OpenApiSchema>();
190190

191191
/// <summary>
192192
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
193193
/// Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
194194
/// </summary>
195-
public OpenApiSchema Not { get; set; }
195+
public virtual OpenApiSchema Not { get; set; }
196196

197197
/// <summary>
198198
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
199199
/// </summary>
200-
public ISet<string> Required { get; set; } = new HashSet<string>();
200+
public virtual ISet<string> Required { get; set; } = new HashSet<string>();
201201

202202
/// <summary>
203203
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
204204
/// Value MUST be an object and not an array. Inline or referenced schema MUST be of a Schema Object
205205
/// and not a standard JSON Schema. items MUST be present if the type is array.
206206
/// </summary>
207-
public OpenApiSchema Items { get; set; }
207+
public virtual OpenApiSchema Items { get; set; }
208208

209209
/// <summary>
210210
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
211211
/// </summary>
212-
public int? MaxItems { get; set; }
212+
public virtual int? MaxItems { get; set; }
213213

214214
/// <summary>
215215
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
216216
/// </summary>
217-
public int? MinItems { get; set; }
217+
public virtual int? MinItems { get; set; }
218218

219219
/// <summary>
220220
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
221221
/// </summary>
222-
public bool? UniqueItems { get; set; }
222+
public virtual bool? UniqueItems { get; set; }
223223

224224
/// <summary>
225225
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
226226
/// Property definitions MUST be a Schema Object and not a standard JSON Schema (inline or referenced).
227227
/// </summary>
228-
public IDictionary<string, OpenApiSchema> Properties { get; set; } = new Dictionary<string, OpenApiSchema>();
228+
public virtual IDictionary<string, OpenApiSchema> Properties { get; set; } = new Dictionary<string, OpenApiSchema>();
229229

230230
/// <summary>
231231
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
@@ -234,96 +234,96 @@ public class OpenApiSchema : IOpenApiExtensible, IOpenApiReferenceable, IOpenApi
234234
/// egular expression dialect. Each property value of this object MUST be an object, and each object MUST
235235
/// be a valid Schema Object not a standard JSON Schema.
236236
/// </summary>
237-
public IDictionary<string, OpenApiSchema> PatternProperties { get; set; } = new Dictionary<string, OpenApiSchema>();
237+
public virtual IDictionary<string, OpenApiSchema> PatternProperties { get; set; } = new Dictionary<string, OpenApiSchema>();
238238

239239
/// <summary>
240240
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
241241
/// </summary>
242-
public int? MaxProperties { get; set; }
242+
public virtual int? MaxProperties { get; set; }
243243

244244
/// <summary>
245245
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
246246
/// </summary>
247-
public int? MinProperties { get; set; }
247+
public virtual int? MinProperties { get; set; }
248248

249249
/// <summary>
250250
/// Indicates if the schema can contain properties other than those defined by the properties map.
251251
/// </summary>
252-
public bool AdditionalPropertiesAllowed { get; set; } = true;
252+
public virtual bool AdditionalPropertiesAllowed { get; set; } = true;
253253

254254
/// <summary>
255255
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
256256
/// Value can be boolean or object. Inline or referenced schema
257257
/// MUST be of a Schema Object and not a standard JSON Schema.
258258
/// </summary>
259-
public OpenApiSchema AdditionalProperties { get; set; }
259+
public virtual OpenApiSchema AdditionalProperties { get; set; }
260260

261261
/// <summary>
262262
/// Adds support for polymorphism. The discriminator is an object name that is used to differentiate
263263
/// between other schemas which may satisfy the payload description.
264264
/// </summary>
265-
public OpenApiDiscriminator Discriminator { get; set; }
265+
public virtual OpenApiDiscriminator Discriminator { get; set; }
266266

267267
/// <summary>
268268
/// A free-form property to include an example of an instance for this schema.
269269
/// To represent examples that cannot be naturally represented in JSON or YAML,
270270
/// a string value can be used to contain the example with escaping where necessary.
271271
/// </summary>
272-
public OpenApiAny Example { get; set; }
272+
public virtual OpenApiAny Example { get; set; }
273273

274274
/// <summary>
275275
/// A free-form property to include examples of an instance for this schema.
276276
/// To represent examples that cannot be naturally represented in JSON or YAML,
277277
/// a list of values can be used to contain the examples with escaping where necessary.
278278
/// </summary>
279-
public IList<JsonNode> Examples { get; set; }
279+
public virtual IList<JsonNode> Examples { get; set; }
280280

281281
/// <summary>
282282
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
283283
/// </summary>
284-
public IList<JsonNode> Enum { get; set; } = new List<JsonNode>();
284+
public virtual IList<JsonNode> Enum { get; set; } = new List<JsonNode>();
285285

286286
/// <summary>
287287
/// Allows sending a null value for the defined schema. Default value is false.
288288
/// </summary>
289-
public bool Nullable { get; set; }
289+
public virtual bool Nullable { get; set; }
290290

291291
/// <summary>
292292
/// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
293293
/// </summary>
294-
public bool UnevaluatedProperties { get; set;}
294+
public virtual bool UnevaluatedProperties { get; set;}
295295

296296
/// <summary>
297297
/// Additional external documentation for this schema.
298298
/// </summary>
299-
public OpenApiExternalDocs ExternalDocs { get; set; }
299+
public virtual OpenApiExternalDocs ExternalDocs { get; set; }
300300

301301
/// <summary>
302302
/// Specifies that a schema is deprecated and SHOULD be transitioned out of usage.
303303
/// Default value is false.
304304
/// </summary>
305-
public bool Deprecated { get; set; }
305+
public virtual bool Deprecated { get; set; }
306306

307307
/// <summary>
308308
/// This MAY be used only on properties schemas. It has no effect on root schemas.
309309
/// Adds additional metadata to describe the XML representation of this property.
310310
/// </summary>
311-
public OpenApiXml Xml { get; set; }
311+
public virtual OpenApiXml Xml { get; set; }
312312

313313
/// <summary>
314314
/// This object MAY be extended with Specification Extensions.
315315
/// </summary>
316-
public IDictionary<string, IOpenApiExtension> Extensions { get; set; } = new Dictionary<string, IOpenApiExtension>();
316+
public virtual IDictionary<string, IOpenApiExtension> Extensions { get; set; } = new Dictionary<string, IOpenApiExtension>();
317317

318318
/// <summary>
319319
/// Indicates object is a placeholder reference to an actual object and does not contain valid data.
320320
/// </summary>
321-
public bool UnresolvedReference { get; set; }
321+
public virtual bool UnresolvedReference { get; set; }
322322

323323
/// <summary>
324324
/// Reference object.
325325
/// </summary>
326-
public OpenApiReference Reference { get; set; }
326+
public virtual OpenApiReference Reference { get; set; }
327327

328328
/// <summary>
329329
/// Parameterless constructor
@@ -586,7 +586,7 @@ public void SerializeAsV2WithoutReference(IOpenApiWriter writer)
586586

587587
/// <inheritdoc/>
588588

589-
public void SerializeAsV2(IOpenApiWriter writer)
589+
public virtual void SerializeAsV2(IOpenApiWriter writer)
590590
{
591591
SerializeAsV2(writer: writer, parentRequiredProperties: new HashSet<string>(), propertyName: null);
592592
}

0 commit comments

Comments
 (0)