Skip to content

Commit 2350084

Browse files
committed
Tweak formatting of code for docs
1 parent 3fe9b4f commit 2350084

File tree

7 files changed

+360
-334
lines changed

7 files changed

+360
-334
lines changed

docs/client-concepts/client-concepts.asciidoc

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
[[client-concepts]]
2-
== Client concepts
2+
= Client concepts
33

4-
The high-level .NET client for {es} maps closely to the original {es} API. All
4+
The .NET client for {es} maps closely to the original {es} API. All
55
requests and responses are exposed through types, making it ideal for getting up and running quickly.
66

77
[[serialization]]
8-
=== Serialization
8+
== Serialization
99

1010
By default, the .NET client for {es} uses the Microsoft System.Text.Json library for serialization. The client understands how to serialize and
1111
deserialize the request and response types correctly. It also handles (de)serialization of user POCO types representing documents read or written to {es}.
1212

1313
The client has two distinct serialization responsibilities - serialization of the types owned by the `Elastic.Clients.Elasticsearch` library and serialization of source documents, modeled in application code. The first responsibility is entirely internal; the second is configurable.
1414

1515
[[source-serialization]]
16-
==== Source serialization
16+
=== Source serialization
1717

1818
Source serialization refers to the process of (de)serializing POCO types in consumer applications as source documents indexed and retrieved from {es}. A source serializer implementation handles serialization, with the default implementation using the `System.Text.Json` library. As a result, you may use `System.Text.Json` attributes and converters to control the serialization behavior.
1919

docs/client-concepts/serialization/custom-serialization.asciidoc

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
[[custom-serialization]]
2-
=== Custom Serialization
2+
==== Custom serialization
33

44
The built-in source serializer handles most POCO document models correctly. Sometimes, you may need further control over how your types are serialized.
55

66
NOTE: The built-in source serializer uses the Microsoft https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/overview[`System.Text.Json` library] internally. You can apply `System.Text.Json` attributes and converters to control serialization of your document types.
77

88
[[system-text-json-attributes]]
9-
==== Using System.Text.Json attributes
9+
===== Using `System.Text.Json` attributes
1010

1111
`System.Text.Json` includes attributes that can be applied to types and properties to control how they are serialized. These can be applied to your POCO document types to perform actions such as controlling the name of a property, or ignoring a property entirely. Visit the https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/overview[Microsoft documentation for further examples].
1212

1313
We can model a document to represent data about a person using a regular class (POCO), applying `System.Text.Json`` attributes as necessary.
1414

1515
[source,csharp]
1616
----
17-
include-tagged::{doc-tests-src}/ClientConcepts/Serialization/CustomSerializationTests.cs[usings-serialization]
18-
19-
include-tagged::{doc-tests-src}/ClientConcepts/Serialization/CustomSerializationTests.cs[person-class-with-attributes]
17+
include::{doc-tests-src}/ClientConcepts/Serialization/CustomSerializationTests.cs[tag=usings-serialization]
18+
include::{doc-tests-src}/ClientConcepts/Serialization/CustomSerializationTests.cs[tag=person-class-with-attributes]
2019
----
2120
<1> the `JsonPropertyName` attribute is used to provide a specific name (`forename`) for the `FirstName` property when serialized.
2221
<2> the `JsonIgnore` attribute is used to prevent the `Age` property from appearing in the serialized JSON.
@@ -25,9 +24,8 @@ We can then index the an instance of the document into {es}.
2524

2625
[source,csharp]
2726
----
28-
include-tagged::{doc-tests-src}/ClientConcepts/Serialization/CustomSerializationTests.cs[usings]
29-
30-
include-tagged::{doc-tests-src}/ClientConcepts/Serialization/CustomSerializationTests.cs[index-person-with-attributes]
27+
include::{doc-tests-src}/ClientConcepts/Serialization/CustomSerializationTests.cs[tag=usings]
28+
include::{doc-tests-src}/ClientConcepts/Serialization/CustomSerializationTests.cs[tag=index-person-with-attributes]
3129
----
3230

3331
The index request is serialized, with the source serializer handling the `Person` type, serializing the POCO property named `FirstName` to the JSON object member named `forename`. The `Age` property is ignored and does not appear in the JSON.
@@ -40,17 +38,17 @@ The index request is serialized, with the source serializer handling the `Person
4038
----
4139

4240
[[registering-custom-converters]]
43-
==== Registering custom System.Text.Json converters
41+
===== Registering custom `System.Text.Json` converters
4442

4543
TODO
4644

4745
[[configuring-custom-jsonserializeroptions]]
48-
==== Configuring custom JsonSerializerOptions
46+
===== Configuring custom `JsonSerializerOptions`
4947

5048
TODO
5149

5250
[[injecting-custom-serializer]]
53-
==== Injecting a custom serializer
51+
===== Injecting a custom serializer
5452

5553
TODO
5654
- Deriving from SystemTextJsonSerializer

docs/client-concepts/serialization/modeling-documents-with-types.asciidoc

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[[modeling-documents-with-types]]
2-
=== Modeling documents with types
2+
==== Modeling documents with types
33

44
{es} provides search and aggregation capabilities on the documents that it is sent and indexes. These documents are sent as
55
JSON objects within the request body of a HTTP request. It is natural to model documents within the {es} .NET client using
@@ -8,7 +8,7 @@ https://en.wikipedia.org/wiki/Plain_Old_CLR_Object[POCOs (__Plain Old CLR Object
88
This section provides an overview of how types and type hierarchies can be used to model documents.
99

1010
[[default-behaviour]]
11-
==== Default behaviour
11+
===== Default behaviour
1212

1313
The default behaviour is to serialize type property names as camelcase JSON object members.
1414

@@ -24,7 +24,6 @@ We can then index the an instance of the document into {es}.
2424
[source,csharp]
2525
----
2626
include-tagged::{doc-tests-src}/ClientConcepts/Serialization/ModellingDocumentsWithTypesTests.cs[usings]
27-
2827
include-tagged::{doc-tests-src}/ClientConcepts/Serialization/ModellingDocumentsWithTypesTests.cs[index-my-document]
2928
----
3029

exclusion.dic

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ deserialize
22
json
33
async
44
inferrer
5-
elasticsearch
5+
elasticsearch
6+
asciidocs
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[*]
2+
indent_style = space

0 commit comments

Comments
 (0)