Skip to content

Commit 9e30b78

Browse files
committed
add warnings about AOT in examples; update examples
1 parent 8ef6eb3 commit 9e30b78

File tree

5 files changed

+24
-3
lines changed

5 files changed

+24
-3
lines changed

_docs/schema/codegen/mini-meta-schemas.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ permalink: /schema/codegen/:title/
55
icon: fas fa-tag
66
order: "01.6.3"
77
---
8+
> **DEPRECATION NOTICE**
9+
>
10+
> *JsonSchema.Net.CodeGeneration* is no longer being developed.
11+
>
12+
> Please see https://blog.json-everything.net/posts/dropping-codegen/ for more information.
13+
{: .prompt-danger }
814

915
This page serves as a reference to the mini-meta-schemas that are used to identify the supported patterns.
1016

_docs/schema/codegen/patterns.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ permalink: /schema/codegen/:title/
55
icon: fas fa-tag
66
order: "01.6.2"
77
---
8+
> **DEPRECATION NOTICE**
9+
>
10+
> *JsonSchema.Net.CodeGeneration* is no longer being developed.
11+
>
12+
> Please see https://blog.json-everything.net/posts/dropping-codegen/ for more information.
13+
{: .prompt-danger }
814

915
This page gives more technical information on the various schema patterns that are supported by the code generation functionality.
1016

_docs/schema/codegen/schema-codegen.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ permalink: /schema/codegen/:title/
66
icon: fas fa-tag
77
order: "01.6.1"
88
---
9+
> **DEPRECATION NOTICE**
10+
>
11+
> *JsonSchema.Net.CodeGeneration* is no longer being developed.
12+
>
13+
> Please see https://blog.json-everything.net/posts/dropping-codegen/ for more information.
14+
{: .prompt-danger }
15+
916
*JsonSchema.Net.CodeGeneration* is a tool that can create C# code from JSON Schemas.
1017

1118
For example, given the schema:

_docs/schema/examples/custom-vocabs.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ class MaxDateJsonConverter : JsonConverter<MaxDateKeyword>
7575
MaxDateKeyword value,
7676
JsonSerializerOptions options)
7777
{
78-
writer.WritePropertyName(MaxDateKeyword.Name);
7978
writer.WriteStringValue(value.Date.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ssK"));
8079
}
8180
}
@@ -91,9 +90,12 @@ Now that we have the keyword, we need to tell the system about it.
9190
SchemaKeywordRegistry.Register<MaxDateKeyword>();
9291
```
9392

94-
> If you're building a dynamic system where you don't always want the keyword supported, it can be removed using the `SchemaKeywordRegistry.Unregister<T>()` static method.
93+
> If your app is running in a Native AOT context, you'll need to use the `.Register<MaxDateKeyword>()` overload to properly support serialization.
9594
{: .prompt-info }
9695

96+
> If you're building a dynamic system where you don't always want the keyword supported, it can be removed using the `SchemaKeywordRegistry.Unregister<T>()` static method.
97+
{: .prompt-tip }
98+
9799
You'll also want to set the `EvaluationOptions.ProcessCustomKeywords` option to true so that non-dialect keywords are processed.
98100

99101
That's technically all you need to do to support a custom keyword. However, going forward for JSON Schema, custom keywords should be defined in a custom vocabulary.

_docs/schema/vocabs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ Both stages are defined by implementing the single method on `IJsonSchemaKeyword
132132

133133
_JsonSchema.Net_ v6 includes updates to support [Native AOT applications](https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/). Please be sure to read the main AOT section on the [overview page](/schema/basics#aot).
134134

135-
Frist, you'll need to add `[JsonSerializable]` attributes for any custom keywords.
135+
First, you'll need to add `[JsonSerializable]` attributes for any custom keywords.
136136

137137
```c#
138138
[JsonSerializable(typeof(MyKeyword))]

0 commit comments

Comments
 (0)