|
1 | 1 | using System.Collections.Generic;
|
| 2 | +using System.Text.Json.Nodes; |
2 | 3 | using Microsoft.OpenApi.Any;
|
3 | 4 | using Microsoft.OpenApi.Interfaces;
|
4 | 5 |
|
5 | 6 | namespace Microsoft.OpenApi.Models
|
6 | 7 | {
|
7 |
| - internal class OpenApiSchema |
| 8 | + /// <summary> |
| 9 | + /// The Schema Object allows the definition of input and output data types. |
| 10 | + /// </summary> |
| 11 | + public class OpenApiSchema : IOpenApiExtensible |
8 | 12 | {
|
9 | 13 | /// <summary>
|
10 | 14 | /// Follow JSON Schema definition. Short text providing information about the data.
|
11 | 15 | /// </summary>
|
12 | 16 | public string Title { get; set; }
|
13 | 17 |
|
| 18 | + /// <summary> |
| 19 | + /// $schema, a JSON Schema dialect identifier. Value must be a URI |
| 20 | + /// </summary> |
14 | 21 | public string Schema { get; set; }
|
15 | 22 |
|
| 23 | + /// <summary> |
| 24 | + /// $id - Identifies a schema resource with its canonical URI. |
| 25 | + /// </summary> |
16 | 26 | public string Id { get; set; }
|
17 | 27 |
|
| 28 | + /// <summary> |
| 29 | + /// $comment - reserves a location for comments from schema authors to readers or maintainers of the schema. |
| 30 | + /// </summary> |
18 | 31 | public string Comment { get; set; }
|
19 | 32 |
|
| 33 | + /// <summary> |
| 34 | + /// $vocabulary- used in meta-schemas to identify the vocabularies available for use in schemas described by that meta-schema. |
| 35 | + /// </summary> |
20 | 36 | public string Vocabulary { get; set; }
|
21 | 37 |
|
| 38 | + /// <summary> |
| 39 | + /// $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 |
| 40 | + /// </summary> |
22 | 41 | public string DynamicRef { get; set; }
|
23 | 42 |
|
| 43 | + /// <summary> |
| 44 | + /// $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. |
| 45 | + /// </summary> |
24 | 46 | public string DynamicAnchor { get; set; }
|
25 | 47 |
|
| 48 | + /// <summary> |
| 49 | + /// $recursiveAnchor - used to construct recursive schemas i.e one that has a reference to its own root, identified by the empty fragment URI reference ("#") |
| 50 | + /// </summary> |
26 | 51 | public string RecursiveAnchor { get; set; }
|
27 | 52 |
|
| 53 | + /// <summary> |
| 54 | + /// $recursiveRef - used to construct recursive schemas i.e one that has a reference to its own root, identified by the empty fragment URI reference ("#") |
| 55 | + /// </summary> |
28 | 56 | public string RecursiveRef { get; set; }
|
29 | 57 |
|
| 58 | + /// <summary> |
| 59 | + /// $defs - reserves a location for schema authors to inline re-usable JSON Schemas into a more general schema. |
| 60 | + /// The keyword does not directly affect the validation result |
| 61 | + /// </summary> |
30 | 62 | public IDictionary<string, OpenApiSchema> Definitions { get; set; }
|
31 | 63 |
|
32 |
| - public bool UnevaluatedProperties { get; set; } |
33 |
| - |
| 64 | + /// <summary> |
| 65 | + /// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00 |
| 66 | + /// </summary> |
34 | 67 | public decimal V31ExclusiveMaximum { get; set; }
|
35 | 68 |
|
| 69 | + /// <summary> |
| 70 | + /// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00 |
| 71 | + /// </summary> |
36 | 72 | public decimal V31ExclusiveMinimum { get; set; }
|
37 | 73 |
|
| 74 | + /// <summary> |
| 75 | + /// |
| 76 | + /// </summary> |
| 77 | + public bool UnEvaluatedProperties { get; set; } |
38 | 78 |
|
39 | 79 | /// <summary>
|
40 | 80 | /// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
|
@@ -225,13 +265,18 @@ internal class OpenApiSchema
|
225 | 265 | /// <summary>
|
226 | 266 | /// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00
|
227 | 267 | /// </summary>
|
228 |
| - public IList<OpenApiAny> Enum { get; set; } = new List<OpenApiAny>(); |
| 268 | + public IList<JsonNode> Enum { get; set; } = new List<JsonNode>(); |
229 | 269 |
|
230 | 270 | /// <summary>
|
231 | 271 | /// Allows sending a null value for the defined schema. Default value is false.
|
232 | 272 | /// </summary>
|
233 | 273 | public bool Nullable { get; set; }
|
234 | 274 |
|
| 275 | + /// <summary> |
| 276 | + /// Follow JSON Schema definition: https://tools.ietf.org/html/draft-fge-json-schema-validation-00 |
| 277 | + /// </summary> |
| 278 | + public bool UnevaluatedProperties { get; set;} |
| 279 | + |
235 | 280 | /// <summary>
|
236 | 281 | /// Additional external documentation for this schema.
|
237 | 282 | /// </summary>
|
@@ -317,7 +362,7 @@ public OpenApiSchema(OpenApiSchema schema)
|
317 | 362 | AdditionalProperties = schema?.AdditionalProperties != null ? new(schema?.AdditionalProperties) : null;
|
318 | 363 | Discriminator = schema?.Discriminator != null ? new(schema?.Discriminator) : null;
|
319 | 364 | Example = schema?.Example != null ? new(schema?.Example.Node) : null;
|
320 |
| - Enum = schema?.Enum != null ? new List<OpenApiAny>(schema.Enum) : null; |
| 365 | + Enum = schema?.Enum != null ? new List<JsonNode>(schema.Enum) : null; |
321 | 366 | Nullable = schema?.Nullable ?? Nullable;
|
322 | 367 | ExternalDocs = schema?.ExternalDocs != null ? new(schema?.ExternalDocs) : null;
|
323 | 368 | Deprecated = schema?.Deprecated ?? Deprecated;
|
|
0 commit comments