Skip to content

Commit 71ae0d1

Browse files
committed
add docs for xml comment inclusion for schemagen
1 parent b788eb2 commit 71ae0d1

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

_docs/path/basics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ permalink: /path/:title/
77
icon: fas fa-tag
88
order: "02.1"
99
---
10-
JSON Path is a query language for JSON documents inspired by what XPath provides for XML documents. It was [originally proposed](https://goessner.net/articles/JsonPath/) by Matt Goëssner, and now a [specification](https://github.com/ietf-wg-jsonpath/draft-ietf-jsonpath-base) is in progress.
10+
JSON Path is a query language for JSON documents inspired by what XPath provides for XML documents. It was [originally proposed](https://goessner.net/articles/JsonPath/) by Matt Goëssner and is now an IETF specification: [RFC 9535](https://www.rfc-editor.org/rfc/rfc9535.html).
1111

12-
Version 0.5.x is aligned with the specification as of the end of April 2023, plus additional support for the following features, which were not included in the specification:
12+
The library was promoted to version with the release of the specification, and also includes additional support for the following features, which the specification team passed on:
1313

1414
- arithmetic operations in expressions
1515
- `in` operator in expressions

_docs/schema/schemagen/schema-generation.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,22 @@ For POCOs, read-only properties and fields will be marked with a `readOnly` keyw
142142

143143
Lastly, property names will either be listed as declared in code (default) or sorted by name. This is controlled via the `SchemaGenerationConfiguration.PropertyOrder` property.
144144

145+
### XML comment support
146+
147+
In addition to the explicit attributes above, the XML comment `<Summary>` element can be configured to render to a `description` keyword. Because .Net saves this information into an external XML file instead of into the reflection data, you'll need to have a configuration object and register the XML filename.
148+
149+
```c#
150+
var config = new SchemaGenerationConfiguration();
151+
// MyModel is any type from the assembly. A single registration will
152+
// cover the entire assembly.
153+
config.RegisterXmlCommentsFile<MyModel>("MyAssembly.xml");
154+
155+
var schema = new JsonSchemaBuilder.FromType<MyModel>(config).Build();
156+
```
157+
158+
> Explicitly using the `[Description]` attribute will override XML comments, and XML comments on members will override XML comments on types.
159+
{: .prompt-info }
160+
145161
### Nullability {#schema-schemagen-nullability}
146162

147163
There is a discrepancy between how .Net does validation and how JSON Schema does validation that centers primarily around nullable types and the `[Required]` attribute.

0 commit comments

Comments
 (0)