We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input Format: JSON Schema Draft 07
Output Language: C#
CLI, npm, or app.quicktype.io: app.quicktype.io Version:
when I combine dependecies keyword with oneOf keyword, some field are not generated in the output C# code.
{ "$schema": "http://json-schema.org/draft-07/schema#", "title": "Conditional Properties Example", "type": "object", "properties": { "acceptsTerms": { "type": "boolean", "title": "Do you accept the terms and conditions?" }, "userDetails": { "type": "object", "properties": { "firstName": { "type": "string", "title": "First Name" }, "lastName": { "type": "string", "title": "Last Name" }, "email": { "type": "string", "format": "email", "title": "Email Address" } }, "required": [ "firstName", "lastName", "email" ] } }, "dependencies": { "acceptsTerms": { "oneOf": [ { "properties": { "acceptsTerms": { "const": true }, "userDetails": { "type": "object", "properties": { "comment": { "type": "string", "title": "comment" } } } }, "required": [ "userDetails" ] }, { "properties": { "acceptsTerms": { "const": false } } } ] } } }
Property "Comment" should be inserted
// <auto-generated /> // // To parse this JSON data, add NuGet 'Newtonsoft.Json' then do: // // using QuickType; // // var test = Test.FromJson(jsonString); namespace QuickType { using System; using System.Collections.Generic; using System.Globalization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; public partial class Test { [JsonProperty("acceptsTerms", NullValueHandling = NullValueHandling.Ignore)] public virtual bool? AcceptsTerms { get; set; } [JsonProperty("userDetails", NullValueHandling = NullValueHandling.Ignore)] public virtual UserDetails UserDetails { get; set; } } public partial class UserDetails { [JsonProperty("email")] public virtual string Email { get; set; } [JsonProperty("firstName")] public virtual string FirstName { get; set; } [JsonProperty("lastName")] public virtual string LastName { get; set; } [JsonProperty("comment")] public virtual string Comment { get; set; } } public partial class Test { public static Test FromJson(string json) => JsonConvert.DeserializeObject<Test>(json, QuickType.Converter.Settings); } public static class Serialize { public static string ToJson(this Test self) => JsonConvert.SerializeObject(self, QuickType.Converter.Settings); } ............ }
Property "Comment" is missing.
// <auto-generated /> // // To parse this JSON data, add NuGet 'Newtonsoft.Json' then do: // // using QuickType; // // var test = Test.FromJson(jsonString); namespace QuickType { using System; using System.Collections.Generic; using System.Globalization; using Newtonsoft.Json; using Newtonsoft.Json.Converters; public partial class Test { [JsonProperty("acceptsTerms", NullValueHandling = NullValueHandling.Ignore)] public virtual bool? AcceptsTerms { get; set; } [JsonProperty("userDetails", NullValueHandling = NullValueHandling.Ignore)] public virtual UserDetails UserDetails { get; set; } } public partial class UserDetails { [JsonProperty("email")] public virtual string Email { get; set; } [JsonProperty("firstName")] public virtual string FirstName { get; set; } [JsonProperty("lastName")] public virtual string LastName { get; set; } } public partial class Test { public static Test FromJson(string json) => JsonConvert.DeserializeObject<Test>(json, QuickType.Converter.Settings); } public static class Serialize { public static string ToJson(this Test self) => JsonConvert.SerializeObject(self, QuickType.Converter.Settings); } ............ }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Input Format: JSON Schema Draft 07
Output Language: C#
CLI, npm, or app.quicktype.io: app.quicktype.io
Version:
Description
when I combine dependecies keyword with oneOf keyword, some field are not generated in the output C# code.
Input Data
Expected Behaviour / Output
Property "Comment" should be inserted
Current Behaviour / Output
Property "Comment" is missing.
The text was updated successfully, but these errors were encountered: