Skip to content

Commit 44c1256

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

File tree

5 files changed

+334
-329
lines changed

5 files changed

+334
-329
lines changed

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

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[*]
2+
indent_style = space

0 commit comments

Comments
 (0)