You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 421e64c
Browse filesBrowse the repository at this point in the historyBrowse files
After authorization, you will be redirected to a local URL.
120
120
Please copy the 'code' parameter from the redirect URL and paste it here:
121
121
122
-
Authorization code: [User pastes the code here]
122
+
Authorization code: [paste the code here]
123
123
124
124
Exchanging authorization code for access token...
125
125
OAuth authentication successful!
126
-
Access token expires at: 2024-01-15 14:30:00 UTC
126
+
Access token expires at: 2026-01-15 14:30:00 UTC
127
+
Fetching stack details for the provided API key.
128
+
No path specified. Generating files in the current working directory: /Users/you/project.
129
+
Fetching content types from My Contentstack Stack stack.
130
+
Found 5 content types.
131
+
Total content types fetched: 5.
132
+
Fetching global fields from stack: My Contentstack Stack.
133
+
Found 2 global fields.
134
+
Total global fields fetched: 2.
135
+
Generating files from content types.
136
+
Files created successfully.
137
+
Opening output directory: /Users/you/project.
127
138
128
-
Fetching stack information...
129
-
Stack: My Contentstack Stack
130
-
API Key: api_key
139
+
Logging out from OAuth...
140
+
OAuth logout successful!
141
+
```
131
142
132
-
Fetching content types...
133
-
Found 5 content types:
134
-
Generating files from content type
143
+
## Generated Code
135
144
136
-
Files successfully created!
137
-
Opening <file_path>/Models
145
+
**As of v1.0.0**, generated model files use **System.Text.Json** instead of Newtonsoft.Json:
138
146
139
-
Logging out from OAuth...
140
-
OAuth logout successful!
147
+
- Properties are decorated with `[JsonPropertyName("...")]` instead of `[JsonProperty(propertyName: "...")]`.
148
+
- Generated files reference `System.Text.Json`, `System.Text.Json.Nodes`, and `System.Text.Json.Serialization` instead of `Newtonsoft.Json`.
149
+
- Generated converters (for embedded objects and modular blocks) inherit `System.Text.Json.Serialization.JsonConverter<T>` and implement `Read`/`Write` instead of Newtonsoft's `JsonConverter<T>` with `ReadJson`/`WriteJson`.
150
+
151
+
A generated model file looks like this:
152
+
153
+
```csharp
154
+
usingSystem;
155
+
usingSystem.Text.Json;
156
+
usingSystem.Text.Json.Nodes;
157
+
usingSystem.Text.Json.Serialization;
158
+
usingContentstack.Core.Models;
159
+
usingContentstack.Utils.Interfaces;
160
+
161
+
namespaceContentstackModels.Models
162
+
{
163
+
publicpartialclassBlogPost : IEmbeddedObject
164
+
{
165
+
publicconststringContentType="blog_post";
166
+
[JsonPropertyName("uid")]
167
+
publicstringUid { get; set; }
168
+
[JsonPropertyName("_content_type_uid")]
169
+
publicstringContentTypeUid { get; set; }
170
+
[JsonPropertyName("title")]
171
+
publicstringTitle { get; set; }
172
+
}
173
+
}
141
174
```
142
175
176
+
**Breaking change:** if you regenerate models for an existing project using v1.0.0 or later, the attributes and converter base classes in the output will change from the Newtonsoft-based shape to the System.Text.Json-based shape shown above. Update your consuming code and Contentstack .NET SDK versions accordingly before regenerating.
0 commit comments